finish login & polish up
This commit is contained in:
@@ -39,7 +39,8 @@ namespace OwnChar.App.Desktop.UI.Windows
|
||||
//
|
||||
radTabbedFormControl2.Location = new System.Drawing.Point(0, 0);
|
||||
radTabbedFormControl2.Name = "radTabbedFormControl1";
|
||||
radTabbedFormControl2.ShowNewTabButton = false;
|
||||
radTabbedFormControl2.ShowIcon = true;
|
||||
radTabbedFormControl2.ShowTabPinButton = true;
|
||||
radTabbedFormControl2.Size = new System.Drawing.Size(768, 583);
|
||||
radTabbedFormControl2.TabIndex = 0;
|
||||
radTabbedFormControl2.TabWidth = 200;
|
||||
@@ -55,7 +56,6 @@ namespace OwnChar.App.Desktop.UI.Windows
|
||||
ClientSize = new System.Drawing.Size(780, 589);
|
||||
Controls.Add(radTabbedFormControl2);
|
||||
Name = "MainWindow";
|
||||
ShowIcon = false;
|
||||
Text = "RadForm1";
|
||||
Load += MainWindow_Load;
|
||||
((System.ComponentModel.ISupportInitialize)radTabbedFormControl2).EndInit();
|
||||
@@ -65,7 +65,6 @@ namespace OwnChar.App.Desktop.UI.Windows
|
||||
|
||||
#endregion
|
||||
|
||||
private Telerik.WinControls.UI.RadTabbedFormControl radTabbedFormControl1;
|
||||
private RadTabbedFormControl radTabbedFormControl2;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,69 @@
|
||||
using OwnChar.App.Desktop.Api;
|
||||
using OwnChar.App.Desktop.Api.Parameters;
|
||||
using OwnChar.App.Desktop.LangRes;
|
||||
using OwnChar.App.Desktop.Settings;
|
||||
using OwnChar.App.Desktop.UI.MainTabs;
|
||||
using OwnChar.Manager;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
||||
using Pilz.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Telerik.WinControls.UI;
|
||||
using Telerik.Windows.Diagrams.Core;
|
||||
|
||||
namespace OwnChar.App.Desktop.UI.Windows;
|
||||
|
||||
public partial class MainWindow : RadTabbedForm, IMainWindowApi
|
||||
{
|
||||
private readonly MainWindowSettings settings = AppApi.Instance.Settings.Get<MainWindowSettings>();
|
||||
|
||||
Form IMainWindowApi.Window => this;
|
||||
public OwnCharManager Manager { get; } = new();
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
PluginFeatureController.Instance.Features.Get(FeatureCodes.QuickAction).InsertItemsTo(radTabbedFormControl1.RightItems, customClickHandler: RightItem_Clicked);
|
||||
|
||||
if (!settings.AllowAero)
|
||||
AllowAero = false;
|
||||
|
||||
PluginFeatureController.Instance.Features.Get(FeatureCodes.QuickAction)
|
||||
.InsertItemsTo(radTabbedFormControl2.RightItems, customClickHandler: RightItem_Clicked)
|
||||
.ForEach(item => item.DisplayStyle = Telerik.WinControls.DisplayStyle.Image);
|
||||
}
|
||||
|
||||
private MainWindowParams GetMainWindowParams()
|
||||
protected virtual MainWindowParams GetMainWindowParams()
|
||||
{
|
||||
return new MainWindowParams(this);
|
||||
}
|
||||
|
||||
public void OpenTab(Control content, string title)
|
||||
{
|
||||
var newTab = new RadTabbedFormControlTab();
|
||||
content.BackColor = System.Drawing.Color.Transparent;
|
||||
content.Dock = DockStyle.Fill;
|
||||
newTab.Controls.Add(content);
|
||||
newTab.Text = title;
|
||||
newTab.Tag = content;
|
||||
|
||||
var newTab = new RadTabbedFormControlTab
|
||||
{
|
||||
Text = title,
|
||||
Tag = content
|
||||
};
|
||||
|
||||
content.Tag = newTab;
|
||||
radTabbedFormControl1.Tabs.Add(newTab);
|
||||
radTabbedFormControl1.SelectedTab = newTab;
|
||||
newTab.Controls.Add(content);
|
||||
|
||||
radTabbedFormControl2.Tabs.Add(newTab);
|
||||
radTabbedFormControl2.SelectedTab = newTab;
|
||||
|
||||
if (content is ILoadContent loadContent)
|
||||
loadContent.LoadContent();
|
||||
}
|
||||
|
||||
public void CloseTab(Control content)
|
||||
{
|
||||
if (FindTab(content) is RadTabbedFormControlTab tab)
|
||||
radTabbedFormControl1.Tabs.Remove(tab);
|
||||
radTabbedFormControl2.Tabs.Remove(tab);
|
||||
}
|
||||
|
||||
public bool IsTabOpen(Control content)
|
||||
@@ -58,12 +78,12 @@ public partial class MainWindow : RadTabbedForm, IMainWindowApi
|
||||
|
||||
private RadTabbedFormControlTab? FindTab(Control content)
|
||||
{
|
||||
return radTabbedFormControl1.Tabs.FirstOrDefault(n => n.Tag == content);
|
||||
return radTabbedFormControl2.Tabs.FirstOrDefault(n => n.Tag == content);
|
||||
}
|
||||
|
||||
private RadTabbedFormControlTab? FindTab<T>()
|
||||
{
|
||||
return radTabbedFormControl1.Tabs.FirstOrDefault(n => n.Tag is T);
|
||||
return radTabbedFormControl2.Tabs.FirstOrDefault(n => n.Tag is T);
|
||||
}
|
||||
|
||||
private void RightItem_Clicked(object? sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user