mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-06-07 22:59:14 +08:00
Optimize navigation framework
This commit is contained in:
parent
497b828f2d
commit
79283f4039
34
Source/GrasscutterTools/Forms/FormMain.Designer.cs
generated
34
Source/GrasscutterTools/Forms/FormMain.Designer.cs
generated
@ -32,17 +32,15 @@ namespace GrasscutterTools.Forms
|
|||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||||
this.NavContainer = new System.Windows.Forms.SplitContainer();
|
this.NavContainer = new System.Windows.Forms.SplitContainer();
|
||||||
this.ListPages = new System.Windows.Forms.ListBox();
|
this.ListPages = new System.Windows.Forms.ListBox();
|
||||||
this.TCMain = new System.Windows.Forms.TabControl();
|
|
||||||
this.CmbCommand = new System.Windows.Forms.ComboBox();
|
this.CmbCommand = new System.Windows.Forms.ComboBox();
|
||||||
this.BtnCopy = new System.Windows.Forms.Button();
|
this.BtnCopy = new System.Windows.Forms.Button();
|
||||||
this.ChkAutoCopy = new System.Windows.Forms.CheckBox();
|
this.ChkAutoCopy = new System.Windows.Forms.CheckBox();
|
||||||
this.GrpCommand = new System.Windows.Forms.GroupBox();
|
this.GrpCommand = new System.Windows.Forms.GroupBox();
|
||||||
|
this.LblClearFilter = new System.Windows.Forms.Label();
|
||||||
this.BtnInvokeOpenCommand = new System.Windows.Forms.Button();
|
this.BtnInvokeOpenCommand = new System.Windows.Forms.Button();
|
||||||
this.MenuSpawnEntityFilter = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.MenuSpawnEntityFilter = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.LblClearFilter = new System.Windows.Forms.Label();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.NavContainer)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.NavContainer)).BeginInit();
|
||||||
this.NavContainer.Panel1.SuspendLayout();
|
this.NavContainer.Panel1.SuspendLayout();
|
||||||
this.NavContainer.Panel2.SuspendLayout();
|
|
||||||
this.NavContainer.SuspendLayout();
|
this.NavContainer.SuspendLayout();
|
||||||
this.GrpCommand.SuspendLayout();
|
this.GrpCommand.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -56,10 +54,6 @@ namespace GrasscutterTools.Forms
|
|||||||
//
|
//
|
||||||
this.NavContainer.Panel1.Controls.Add(this.ListPages);
|
this.NavContainer.Panel1.Controls.Add(this.ListPages);
|
||||||
//
|
//
|
||||||
// NavContainer.Panel2
|
|
||||||
//
|
|
||||||
this.NavContainer.Panel2.Controls.Add(this.TCMain);
|
|
||||||
//
|
|
||||||
// ListPages
|
// ListPages
|
||||||
//
|
//
|
||||||
this.ListPages.BackColor = System.Drawing.Color.WhiteSmoke;
|
this.ListPages.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||||
@ -72,14 +66,6 @@ namespace GrasscutterTools.Forms
|
|||||||
this.ListPages.SelectedIndexChanged += new System.EventHandler(this.ListPages_SelectedIndexChanged);
|
this.ListPages.SelectedIndexChanged += new System.EventHandler(this.ListPages_SelectedIndexChanged);
|
||||||
this.ListPages.SizeChanged += new System.EventHandler(this.ListPages_SizeChanged);
|
this.ListPages.SizeChanged += new System.EventHandler(this.ListPages_SizeChanged);
|
||||||
//
|
//
|
||||||
// TCMain
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.TCMain, "TCMain");
|
|
||||||
this.TCMain.Multiline = true;
|
|
||||||
this.TCMain.Name = "TCMain";
|
|
||||||
this.TCMain.SelectedIndex = 0;
|
|
||||||
this.TCMain.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
|
||||||
//
|
|
||||||
// CmbCommand
|
// CmbCommand
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.CmbCommand, "CmbCommand");
|
resources.ApplyResources(this.CmbCommand, "CmbCommand");
|
||||||
@ -113,6 +99,14 @@ namespace GrasscutterTools.Forms
|
|||||||
this.GrpCommand.Name = "GrpCommand";
|
this.GrpCommand.Name = "GrpCommand";
|
||||||
this.GrpCommand.TabStop = false;
|
this.GrpCommand.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// LblClearFilter
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.LblClearFilter, "LblClearFilter");
|
||||||
|
this.LblClearFilter.BackColor = System.Drawing.Color.White;
|
||||||
|
this.LblClearFilter.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.LblClearFilter.Name = "LblClearFilter";
|
||||||
|
this.LblClearFilter.Click += new System.EventHandler(this.LblClearFilter_Click);
|
||||||
|
//
|
||||||
// BtnInvokeOpenCommand
|
// BtnInvokeOpenCommand
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.BtnInvokeOpenCommand, "BtnInvokeOpenCommand");
|
resources.ApplyResources(this.BtnInvokeOpenCommand, "BtnInvokeOpenCommand");
|
||||||
@ -125,14 +119,6 @@ namespace GrasscutterTools.Forms
|
|||||||
this.MenuSpawnEntityFilter.Name = "MenuSpawnEntityFilter";
|
this.MenuSpawnEntityFilter.Name = "MenuSpawnEntityFilter";
|
||||||
resources.ApplyResources(this.MenuSpawnEntityFilter, "MenuSpawnEntityFilter");
|
resources.ApplyResources(this.MenuSpawnEntityFilter, "MenuSpawnEntityFilter");
|
||||||
//
|
//
|
||||||
// LblClearFilter
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.LblClearFilter, "LblClearFilter");
|
|
||||||
this.LblClearFilter.BackColor = System.Drawing.Color.White;
|
|
||||||
this.LblClearFilter.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
||||||
this.LblClearFilter.Name = "LblClearFilter";
|
|
||||||
this.LblClearFilter.Click += new System.EventHandler(this.LblClearFilter_Click);
|
|
||||||
//
|
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
@ -145,7 +131,6 @@ namespace GrasscutterTools.Forms
|
|||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMain_KeyDown);
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMain_KeyDown);
|
||||||
this.NavContainer.Panel1.ResumeLayout(false);
|
this.NavContainer.Panel1.ResumeLayout(false);
|
||||||
this.NavContainer.Panel2.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.NavContainer)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.NavContainer)).EndInit();
|
||||||
this.NavContainer.ResumeLayout(false);
|
this.NavContainer.ResumeLayout(false);
|
||||||
this.GrpCommand.ResumeLayout(false);
|
this.GrpCommand.ResumeLayout(false);
|
||||||
@ -161,7 +146,6 @@ namespace GrasscutterTools.Forms
|
|||||||
private System.Windows.Forms.CheckBox ChkAutoCopy;
|
private System.Windows.Forms.CheckBox ChkAutoCopy;
|
||||||
private System.Windows.Forms.GroupBox GrpCommand;
|
private System.Windows.Forms.GroupBox GrpCommand;
|
||||||
private System.Windows.Forms.Button BtnInvokeOpenCommand;
|
private System.Windows.Forms.Button BtnInvokeOpenCommand;
|
||||||
private System.Windows.Forms.TabControl TCMain;
|
|
||||||
private System.Windows.Forms.ContextMenuStrip MenuSpawnEntityFilter;
|
private System.Windows.Forms.ContextMenuStrip MenuSpawnEntityFilter;
|
||||||
private System.Windows.Forms.ListBox ListPages;
|
private System.Windows.Forms.ListBox ListPages;
|
||||||
private System.Windows.Forms.SplitContainer NavContainer;
|
private System.Windows.Forms.SplitContainer NavContainer;
|
||||||
|
@ -148,6 +148,10 @@ namespace GrasscutterTools.Forms
|
|||||||
Logger.I(TAG, $"{page.Name} OnLoad completed");
|
Logger.I(TAG, $"{page.Name} OnLoad completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 默认选中首页
|
||||||
|
if (ListPages.SelectedIndex == -1)
|
||||||
|
ListPages.SelectedIndex = 0;
|
||||||
|
|
||||||
Logger.I(TAG, "FormMain_Load completed");
|
Logger.I(TAG, "FormMain_Load completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +211,6 @@ namespace GrasscutterTools.Forms
|
|||||||
{
|
{
|
||||||
Logger.I(TAG, "InitPages enter");
|
Logger.I(TAG, "InitPages enter");
|
||||||
Pages = new Dictionary<string, BasePage>(32);
|
Pages = new Dictionary<string, BasePage>(32);
|
||||||
TCMain.SuspendLayout();
|
|
||||||
CreatePage<PageHome>();
|
CreatePage<PageHome>();
|
||||||
var poc = CreatePage<PageOpenCommand>();
|
var poc = CreatePage<PageOpenCommand>();
|
||||||
poc.ShowTipInRunButton = msg => ShowTip(msg, BtnInvokeOpenCommand);
|
poc.ShowTipInRunButton = msg => ShowTip(msg, BtnInvokeOpenCommand);
|
||||||
@ -233,7 +236,6 @@ namespace GrasscutterTools.Forms
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
CreatePage<PageTools>();
|
CreatePage<PageTools>();
|
||||||
#endif
|
#endif
|
||||||
TCMain.ResumeLayout();
|
|
||||||
Logger.I(TAG, "InitPages completed");
|
Logger.I(TAG, "InitPages completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +379,19 @@ namespace GrasscutterTools.Forms
|
|||||||
.ElementAt(ListPages.SelectedIndex)
|
.ElementAt(ListPages.SelectedIndex)
|
||||||
.Item1;
|
.Item1;
|
||||||
// 通过Key找到页面的父节点也就是TabPage,设置为选中项
|
// 通过Key找到页面的父节点也就是TabPage,设置为选中项
|
||||||
TCMain.SelectedTab = Pages[key].Parent as TabPage;
|
ShowPage(Pages[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 展示页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="page">页面实例</param>
|
||||||
|
private void ShowPage(BasePage page)
|
||||||
|
{
|
||||||
|
NavContainer.Panel2.SuspendLayout();
|
||||||
|
NavContainer.Panel2.Controls.Clear();
|
||||||
|
NavContainer.Panel2.Controls.Add(page);
|
||||||
|
NavContainer.Panel2.ResumeLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -422,9 +436,6 @@ namespace GrasscutterTools.Forms
|
|||||||
Name = typeof(T).Name,
|
Name = typeof(T).Name,
|
||||||
};
|
};
|
||||||
Pages.Add(page.Name, page);
|
Pages.Add(page.Name, page);
|
||||||
var tp = new TabPage();
|
|
||||||
TCMain.TabPages.Add(tp);
|
|
||||||
tp.Controls.Add(page);
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,13 +709,18 @@ namespace GrasscutterTools.Forms
|
|||||||
// F5 为执行命令
|
// F5 为执行命令
|
||||||
OnOpenCommandInvoke();
|
OnOpenCommandInvoke();
|
||||||
}
|
}
|
||||||
else if (e.Alt && e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
|
else if ((e.Alt || e.Control) && e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
|
||||||
{
|
{
|
||||||
// Alt+数字键 = 跳转到对应页面
|
// Alt|Ctrl+数字键 = 跳转到对应页面
|
||||||
var i = e.KeyCode == Keys.D0 ? 9 : e.KeyCode - Keys.D1;
|
var i = e.KeyCode == Keys.D0 ? 9 : e.KeyCode - Keys.D1;
|
||||||
if (i < ListPages.Items.Count)
|
if (i < ListPages.Items.Count)
|
||||||
ListPages.SelectedIndex = i;
|
ListPages.SelectedIndex = i;
|
||||||
}
|
}
|
||||||
|
else if (e.Control && e.KeyCode == Keys.Tab)
|
||||||
|
{
|
||||||
|
// 切换到下一个页面
|
||||||
|
ListPages.SelectedIndex = (ListPages.SelectedIndex + 1) % ListPages.Items.Count;
|
||||||
|
}
|
||||||
else if (Common.KeyGo.IsEnabled == false)
|
else if (Common.KeyGo.IsEnabled == false)
|
||||||
{
|
{
|
||||||
foreach (var hotkeyItem in Common.KeyGo.Items)
|
foreach (var hotkeyItem in Common.KeyGo.Items)
|
||||||
@ -755,13 +771,23 @@ namespace GrasscutterTools.Forms
|
|||||||
/// 导航到目标页面并返回该页面实例
|
/// 导航到目标页面并返回该页面实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TPage">页面类型</typeparam>
|
/// <typeparam name="TPage">页面类型</typeparam>
|
||||||
/// <returns>如果导航到了则返回页面实例,否则返回空</returns>
|
|
||||||
public TPage NavigateTo<TPage>() where TPage : BasePage
|
public TPage NavigateTo<TPage>() where TPage : BasePage
|
||||||
{
|
{
|
||||||
ListPages.SelectedIndex = -1;
|
var key = typeof(TPage).Name;
|
||||||
var page = Pages[typeof(TPage).Name];
|
var page = Pages[key] as TPage;
|
||||||
TCMain.SelectedTab = page.Parent as TabPage;
|
var i = 0;
|
||||||
return page as TPage;
|
foreach (var it in PageTabOrders.Where(it => it.Item2))
|
||||||
|
{
|
||||||
|
if (it.Item1 == key)
|
||||||
|
{
|
||||||
|
ListPages.SelectedIndex = i;
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowPage(page);
|
||||||
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion - 通用 General -
|
#endregion - 通用 General -
|
||||||
|
@ -133,7 +133,7 @@
|
|||||||
</data>
|
</data>
|
||||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
<data name="ListPages.ItemHeight" type="System.Int32, mscorlib">
|
<data name="ListPages.ItemHeight" type="System.Int32, mscorlib">
|
||||||
<value>22</value>
|
<value>25</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ListPages.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="ListPages.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>0, 0</value>
|
<value>0, 0</value>
|
||||||
@ -171,39 +171,6 @@
|
|||||||
<data name="NavContainer.Panel1MinSize" type="System.Int32, mscorlib">
|
<data name="NavContainer.Panel1MinSize" type="System.Int32, mscorlib">
|
||||||
<value>80</value>
|
<value>80</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TCMain.Appearance" type="System.Windows.Forms.TabAppearance, System.Windows.Forms">
|
|
||||||
<value>FlatButtons</value>
|
|
||||||
</data>
|
|
||||||
<data name="TCMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
|
||||||
<value>Fill</value>
|
|
||||||
</data>
|
|
||||||
<data name="TCMain.ItemSize" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>0, 1</value>
|
|
||||||
</data>
|
|
||||||
<data name="TCMain.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>0, 0</value>
|
|
||||||
</data>
|
|
||||||
<data name="TCMain.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>610, 275</value>
|
|
||||||
</data>
|
|
||||||
<data name="TCMain.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>656, 275</value>
|
|
||||||
</data>
|
|
||||||
<data name="TCMain.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>4</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>TCMain.Name" xml:space="preserve">
|
|
||||||
<value>TCMain</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>TCMain.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>TCMain.Parent" xml:space="preserve">
|
|
||||||
<value>NavContainer.Panel2</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>TCMain.ZOrder" xml:space="preserve">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>NavContainer.Panel2.Name" xml:space="preserve">
|
<data name=">>NavContainer.Panel2.Name" xml:space="preserve">
|
||||||
<value>NavContainer.Panel2</value>
|
<value>NavContainer.Panel2</value>
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
Reference in New Issue
Block a user