mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
refactored layout saver code to a new class
This commit is contained in:
28
mRemoteV1/Config/Settings/LayoutSettingsSaver.cs
Normal file
28
mRemoteV1/Config/Settings/LayoutSettingsSaver.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.UI.Forms;
|
||||
|
||||
namespace mRemoteNG.Config.Settings
|
||||
{
|
||||
public class LayoutSettingsSaver
|
||||
{
|
||||
public void Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(SettingsFileInfo.SettingsPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(SettingsFileInfo.SettingsPath);
|
||||
}
|
||||
|
||||
FrmMain.Default.pnlDock.SaveAsXml(SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.LayoutFileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("SavePanelsToXML failed", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.Controls;
|
||||
using mRemoteNG.UI.Forms;
|
||||
@@ -60,7 +58,7 @@ namespace mRemoteNG.Config.Settings
|
||||
mRemoteNG.Settings.Default.QuickyTBVisible = quickConnectToolStrip.Visible;
|
||||
mRemoteNG.Settings.Default.Save();
|
||||
|
||||
SavePanelsToXml();
|
||||
new LayoutSettingsSaver().Save();
|
||||
new ExternalAppsSaver().Save(Runtime.ExternalTools);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -68,22 +66,5 @@ namespace mRemoteNG.Config.Settings
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("Saving settings failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SavePanelsToXml()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(SettingsFileInfo.SettingsPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(SettingsFileInfo.SettingsPath);
|
||||
}
|
||||
|
||||
FrmMain.Default.pnlDock.SaveAsXml(SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.LayoutFileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("SavePanelsToXML failed", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,6 +194,7 @@
|
||||
<Compile Include="Config\Settings\ExternalAppsLoader.cs" />
|
||||
<Compile Include="Config\Settings\ExternalAppsSaver.cs" />
|
||||
<Compile Include="Config\Settings\LayoutSettingsLoader.cs" />
|
||||
<Compile Include="Config\Settings\LayoutSettingsSaver.cs" />
|
||||
<Compile Include="Config\Settings\Providers\AppSettingsProvider.cs" />
|
||||
<Compile Include="Config\Settings\Providers\ChooseProvider.cs" />
|
||||
<Compile Include="Config\Settings\SettingsLoader.cs" />
|
||||
|
||||
Reference in New Issue
Block a user