add api culture

This commit is contained in:
2024-05-17 20:43:16 +02:00
parent 8e61053f44
commit 79137e7bc1
16 changed files with 138 additions and 74 deletions

View File

@@ -0,0 +1,10 @@
using System.Windows.Forms;
namespace OwnChar.App.Desktop.Api
{
public interface IMainWindowApi
{
void OpenTab(Control content);
void CloseTab(Control content);
}
}

View File

@@ -0,0 +1,8 @@
namespace OwnChar.App.Desktop.Api
{
public interface IMainWindowTab
{
string Name { get; }
IMainWindowApi MaindWindow { get; internal set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OwnChar.App.Desktop.Api
{
public interface IOwnCharApi
{
public static IOwnCharApi Instance { get; } = new AppApi();
public IMainWindowApi? MainWindow { get; internal set; }
}
}

View File

@@ -1,4 +1,5 @@
using System;
using OwnChar.App.Desktop.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,8 +7,8 @@ using System.Threading.Tasks;
namespace OwnChar.App.Desktop
{
public sealed class AppApi
public sealed class AppApi : IOwnCharApi
{
public AppApi Instance = new();
public IMainWindowApi? MainWindow { get; internal set; }
}
}

View File

@@ -1,4 +1,5 @@
using OwnChar.Plugins;
using OwnChar.App.Desktop.Api;
using OwnChar.Plugins;
using Pilz.Plugins.Advanced;
namespace OwnChar.App.Desktop
@@ -18,7 +19,7 @@ namespace OwnChar.App.Desktop
public object? GetApi()
{
return null;
return IOwnCharApi.Instance;
}
}
}

View File

@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OwnChar.App.Desktop
namespace OwnChar.App.Desktop
{
public static class FeatureCodes
{
public const string MainTab = "ownchar.app.desktop.main.tab";
public const string QuickAction = "ownchar.app.desktop.main.quickaction";
}
}

View File

@@ -0,0 +1,16 @@
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 TabCharList();
}
}
}

View File

@@ -0,0 +1,16 @@
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 TabEditChar();
}
}
}

View File

@@ -0,0 +1,17 @@
using OwnChar.App.Desktop.Features.MainWindow.MainTabs;
using Pilz.Plugins.Advanced;
using Pilz.Plugins.Advanced.UI.Telerik;
namespace OwnChar.App.Desktop.Features.MainWindow.QuickAction
{
internal class HomeFeature() : PluginModule(FeatureCodes.QuickAction, "ownchar.home", "Home"), IPluginFeatureProvider<TabMyUserFeature>
{
public static TabMyUserFeature Instance { get; } = new();
protected override PluginModuleUI CreateNewUI()
{
return null;
//return new TabEditChar();
}
}
}

View File

@@ -0,0 +1,17 @@
using OwnChar.App.Desktop.Features.MainWindow.MainTabs;
using Pilz.Plugins.Advanced;
using Pilz.Plugins.Advanced.UI.Telerik;
namespace OwnChar.App.Desktop.Features.MainWindow.QuickAction
{
internal class SettingsFeature() : PluginModule(FeatureCodes.QuickAction, "ownchar.settings", "Settings"), IPluginFeatureProvider<TabMyUserFeature>
{
public static TabMyUserFeature Instance { get; } = new();
protected override PluginModuleUI CreateNewUI()
{
return null;
//return new TabSettings();
}
}
}

View File

@@ -1,10 +1,9 @@
using OwnChar.App.Desktop.UI.Windows;
using OwnChar.App.Desktop.Api;
using OwnChar.App.Desktop.UI.Windows;
using OwnChar.Plugins;
using Pilz.Plugins;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.Themes;
@@ -31,7 +30,9 @@ namespace OwnChar.App.Desktop
OwnCharPlugins.Instance.LoadPlugins(plugins);
}
Application.Run(new MainWindow());
var mainWindow = new MainWindow();
IOwnCharApi.Instance.MainWindow = mainWindow.Api;
Application.Run(mainWindow);
}
}
}

View File

@@ -1,20 +0,0 @@
using Pilz.Plugins.Advanced;
using Pilz.Plugins.Advanced.UI.Telerik;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OwnChar.App.Desktop.UI.MainTabs
{
internal class TabCharListFeature() : PluginModule(FeatureCodes.MainTab, "ownchar.tabcharlist", "Character list"), IPluginFeatureProvider<TabCharListFeature>
{
public static TabCharListFeature Instance { get; } = new();
protected override PluginModuleUI CreateNewUI()
{
return new TabCharList();
}
}
}

View File

@@ -1,13 +1,4 @@
using Pilz.Plugins.Advanced.UI.Telerik;
using System;
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;
namespace OwnChar.App.Desktop.UI.MainTabs
{

View File

@@ -1,20 +0,0 @@
using Pilz.Plugins.Advanced;
using Pilz.Plugins.Advanced.UI.Telerik;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OwnChar.App.Desktop.UI.MainTabs
{
internal class TabEditCharFeature() : PluginModule(FeatureCodes.MainTab, "ownchar.tabcharedit", "Edit Character"), IPluginFeatureProvider<TabEditCharFeature>
{
public static TabEditCharFeature Instance { get; } = new();
protected override PluginModuleUI CreateNewUI()
{
return new TabEditChar();
}
}
}

View File

@@ -1,23 +1,17 @@
using Pilz.Plugins.Advanced;
using Pilz.Plugins.Advanced.UI.Telerik;
using Pilz.UI.Telerik.Dialogs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
namespace OwnChar.App.Desktop.UI.Windows
{
public partial class MainWindow : RadForm
{
public MainWindowApi Api { get; }
public MainWindow()
{
Api = new(this);
InitializeComponent();
PluginFeatureController.Instance.Features.Get(FeatureCodes.MainTab).InsertItemsTo(radMenuItem2.Items, customClickHandler: MainTabItem_Clicked);
}

View File

@@ -0,0 +1,23 @@
using OwnChar.App.Desktop.Api;
using System;
using System.Windows.Forms;
namespace OwnChar.App.Desktop.UI.Windows;
public partial class MainWindow
{
public class MainWindowApi(MainWindow mainWindow) : IMainWindowApi
{
public MainWindow MainWindow { get; } = mainWindow;
public void CloseTab(Control content)
{
throw new NotImplementedException();
}
public void OpenTab(Control content)
{
throw new NotImplementedException();
}
}
}