using CloudBuilder.CodeGenerator.Entity; using CloudBuilder.Core.DatabaseAccessor.Entity; using CloudBuilder.Core.DependencyInjection.Form; using Krypton.Docking; using Krypton.Navigator; using Krypton.Toolkit; using Microsoft.Extensions.DependencyInjection; 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 CloudBuilder.CodeGenerator { public partial class MainFunctionView : KryptonForm, IForm { public TableControl tableControl; public ConfigUserControl configUserControl; private readonly TemplateUserControl templateUserControl; private readonly OutputUserControl outputUserControl; private readonly OperationUserControl operationUserControl; public void SetConfigUserControl(object? value) { configUserControl.assemblyComboBox.SelectedValue = value; } public void SetOperationUserControl(object? value) { operationUserControl.assemblyComboBox.SelectedValue = value; } public MainFunctionView( [FromKeyedServices("TableControl")] TableControl tableControl, [FromKeyedServices("ConfigUserControl")] ConfigUserControl configUserControl, [FromKeyedServices("TemplateUserControl")] TemplateUserControl templateUserControl, [FromKeyedServices("OutputUserControl")] OutputUserControl outputUserControl, [FromKeyedServices("OperationUserControl")] OperationUserControl operationUserControl) { InitializeComponent(); this.tableControl = tableControl; this.configUserControl = configUserControl; this.templateUserControl = templateUserControl; this.outputUserControl = outputUserControl; this.operationUserControl = operationUserControl; } private void MainFunctionView_Load(object sender, EventArgs e) { KryptonDockingWorkspace w = kryptonDockingManager.ManageWorkspace(kryptonDockableWorkspace); kryptonDockingManager.ManageControl(mainPanel, w); kryptonDockingManager.ManageFloating(this); kryptonDockingManager.AddDockspace("Control", DockingEdge.Right, new KryptonPage[] { NewOperationUserControl() }); kryptonDockingManager.AddToWorkspace("Workspace", new KryptonPage[] { NewTableControl(), NewConfigUserControl(), NewTemplateUserControl(), NewOutputUserControl() }); } private KryptonPage NewTableControl() { return NewOutputControl("数据操作", 1, tableControl); } private KryptonPage NewConfigUserControl() { return NewOutputControl("模板设置", 2, configUserControl); } private KryptonPage NewTemplateUserControl() { return NewOutputControl("模板內容", 3, templateUserControl); } private KryptonPage NewOutputUserControl() { return NewOutputControl("模板生成內容", 4, outputUserControl); } private KryptonPage NewOperationUserControl() { return NewOutputControl("模板输出", 4, operationUserControl); } private KryptonPage NewOutputControl(string text, int imageIndex, UserControl userControl) { KryptonPage p = new KryptonPage(); p.TextTitle = p.Text = text; p.MinimumSize = new Size(200, 250); userControl.Dock = DockStyle.Fill; p.Controls.Add(userControl); return p; } } }