From ffc4658d8ec1c22017ccfe6092b1633766f96bf2 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Tue, 11 Jun 2024 07:37:13 +0200 Subject: [PATCH] finish login & polish up --- .../LoginProviders/JsonFileLoginProvider.cs | 5 +- .../JsonFileLoginProviderLangRes.Designer.cs | 81 +++++++++++ .../LangRes/JsonFileLoginProviderLangRes.resx | 126 ++++++++++++++++++ .../OwnChar.App.Desktop.csproj | 9 ++ OwnChar.App.Desktop/Program.cs | 11 +- .../Settings/MainWindowSettings.cs | 15 +++ .../UI/MainTabs/TabLoginView.Designer.cs | 48 +++---- .../UI/MainTabs/TabLoginView.cs | 2 +- .../UI/Windows/MainWindow.Designer.cs | 5 +- OwnChar.App.Desktop/UI/Windows/MainWindow.cs | 42 ++++-- 10 files changed, 298 insertions(+), 46 deletions(-) create mode 100644 OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.Designer.cs create mode 100644 OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.resx create mode 100644 OwnChar.App.Desktop/Settings/MainWindowSettings.cs diff --git a/OwnChar.App.Desktop/Features/LoginProviders/JsonFileLoginProvider.cs b/OwnChar.App.Desktop/Features/LoginProviders/JsonFileLoginProvider.cs index 1a10fd7..d5d43d9 100644 --- a/OwnChar.App.Desktop/Features/LoginProviders/JsonFileLoginProvider.cs +++ b/OwnChar.App.Desktop/Features/LoginProviders/JsonFileLoginProvider.cs @@ -1,4 +1,5 @@ using OwnChar.App.Desktop.Api; +using OwnChar.App.Desktop.LangRes; using OwnChar.App.Desktop.Settings; using OwnChar.Data; using OwnChar.Data.Managers; @@ -8,7 +9,7 @@ using Telerik.WinControls.UI; namespace OwnChar.App.Desktop.Features.LoginProviders; -internal class JsonFileLoginProvider() : LoginProvider(FeatureCodes.LoginProvider, "ownchar.jsonfile"), IPluginFeatureProvider +internal class JsonFileLoginProvider() : LoginProvider(FeatureCodes.LoginProvider, "ownchar.jsonfile", JsonFileLoginProviderLangRes.Name), IPluginFeatureProvider { private const string defaultJsonFileName = "ownchar.db.json"; @@ -25,7 +26,7 @@ internal class JsonFileLoginProvider() : LoginProvider(FeatureCodes.LoginProvide var settings = AppApi.Instance.Settings.Get(); using var ofd = new RadOpenFileDialog { - Filter = "OwnChar Json database (*.json)|*.json" + Filter = $"{JsonFileLoginProviderLangRes.Filter_Json} (*.json)|*.json" }; if (manager is DefaultDataManager defaultManager && defaultManager.DataProvider is JsonFileDataProvider jsonFileDataProvider) diff --git a/OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.Designer.cs b/OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.Designer.cs new file mode 100644 index 0000000..8baa941 --- /dev/null +++ b/OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.Designer.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace OwnChar.App.Desktop.LangRes { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class JsonFileLoginProviderLangRes { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal JsonFileLoginProviderLangRes() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OwnChar.App.Desktop.LangRes.JsonFileLoginProviderLangRes", typeof(JsonFileLoginProviderLangRes).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die OwnChar Json database ähnelt. + /// + internal static string Filter_Json { + get { + return ResourceManager.GetString("Filter_Json", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Json database file ähnelt. + /// + internal static string Name { + get { + return ResourceManager.GetString("Name", resourceCulture); + } + } + } +} diff --git a/OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.resx b/OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.resx new file mode 100644 index 0000000..b10bbad --- /dev/null +++ b/OwnChar.App.Desktop/LangRes/JsonFileLoginProviderLangRes.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + OwnChar Json database + + + Json database file + + \ No newline at end of file diff --git a/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj b/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj index eacbcee..ff9437b 100644 --- a/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj +++ b/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj @@ -31,6 +31,11 @@ + + True + True + JsonFileLoginProviderLangRes.resx + True True @@ -44,6 +49,10 @@ + + ResXFileCodeGenerator + JsonFileLoginProviderLangRes.Designer.cs + ResXFileCodeGenerator LoginPageLangRes.Designer.cs diff --git a/OwnChar.App.Desktop/Program.cs b/OwnChar.App.Desktop/Program.cs index 7597d5f..e73b8b9 100644 --- a/OwnChar.App.Desktop/Program.cs +++ b/OwnChar.App.Desktop/Program.cs @@ -23,6 +23,7 @@ internal static class Program { // Load settings AppTempFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "OwnChar", "Desktop"); + Directory.CreateDirectory(AppTempFolder); SettingsManager = new SettingsManager(Path.Combine(AppTempFolder, "Settings.json"), true); AppApi.Instance.Settings = SettingsManager.Instance; @@ -33,12 +34,10 @@ internal static class Program // Load plugins OwnCharPlugins.Instance.LoadOwnPlugins(); - var pluginPath = Path.Combine(Path.GetDirectoryName(Pilz.IO.Extensions.GetExecutablePath())!, "Plugins"); - if (Directory.Exists(pluginPath)) - { - var plugins = Directory.GetDirectories(pluginPath, "*", SearchOption.TopDirectoryOnly).Select(n => Path.Combine(n, n + ".dll")).ToArray(); - OwnCharPlugins.Instance.LoadPlugins(plugins); - } + var pluginPath = Path.Combine(AppTempFolder, "Plugins"); + Directory.CreateDirectory(pluginPath); + var plugins = Directory.GetDirectories(pluginPath, "*", SearchOption.TopDirectoryOnly).Select(n => Path.Combine(n, n + ".dll")).ToArray(); + OwnCharPlugins.Instance.LoadPlugins(plugins); // Start main window var mainWindow = new MainWindow(); diff --git a/OwnChar.App.Desktop/Settings/MainWindowSettings.cs b/OwnChar.App.Desktop/Settings/MainWindowSettings.cs new file mode 100644 index 0000000..8207ab9 --- /dev/null +++ b/OwnChar.App.Desktop/Settings/MainWindowSettings.cs @@ -0,0 +1,15 @@ +using Pilz.Configuration; + +namespace OwnChar.App.Desktop.Settings; + +internal class MainWindowSettings : IChildSettings, ISettingsIdentifier +{ + public static string Identifier => "ownchar.view.main"; + + public bool AllowAero { get; set; } + + public void Reset() + { + AllowAero = true; + } +} diff --git a/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.Designer.cs b/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.Designer.cs index 0e5ef45..2ed5eac 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.Designer.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.Designer.cs @@ -57,8 +57,8 @@ tableLayoutPanel1.AutoSize = true; tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; tableLayoutPanel1.ColumnCount = 2; - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F)); - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60F)); + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3333321F)); + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.6666641F)); tableLayoutPanel1.Controls.Add(radTextBoxControl_Password, 1, 2); tableLayoutPanel1.Controls.Add(radLabel2, 0, 2); tableLayoutPanel1.Controls.Add(radTextBoxControl_Username, 1, 1); @@ -66,7 +66,8 @@ tableLayoutPanel1.Controls.Add(radLabel1, 0, 1); tableLayoutPanel1.Controls.Add(radLabel3, 0, 0); tableLayoutPanel1.Controls.Add(tableLayoutPanel3, 1, 0); - tableLayoutPanel1.Location = new System.Drawing.Point(129, 74); + tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + tableLayoutPanel1.Location = new System.Drawing.Point(155, 74); tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.RowCount = 4; @@ -74,16 +75,17 @@ tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel1.Size = new System.Drawing.Size(259, 114); + tableLayoutPanel1.Size = new System.Drawing.Size(207, 114); tableLayoutPanel1.TabIndex = 0; // // radTextBoxControl_Password // radTextBoxControl_Password.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - radTextBoxControl_Password.Location = new System.Drawing.Point(106, 59); + radTextBoxControl_Password.Location = new System.Drawing.Point(71, 59); radTextBoxControl_Password.Name = "radTextBoxControl_Password"; - radTextBoxControl_Password.Size = new System.Drawing.Size(150, 22); + radTextBoxControl_Password.Size = new System.Drawing.Size(133, 22); radTextBoxControl_Password.TabIndex = 1; + radTextBoxControl_Password.UseSystemPasswordChar = true; // // radLabel2 // @@ -91,24 +93,24 @@ radLabel2.AutoSize = false; radLabel2.Location = new System.Drawing.Point(3, 59); radLabel2.Name = "radLabel2"; - radLabel2.Size = new System.Drawing.Size(97, 22); + radLabel2.Size = new System.Drawing.Size(62, 22); radLabel2.TabIndex = 0; radLabel2.Text = "Password"; // // radTextBoxControl_Username // radTextBoxControl_Username.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - radTextBoxControl_Username.Location = new System.Drawing.Point(106, 31); + radTextBoxControl_Username.Location = new System.Drawing.Point(71, 31); radTextBoxControl_Username.Name = "radTextBoxControl_Username"; - radTextBoxControl_Username.Size = new System.Drawing.Size(150, 22); - radTextBoxControl_Username.TabIndex = 2; + radTextBoxControl_Username.Size = new System.Drawing.Size(133, 22); + radTextBoxControl_Username.TabIndex = 0; // // radButton_Login // - radButton_Login.Location = new System.Drawing.Point(106, 87); + radButton_Login.Location = new System.Drawing.Point(71, 87); radButton_Login.Name = "radButton_Login"; radButton_Login.Size = new System.Drawing.Size(110, 24); - radButton_Login.TabIndex = 1; + radButton_Login.TabIndex = 2; radButton_Login.Text = "Login"; radButton_Login.Click += RadButton_Login_Click; // @@ -118,7 +120,7 @@ radLabel1.AutoSize = false; radLabel1.Location = new System.Drawing.Point(3, 31); radLabel1.Name = "radLabel1"; - radLabel1.Size = new System.Drawing.Size(97, 22); + radLabel1.Size = new System.Drawing.Size(62, 22); radLabel1.TabIndex = 1; radLabel1.Text = "Username"; // @@ -128,7 +130,7 @@ radLabel3.AutoSize = false; radLabel3.Location = new System.Drawing.Point(3, 3); radLabel3.Name = "radLabel3"; - radLabel3.Size = new System.Drawing.Size(97, 22); + radLabel3.Size = new System.Drawing.Size(62, 22); radLabel3.TabIndex = 3; radLabel3.Text = "Provider"; // @@ -141,12 +143,12 @@ tableLayoutPanel3.Controls.Add(radDropDownList_LoginProvider, 0, 0); tableLayoutPanel3.Controls.Add(radButton_ConfigureProvider, 1, 0); tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; - tableLayoutPanel3.Location = new System.Drawing.Point(103, 0); + tableLayoutPanel3.Location = new System.Drawing.Point(68, 0); tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); tableLayoutPanel3.Name = "tableLayoutPanel3"; tableLayoutPanel3.RowCount = 1; tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel3.Size = new System.Drawing.Size(156, 28); + tableLayoutPanel3.Size = new System.Drawing.Size(139, 28); tableLayoutPanel3.TabIndex = 4; // // radDropDownList_LoginProvider @@ -155,27 +157,27 @@ radDropDownList_LoginProvider.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList; radDropDownList_LoginProvider.Location = new System.Drawing.Point(3, 3); radDropDownList_LoginProvider.Name = "radDropDownList_LoginProvider"; - radDropDownList_LoginProvider.Size = new System.Drawing.Size(122, 22); - radDropDownList_LoginProvider.TabIndex = 0; + radDropDownList_LoginProvider.Size = new System.Drawing.Size(105, 22); + radDropDownList_LoginProvider.TabIndex = 3; radDropDownList_LoginProvider.SelectedValueChanged += RadDropDownList_LoginProvider_SelectedValueChanged; // // radButton_ConfigureProvider // radButton_ConfigureProvider.DisplayStyle = Telerik.WinControls.DisplayStyle.Image; radButton_ConfigureProvider.ImageAlignment = System.Drawing.ContentAlignment.MiddleCenter; - radButton_ConfigureProvider.Location = new System.Drawing.Point(131, 3); + radButton_ConfigureProvider.Location = new System.Drawing.Point(114, 3); radButton_ConfigureProvider.Name = "radButton_ConfigureProvider"; radButton_ConfigureProvider.Size = new System.Drawing.Size(22, 22); - radButton_ConfigureProvider.TabIndex = 1; + radButton_ConfigureProvider.TabIndex = 4; radButton_ConfigureProvider.Text = "Configure"; radButton_ConfigureProvider.Click += RadButton_ConfigureProvider_Click; // // tableLayoutPanel2 // tableLayoutPanel2.ColumnCount = 3; - tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); + tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F)); + tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); tableLayoutPanel2.Controls.Add(tableLayoutPanel1, 1, 1); tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); diff --git a/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.cs b/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.cs index 408839f..0f0e254 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/TabLoginView.cs @@ -64,7 +64,7 @@ public partial class TabLoginView : UserControl, ILoadContent if (mainApi.Manager?.Login(dataManager, username, password) is not bool success || !success) { - RadMessageBox.Show(LoginPageLangRes.MsgBox_LoginFailed, LoginPageLangRes.MsgBox_LoginFailed_Title, MessageBoxButtons.YesNo, RadMessageIcon.Exclamation); + RadMessageBox.Show(LoginPageLangRes.MsgBox_LoginFailed, LoginPageLangRes.MsgBox_LoginFailed_Title, MessageBoxButtons.OK, RadMessageIcon.Exclamation); return; } diff --git a/OwnChar.App.Desktop/UI/Windows/MainWindow.Designer.cs b/OwnChar.App.Desktop/UI/Windows/MainWindow.Designer.cs index 1739ad7..f8b1002 100644 --- a/OwnChar.App.Desktop/UI/Windows/MainWindow.Designer.cs +++ b/OwnChar.App.Desktop/UI/Windows/MainWindow.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/OwnChar.App.Desktop/UI/Windows/MainWindow.cs b/OwnChar.App.Desktop/UI/Windows/MainWindow.cs index a30346b..623cfce 100644 --- a/OwnChar.App.Desktop/UI/Windows/MainWindow.cs +++ b/OwnChar.App.Desktop/UI/Windows/MainWindow.cs @@ -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(); + 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() { - 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)