15 |
|
using RomCheater.PluginFramework.Interfaces; |
16 |
|
using WeifenLuo.WinFormsUI.Docking; |
17 |
|
using RomCheater.Docking; |
18 |
+ |
using System.IO; |
19 |
|
|
20 |
|
namespace RomCheater |
21 |
|
{ |
22 |
|
public partial class Main : Form |
23 |
|
{ |
24 |
+ |
private bool m_bSaveLayout = true; |
25 |
|
private Process Proc = new Process(); |
26 |
|
private DeserializeDockContent m_deserializeDockContent; |
27 |
|
private FloatingLogWindow m_LogWindow = new FloatingLogWindow(); |
58 |
|
{ |
59 |
|
return m_LogWindow; |
60 |
|
} |
61 |
< |
if (persistString == typeof(FloatingAboutBox).ToString()) |
62 |
< |
{ |
63 |
< |
return m_AboutBox; |
64 |
< |
} |
61 |
> |
//if (persistString == typeof(FloatingAboutBox).ToString()) |
62 |
> |
//{ |
63 |
> |
// return m_AboutBox; |
64 |
> |
//} |
65 |
|
if (persistString == typeof(FloatingRamDumperDialog).ToString()) |
66 |
|
{ |
67 |
|
return m_RamDump; |
68 |
|
} |
69 |
+ |
if (persistString == typeof(PIDSelector).ToString()) |
70 |
+ |
{ |
71 |
+ |
return m_PIDSelector; |
72 |
+ |
} |
73 |
|
else |
74 |
|
{ |
75 |
|
// not sure if this is appropriate |
88 |
|
public void ShowDocks() |
89 |
|
{ |
90 |
|
ShowLogWindow(); |
91 |
+ |
//ShowAboutBox(); |
92 |
|
ShowRamDump(); |
93 |
|
ShowPidSelector(); |
94 |
|
} |
95 |
|
public void ShowLogWindow() |
96 |
|
{ |
97 |
< |
m_LogWindow.Show(dockPanel); |
97 |
> |
m_LogWindow.Show(dockPanel, DockState.DockBottom); |
98 |
|
} |
99 |
|
public void ShowAboutBox() |
100 |
|
{ |
150 |
|
if (WindowPlugin != null) |
151 |
|
logger.Info.WriteLine("Loaded Window Plugin: {0}", WindowPlugin.ToString()); |
152 |
|
|
153 |
+ |
m_PIDSelector.ConfigPlugin = ConfigPlugin; |
154 |
+ |
|
155 |
|
} |
156 |
|
|
157 |
|
private void mnuItemExit_Click(object sender, EventArgs e) |
166 |
|
|
167 |
|
private void Main_Load(object sender, EventArgs e) |
168 |
|
{ |
169 |
< |
|
169 |
> |
|
170 |
|
} |
171 |
|
|
172 |
|
private void mnuItemConfig_Click(object sender, EventArgs e) |
186 |
|
|
187 |
|
private void Main_Shown(object sender, EventArgs e) |
188 |
|
{ |
189 |
< |
ShowDocks(); |
189 |
> |
//dockPanel.SuspendLayout(true); |
190 |
> |
//ShowDocks(); |
191 |
> |
string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config"); |
192 |
> |
if (File.Exists(configFile)) |
193 |
> |
{ |
194 |
> |
try |
195 |
> |
{ |
196 |
> |
dockPanel.LoadFromXml(configFile, m_deserializeDockContent); |
197 |
> |
} |
198 |
> |
catch (Exception ex) |
199 |
> |
{ |
200 |
> |
this.Controls.Remove(dockPanel); |
201 |
> |
dockPanel = new DockPanel(); |
202 |
> |
dockPanel.Dock = DockStyle.Fill; |
203 |
> |
dockPanel.DocumentStyle = DocumentStyle.DockingWindow; |
204 |
> |
this.Controls.Add(dockPanel); |
205 |
> |
ShowDocks(); |
206 |
> |
} |
207 |
> |
} |
208 |
> |
else |
209 |
> |
{ |
210 |
> |
ShowDocks(); |
211 |
> |
} |
212 |
> |
|
213 |
> |
//dockPanel.ResumeLayout(true, true); |
214 |
|
} |
215 |
|
|
216 |
|
private void mnuItemShowLogWindow_Click(object sender, EventArgs e) |
232 |
|
{ |
233 |
|
ShowPidSelector(); |
234 |
|
} |
235 |
+ |
|
236 |
+ |
private void Main_FormClosing(object sender, FormClosingEventArgs e) |
237 |
+ |
{ |
238 |
+ |
string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config"); |
239 |
+ |
if (m_bSaveLayout) |
240 |
+ |
dockPanel.SaveAsXml(configFile); |
241 |
+ |
else if (File.Exists(configFile)) |
242 |
+ |
File.Delete(configFile); |
243 |
+ |
} |
244 |
|
} |
245 |
|
} |