finally more structure
This commit is contained in:
2
OwnChar
2
OwnChar
Submodule OwnChar updated: dab404d95e...b2f0a80872
@@ -1,10 +1,14 @@
|
|||||||
using System.Windows.Forms;
|
using OwnChar.Manager;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.Api
|
namespace OwnChar.App.Desktop.Api
|
||||||
{
|
{
|
||||||
public interface IMainWindowApi
|
public interface IMainWindowApi
|
||||||
{
|
{
|
||||||
void OpenTab(Control content);
|
OwnCharManager? Manager { get; }
|
||||||
|
void OpenTab(Control content, string title);
|
||||||
void CloseTab(Control content);
|
void CloseTab(Control content);
|
||||||
|
bool IsTabOpen(Control content);
|
||||||
|
bool IsTabOpen<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Pilz.Configuration;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -8,7 +9,7 @@ namespace OwnChar.App.Desktop.Api
|
|||||||
{
|
{
|
||||||
public interface IOwnCharApi
|
public interface IOwnCharApi
|
||||||
{
|
{
|
||||||
public static IOwnCharApi Instance { get; } = new AppApi();
|
public abstract IMainWindowApi? MainWindow { get; }
|
||||||
public IMainWindowApi? MainWindow { get; internal set; }
|
public abstract ISettings? Settings { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
OwnChar.App.Desktop/Api/Parameters/AppInitParams.cs
Normal file
14
OwnChar.App.Desktop/Api/Parameters/AppInitParams.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using OwnChar.Plugins;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OwnChar.App.Desktop.Api.Parameters
|
||||||
|
{
|
||||||
|
public class AppInitParams(IOwnCharApi api) : OwnCharPluginInitParams
|
||||||
|
{
|
||||||
|
public IOwnCharApi Api { get; set; } = api;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
OwnChar.App.Desktop/Api/Parameters/MainWindowParams.cs
Normal file
14
OwnChar.App.Desktop/Api/Parameters/MainWindowParams.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using Pilz.Plugins.Advanced;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OwnChar.App.Desktop.Api.Parameters
|
||||||
|
{
|
||||||
|
public class MainWindowParams(IMainWindowApi api) : PluginFunctionParameter
|
||||||
|
{
|
||||||
|
public IMainWindowApi Api { get; } = api;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using OwnChar.App.Desktop.Api;
|
using OwnChar.App.Desktop.Api;
|
||||||
|
using Pilz.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -9,6 +10,8 @@ namespace OwnChar.App.Desktop
|
|||||||
{
|
{
|
||||||
public sealed class AppApi : IOwnCharApi
|
public sealed class AppApi : IOwnCharApi
|
||||||
{
|
{
|
||||||
|
public static AppApi Instance { get; } = new();
|
||||||
public IMainWindowApi? MainWindow { get; internal set; }
|
public IMainWindowApi? MainWindow { get; internal set; }
|
||||||
|
public ISettings? Settings { get; internal set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using OwnChar.App.Desktop.Api;
|
using OwnChar.App.Desktop.Api;
|
||||||
using OwnChar.Plugins;
|
using OwnChar.Plugins;
|
||||||
|
using Pilz.Configuration;
|
||||||
using Pilz.Plugins.Advanced;
|
using Pilz.Plugins.Advanced;
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop
|
namespace OwnChar.App.Desktop
|
||||||
@@ -19,7 +20,7 @@ namespace OwnChar.App.Desktop
|
|||||||
|
|
||||||
public object? GetApi()
|
public object? GetApi()
|
||||||
{
|
{
|
||||||
return IOwnCharApi.Instance;
|
return AppApi.Instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
using OwnChar.App.Desktop.UI.MainTabs;
|
|
||||||
using Pilz.Plugins.Advanced;
|
|
||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.Features.MainWindow.MainTabs
|
|
||||||
{
|
|
||||||
internal class TabMyGroupsFeature() : PluginModule(FeatureCodes.MainTab, "ownchar.mygroups", "My groups"), IPluginFeatureProvider<TabMyGroupsFeature>
|
|
||||||
{
|
|
||||||
public static TabMyGroupsFeature Instance { get; } = new();
|
|
||||||
|
|
||||||
protected override PluginModuleUI CreateNewUI()
|
|
||||||
{
|
|
||||||
return new TabGroupsView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using OwnChar.App.Desktop.UI.MainTabs;
|
|
||||||
using Pilz.Plugins.Advanced;
|
|
||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.Features.MainWindow.MainTabs
|
|
||||||
{
|
|
||||||
internal class TabMyUserFeature() : PluginModule(FeatureCodes.MainTab, "ownchar.myuser", "My user"), IPluginFeatureProvider<TabMyUserFeature>
|
|
||||||
{
|
|
||||||
public static TabMyUserFeature Instance { get; } = new();
|
|
||||||
|
|
||||||
protected override PluginModuleUI CreateNewUI()
|
|
||||||
{
|
|
||||||
return new TabUserView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
using OwnChar.App.Desktop.Features.MainWindow.MainTabs;
|
using OwnChar.App.Desktop.Api.Parameters;
|
||||||
|
using OwnChar.App.Desktop.UI.MainTabs;
|
||||||
using Pilz.Plugins.Advanced;
|
using Pilz.Plugins.Advanced;
|
||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.Features.MainWindow.QuickAction
|
namespace OwnChar.App.Desktop.Features.MainWindow.QuickAction
|
||||||
{
|
{
|
||||||
internal class HomeFeature() : PluginModule(FeatureCodes.QuickAction, "ownchar.home", "Home"), IPluginFeatureProvider<TabMyUserFeature>
|
internal class HomeFeature() : PluginFunction(FeatureCodes.QuickAction, "ownchar.home", "Home"), IPluginFeatureProvider<HomeFeature>
|
||||||
{
|
{
|
||||||
public static TabMyUserFeature Instance { get; } = new();
|
public static HomeFeature Instance { get; } = new();
|
||||||
|
|
||||||
protected override PluginModuleUI CreateNewUI()
|
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (@params is MainWindowParams p)
|
||||||
//return new TabEditChar();
|
p.Api.OpenTab(new TabUserView(p.Api, p.Api.Manager?.CurrentUser));
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
using OwnChar.App.Desktop.Features.MainWindow.MainTabs;
|
using OwnChar.App.Desktop.Api.Parameters;
|
||||||
|
using OwnChar.App.Desktop.UI.MainTabs;
|
||||||
using Pilz.Plugins.Advanced;
|
using Pilz.Plugins.Advanced;
|
||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.Features.MainWindow.QuickAction
|
namespace OwnChar.App.Desktop.Features.MainWindow.QuickAction
|
||||||
{
|
{
|
||||||
internal class SettingsFeature() : PluginModule(FeatureCodes.QuickAction, "ownchar.settings", "Settings"), IPluginFeatureProvider<TabMyUserFeature>
|
internal class SettingsFeature() : PluginFunction(FeatureCodes.QuickAction, "ownchar.settings", "Settings"), IPluginFeatureProvider<SettingsFeature>
|
||||||
{
|
{
|
||||||
public static TabMyUserFeature Instance { get; } = new();
|
public static SettingsFeature Instance { get; } = new();
|
||||||
|
|
||||||
protected override PluginModuleUI CreateNewUI()
|
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (@params is MainWindowParams p)
|
||||||
//return new TabSettings();
|
p.Api.OpenTab(new TabSettingsView());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@
|
|||||||
<ProjectReference Include="..\OwnChar\OwnChar\OwnChar.csproj" />
|
<ProjectReference Include="..\OwnChar\OwnChar\OwnChar.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Features\MainWindow\MainTabs\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ProjectExtensions><VisualStudio><UserProperties ShouldAddDPIScalingManifest="" /></VisualStudio></ProjectExtensions>
|
<ProjectExtensions><VisualStudio><UserProperties ShouldAddDPIScalingManifest="" /></VisualStudio></ProjectExtensions>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using OwnChar.App.Desktop.Api;
|
using OwnChar.App.Desktop.Api;
|
||||||
using OwnChar.App.Desktop.UI.Windows;
|
using OwnChar.App.Desktop.UI.Windows;
|
||||||
using OwnChar.Plugins;
|
using OwnChar.Plugins;
|
||||||
|
using Pilz.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -12,16 +13,26 @@ namespace OwnChar.App.Desktop
|
|||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
public static ISettingsManager? SettingsManager { get; private set; }
|
||||||
|
public static string? AppTempFolder { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
// Load settings
|
||||||
|
AppTempFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "OwnChar", "Desktop");
|
||||||
|
SettingsManager = new SettingsManager(Path.Combine(AppTempFolder, "Settings.json"), true);
|
||||||
|
AppApi.Instance.Settings = SettingsManager.Instance;
|
||||||
|
|
||||||
|
// Prepair user interface
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
ThemeResolutionService.ApplicationThemeName = new Office2019LightTheme().ThemeName;
|
ThemeResolutionService.ApplicationThemeName = new Office2019LightTheme().ThemeName;
|
||||||
|
|
||||||
|
// Load plugins
|
||||||
OwnCharPlugins.Instance.LoadOwnPlugins();
|
OwnCharPlugins.Instance.LoadOwnPlugins();
|
||||||
var pluginPath = Path.Combine(Path.GetDirectoryName(Pilz.IO.Extensions.GetExecutablePath())!, "Plugins");
|
var pluginPath = Path.Combine(Path.GetDirectoryName(Pilz.IO.Extensions.GetExecutablePath())!, "Plugins");
|
||||||
if (Directory.Exists(pluginPath))
|
if (Directory.Exists(pluginPath))
|
||||||
@@ -30,8 +41,9 @@ namespace OwnChar.App.Desktop
|
|||||||
OwnCharPlugins.Instance.LoadPlugins(plugins);
|
OwnCharPlugins.Instance.LoadPlugins(plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start main window
|
||||||
var mainWindow = new MainWindow();
|
var mainWindow = new MainWindow();
|
||||||
IOwnCharApi.Instance.MainWindow = mainWindow.Api;
|
AppApi.Instance.MainWindow = mainWindow.Api;
|
||||||
Application.Run(mainWindow);
|
Application.Run(mainWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
using OwnChar.App.Desktop.Api;
|
||||||
|
using OwnChar.Model;
|
||||||
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.UI.MainTabs
|
namespace OwnChar.App.Desktop.UI.MainTabs
|
||||||
{
|
{
|
||||||
public partial class TabCharView : PluginModuleUI
|
public partial class TabCharView : UserControl, ILoadContent
|
||||||
{
|
{
|
||||||
public TabCharView()
|
private readonly IMainWindowApi mainApi;
|
||||||
|
private readonly Character character;
|
||||||
|
|
||||||
|
public TabCharView(IMainWindowApi mainApi, Character character)
|
||||||
{
|
{
|
||||||
ActionPanelVisible = false;
|
this.mainApi = mainApi;
|
||||||
|
this.character = character;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
using OwnChar.App.Desktop.Api;
|
||||||
using System;
|
using OwnChar.Model;
|
||||||
using System.Collections.Generic;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.UI.MainTabs
|
namespace OwnChar.App.Desktop.UI.MainTabs
|
||||||
{
|
{
|
||||||
public partial class TabGroupView : PluginModuleUI
|
public partial class TabGroupView : UserControl, ILoadContent
|
||||||
{
|
{
|
||||||
public TabGroupView()
|
private readonly IMainWindowApi mainApi;
|
||||||
|
private readonly Group group;
|
||||||
|
|
||||||
|
public TabGroupView(IMainWindowApi mainApi, Group group)
|
||||||
{
|
{
|
||||||
ActionPanelVisible = false;
|
this.mainApi = mainApi;
|
||||||
|
this.group = group;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
using OwnChar.App.Desktop.Api;
|
||||||
using System;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.UI.MainTabs
|
namespace OwnChar.App.Desktop.UI.MainTabs
|
||||||
{
|
{
|
||||||
public partial class TabGroupsView : PluginModuleUI
|
public partial class TabGroupsView : UserControl, ILoadContent
|
||||||
{
|
{
|
||||||
public TabGroupsView()
|
private readonly IMainWindowApi mainApi;
|
||||||
|
|
||||||
|
public TabGroupsView(IMainWindowApi mainApi)
|
||||||
{
|
{
|
||||||
ActionPanelVisible = false;
|
this.mainApi = mainApi;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
OwnChar.App.Desktop/UI/MainTabs/TabSettingsView.Designer.cs
generated
Normal file
37
OwnChar.App.Desktop/UI/MainTabs/TabSettingsView.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
namespace OwnChar.App.Desktop.UI.MainTabs
|
||||||
|
{
|
||||||
|
partial class TabSettingsView
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Erforderliche Designervariable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Verwendete Ressourcen bereinigen.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Vom Komponenten-Designer generierter Code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Erforderliche Methode für die Designerunterstützung.
|
||||||
|
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
18
OwnChar.App.Desktop/UI/MainTabs/TabSettingsView.cs
Normal file
18
OwnChar.App.Desktop/UI/MainTabs/TabSettingsView.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace OwnChar.App.Desktop.UI.MainTabs
|
||||||
|
{
|
||||||
|
public partial class TabSettingsView : UserControl, ILoadContent
|
||||||
|
{
|
||||||
|
public TabSettingsView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,22 +1,35 @@
|
|||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
using OwnChar.App.Desktop.Api;
|
||||||
using System;
|
using OwnChar.Model;
|
||||||
using System.Collections.Generic;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace OwnChar.App.Desktop.UI.MainTabs
|
namespace OwnChar.App.Desktop.UI.MainTabs
|
||||||
{
|
{
|
||||||
public partial class TabUserView : PluginModuleUI
|
public partial class TabUserView : UserControl, ILoadContent
|
||||||
{
|
{
|
||||||
public TabUserView()
|
private readonly IMainWindowApi mainApi;
|
||||||
|
private readonly UserAccount? account;
|
||||||
|
private readonly UserProfile? profile;
|
||||||
|
|
||||||
|
private TabUserView(IMainWindowApi mainApi, UserAccount? account, UserProfile? profile)
|
||||||
{
|
{
|
||||||
ActionPanelVisible = false;
|
this.mainApi = mainApi;
|
||||||
|
this.account = account;
|
||||||
|
this.profile = profile;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TabUserView(IMainWindowApi mainApi, UserAccount? account) : this(mainApi, account, mainApi.Manager.Users.GetUserProfile(account))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public TabUserView(IMainWindowApi mainApi, UserProfile? profile) : this(mainApi, null, profile)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace OwnChar.App.Desktop.UI.Windows
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
|
namespace OwnChar.App.Desktop.UI.Windows
|
||||||
{
|
{
|
||||||
partial class MainWindow
|
partial class MainWindow
|
||||||
{
|
{
|
||||||
@@ -28,13 +30,28 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
radTabbedFormControl1 = new Telerik.WinControls.UI.RadTabbedFormControl();
|
||||||
radMenu1 = new Telerik.WinControls.UI.RadMenu();
|
radMenu1 = new Telerik.WinControls.UI.RadMenu();
|
||||||
radMenuItem1 = new Telerik.WinControls.UI.RadMenuItem();
|
radMenuItem1 = new Telerik.WinControls.UI.RadMenuItem();
|
||||||
radMenuItem2 = new Telerik.WinControls.UI.RadMenuItem();
|
radMenuItem2 = new Telerik.WinControls.UI.RadMenuItem();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.radTabbedFormControl1)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)radMenu1).BeginInit();
|
((System.ComponentModel.ISupportInitialize)radMenu1).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)this).BeginInit();
|
((System.ComponentModel.ISupportInitialize)this).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
|
// radTabbedFormControl1
|
||||||
|
//
|
||||||
|
this.radTabbedFormControl1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.radTabbedFormControl1.Name = "radTabbedFormControl1";
|
||||||
|
this.radTabbedFormControl1.ShowNewTabButton = false;
|
||||||
|
this.radTabbedFormControl1.Size = new System.Drawing.Size(768, 583);
|
||||||
|
this.radTabbedFormControl1.TabIndex = 0;
|
||||||
|
this.radTabbedFormControl1.TabWidth = 200;
|
||||||
|
this.radTabbedFormControl1.Text = "MainForm";
|
||||||
|
((Telerik.WinControls.UI.RadTabbedFormControlElement)(radTabbedFormControl1.GetChildAt(0))).Text = "MainForm";
|
||||||
|
((Telerik.WinControls.UI.RadQuickAccessOverflowButton)(radTabbedFormControl1.GetChildAt(0).GetChildAt(3).GetChildAt(1))).Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
|
||||||
|
((Telerik.WinControls.UI.RadQuickAccessOverflowButton)(radTabbedFormControl1.GetChildAt(0).GetChildAt(4).GetChildAt(1))).Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
|
||||||
|
//
|
||||||
// radMenu1
|
// radMenu1
|
||||||
//
|
//
|
||||||
radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem1, radMenuItem2 });
|
radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem1, radMenuItem2 });
|
||||||
@@ -63,6 +80,7 @@
|
|||||||
Name = "MainWindow";
|
Name = "MainWindow";
|
||||||
Text = "RadForm1";
|
Text = "RadForm1";
|
||||||
((System.ComponentModel.ISupportInitialize)radMenu1).EndInit();
|
((System.ComponentModel.ISupportInitialize)radMenu1).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.radTabbedFormControl1)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)this).EndInit();
|
((System.ComponentModel.ISupportInitialize)this).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -70,6 +88,7 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private Telerik.WinControls.UI.RadTabbedFormControl radTabbedFormControl1;
|
||||||
private Telerik.WinControls.UI.RadMenu radMenu1;
|
private Telerik.WinControls.UI.RadMenu radMenu1;
|
||||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem1;
|
private Telerik.WinControls.UI.RadMenuItem radMenuItem1;
|
||||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem2;
|
private Telerik.WinControls.UI.RadMenuItem radMenuItem2;
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
using OwnChar.App.Desktop.Api;
|
using OwnChar.App.Desktop.Api;
|
||||||
|
using OwnChar.App.Desktop.Api.Parameters;
|
||||||
|
using OwnChar.Manager;
|
||||||
using Pilz.Plugins.Advanced;
|
using Pilz.Plugins.Advanced;
|
||||||
using Pilz.Plugins.Advanced.UI.Telerik;
|
using Pilz.Plugins.Advanced.UI.Telerik;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
@@ -9,34 +12,81 @@ namespace OwnChar.App.Desktop.UI.Windows
|
|||||||
{
|
{
|
||||||
public partial class MainWindow : RadTabbedForm
|
public partial class MainWindow : RadTabbedForm
|
||||||
{
|
{
|
||||||
|
private readonly OwnCharManager? manager = new();
|
||||||
|
|
||||||
public MainWindowApi Api { get; }
|
public MainWindowApi Api { get; }
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
Api = new(this);
|
Api = new(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
PluginFeatureController.Instance.Features.Get(FeatureCodes.MainTab).InsertItemsTo(radMenuItem2.Items, customClickHandler: MainTabItem_Clicked);
|
PluginFeatureController.Instance.Features.Get(FeatureCodes.QuickAction).InsertItemsTo(radTabbedFormControl1.RightItems, customClickHandler: RightItem_Clicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MainWindowApi(MainWindow mainWindow) : IMainWindowApi
|
public class MainWindowApi(MainWindow mainWindow) : IMainWindowApi
|
||||||
{
|
{
|
||||||
public MainWindow MainWindow { get; } = mainWindow;
|
public MainWindow MainWindow { get; } = mainWindow;
|
||||||
|
|
||||||
|
public OwnCharManager? Manager => MainWindow.manager;
|
||||||
|
|
||||||
|
public void OpenTab(Control content, string title)
|
||||||
|
{
|
||||||
|
MainWindow.OpenTab(content, title);
|
||||||
|
}
|
||||||
|
|
||||||
public void CloseTab(Control content)
|
public void CloseTab(Control content)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
MainWindow.CloseTab(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenTab(Control content)
|
public bool IsTabOpen(Control content)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return MainWindow.FindTab(content) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTabOpen<T>()
|
||||||
|
{
|
||||||
|
return MainWindow.FindTab<T>() != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainTabItem_Clicked(object? sender, EventArgs e)
|
private MainWindowParams GetMainWindowParams()
|
||||||
{
|
{
|
||||||
//if (sender is RadMenuItem item && item.Tag is PluginModule module)
|
return new MainWindowParams(Api);
|
||||||
//...Add() ... module.CreateUI(), "Titel", null);
|
}
|
||||||
|
|
||||||
|
private void OpenTab(Control content, string title)
|
||||||
|
{
|
||||||
|
var newTab = new RadTabbedFormControlTab();
|
||||||
|
content.Dock = DockStyle.Fill;
|
||||||
|
newTab.Controls.Add(content);
|
||||||
|
newTab.Text = title;
|
||||||
|
newTab.Tag = content;
|
||||||
|
content.Tag = newTab;
|
||||||
|
radTabbedFormControl1.Tabs.Add(newTab);
|
||||||
|
radTabbedFormControl1.SelectedTab = newTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseTab(Control content)
|
||||||
|
{
|
||||||
|
if (FindTab(content) is RadTabbedFormControlTab tab)
|
||||||
|
radTabbedFormControl1.Tabs.Remove(tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RadTabbedFormControlTab? FindTab(Control content)
|
||||||
|
{
|
||||||
|
return radTabbedFormControl1.Tabs.FirstOrDefault(n => n.Tag == content);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RadTabbedFormControlTab? FindTab<T>()
|
||||||
|
{
|
||||||
|
return radTabbedFormControl1.Tabs.FirstOrDefault(n => n.Tag is T);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RightItem_Clicked(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is RadMenuItem item && item.Tag is PluginFunction function)
|
||||||
|
function.Execute(GetMainWindowParams());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule OwnChar.Plugins updated: 3855c09d37...5192dc38b2
Reference in New Issue
Block a user