save on logout & logout on close
This commit is contained in:
@@ -11,4 +11,5 @@ public interface IMainWindowApi
|
||||
void CloseTab(Control content);
|
||||
bool IsTabOpen(Control content);
|
||||
bool IsTabOpen<T>();
|
||||
void Logout();
|
||||
}
|
||||
|
||||
@@ -38,14 +38,13 @@ namespace OwnChar.App.Desktop.UI.Windows
|
||||
// radTabbedFormControl2
|
||||
//
|
||||
radTabbedFormControl2.Location = new System.Drawing.Point(0, 0);
|
||||
radTabbedFormControl2.Name = "radTabbedFormControl1";
|
||||
radTabbedFormControl2.ShowIcon = true;
|
||||
radTabbedFormControl2.Name = "radTabbedFormControl2";
|
||||
radTabbedFormControl2.ShowTabPinButton = true;
|
||||
radTabbedFormControl2.Size = new System.Drawing.Size(768, 583);
|
||||
radTabbedFormControl2.Size = new System.Drawing.Size(774, 586);
|
||||
radTabbedFormControl2.TabIndex = 0;
|
||||
radTabbedFormControl2.TabWidth = 200;
|
||||
radTabbedFormControl2.Text = "MainForm";
|
||||
((RadTabbedFormControlElement)radTabbedFormControl2.GetChildAt(0)).Text = "MainForm";
|
||||
radTabbedFormControl2.Text = "RadForm1";
|
||||
((RadTabbedFormControlElement)radTabbedFormControl2.GetChildAt(0)).Text = "RadForm1";
|
||||
((RadQuickAccessOverflowButton)radTabbedFormControl2.GetChildAt(0).GetChildAt(3).GetChildAt(1)).Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
|
||||
((RadQuickAccessOverflowButton)radTabbedFormControl2.GetChildAt(0).GetChildAt(4).GetChildAt(1)).Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
|
||||
//
|
||||
@@ -53,10 +52,12 @@ namespace OwnChar.App.Desktop.UI.Windows
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(780, 589);
|
||||
ClientSize = new System.Drawing.Size(774, 586);
|
||||
Controls.Add(radTabbedFormControl2);
|
||||
Name = "MainWindow";
|
||||
ShowIcon = false;
|
||||
Text = "RadForm1";
|
||||
FormClosed += MainWindow_FormClosed;
|
||||
Load += MainWindow_Load;
|
||||
((System.ComponentModel.ISupportInitialize)radTabbedFormControl2).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)this).EndInit();
|
||||
|
||||
@@ -52,7 +52,7 @@ public partial class MainWindow : RadTabbedForm, IMainWindowApi
|
||||
|
||||
content.Tag = newTab;
|
||||
newTab.Controls.Add(content);
|
||||
|
||||
|
||||
radTabbedFormControl2.Tabs.Add(newTab);
|
||||
radTabbedFormControl2.SelectedTab = newTab;
|
||||
|
||||
@@ -76,6 +76,23 @@ public partial class MainWindow : RadTabbedForm, IMainWindowApi
|
||||
return FindTab<T>() != null;
|
||||
}
|
||||
|
||||
public void Logout()
|
||||
{
|
||||
Logout(true);
|
||||
}
|
||||
|
||||
private void Logout(bool openLogin)
|
||||
{
|
||||
Manager.Logout();
|
||||
if (openLogin)
|
||||
Login();
|
||||
}
|
||||
|
||||
private void Login()
|
||||
{
|
||||
OpenTab(new TabLoginView(this), LoginPageLangRes.Title);
|
||||
}
|
||||
|
||||
private RadTabbedFormControlTab? FindTab(Control content)
|
||||
{
|
||||
return radTabbedFormControl2.Tabs.FirstOrDefault(n => n.Tag == content);
|
||||
@@ -94,6 +111,11 @@ public partial class MainWindow : RadTabbedForm, IMainWindowApi
|
||||
|
||||
private void MainWindow_Load(object sender, EventArgs e)
|
||||
{
|
||||
OpenTab(new TabLoginView(this), LoginPageLangRes.Title);
|
||||
Login();
|
||||
}
|
||||
|
||||
private void MainWindow_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Logout(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user