2 using System.Collections.Generic;
19 string ConfigFilename =
"";
23 InitializeComponent();
26 private void GlobalConfigEdit_Load(
object sender, EventArgs e)
33 private void SaveConfig(
string Filename)
45 this.Text =
"Global Configuration Editor - {0}".Build(Filename);
49 MessageBox.Show(
"Could not save global configuration to file: {0}.\n{1}".Build(Filename, E.Message),
"Save error", MessageBoxButtons.OK, MessageBoxIcon.Error);
55 private void LoadConfig(
string Filename =
"")
58 this.Text =
"Global Configuration Editor - <New global configuration>".Build(Filename);
59 if (!Filename.IsNullOrWhiteSpace())
64 ConfigFilename = Filename;
66 this.Text =
"Global Configuration Editor - {0}".Build(Filename);
70 MessageBox.Show(
"A exception occured when loading the global config file {0}.\nWill use empty global config instead.".Build(Filename),
"Global config loading error", MessageBoxButtons.OK, MessageBoxIcon.Error);
92 private void SelectIniFilePathButton_Click(
object sender, EventArgs e)
94 DirectoryInfo DI = null;
95 if (!IniFilesPath.Text.IsNullOrWhiteSpace())
99 DI =
new DirectoryInfo(IniFilesPath.Text);
102 SelectIniFileDirectoryDialog.SelectedPath = DI.FullName;
108 if (SelectIniFileDirectoryDialog.ShowDialog(Owner) == DialogResult.OK)
111 IniFilesPath.Text = SelectIniFileDirectoryDialog.SelectedPath;
120 private void SelectCabinetConfigFileButton_Click(
object sender, EventArgs e)
123 if (!CabinetFilename.Text.IsNullOrWhiteSpace())
127 FI =
new FileInfo(CabinetFilename.Text);
130 SelectCabinetConfigFileDialog.FileName = FI.FullName;
136 if (SelectCabinetConfigFileDialog.ShowDialog(Owner) == DialogResult.OK)
139 CabinetFilename.Text = SelectCabinetConfigFileDialog.FileName;
150 private void SelectLogFileButton_Click(
object sender, EventArgs e)
153 if (!LogFilename.Text.IsNullOrWhiteSpace())
157 FI =
new FileInfo(LogFilename.Text);
160 SelectLogFileDialog.FileName = FI.FullName;
166 if (SelectLogFileDialog.ShowDialog(Owner) == DialogResult.OK)
169 LogFilename.Text = SelectLogFileDialog.FileName;
178 private void saveToolStripMenuItem_Click(
object sender, EventArgs e)
180 if (!ConfigFilename.IsNullOrWhiteSpace())
182 SaveConfig(ConfigFilename);
186 saveAsToolStripMenuItem_Click(sender, e);
190 private void saveAsToolStripMenuItem_Click(
object sender, EventArgs e)
192 SaveGlobalConfigDialog.FileName = ConfigFilename;
194 if (SaveGlobalConfigDialog.ShowDialog(Owner) == DialogResult.OK)
196 SaveConfig(SaveGlobalConfigDialog.FileName);
201 private void newToolStripMenuItem_Click(
object sender, EventArgs e)
203 if (ContinueDialog())
209 private void loadToolStripMenuItem_Click(
object sender, EventArgs e)
211 if (ContinueDialog())
213 OpenGlobalConfigDialog.InitialDirectory = Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().Location);
215 if (OpenGlobalConfigDialog.ShowDialog(Owner) == DialogResult.OK)
217 LoadConfig(OpenGlobalConfigDialog.FileName);
223 private bool ContinueDialog()
225 if (ConfigHasChanged)
227 switch (MessageBox.Show(Owner,
"The current configuration has changed. Do you want to save the changes?\nPress Yes to save your changes.\nPress No to discard your changes.\nPress Cancel to abort this operation.",
"Save changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
230 SaveGlobalConfigDialog.FileName = ConfigFilename;
232 if (SaveGlobalConfigDialog.ShowDialog(Owner) == DialogResult.OK)
234 SaveConfig(SaveGlobalConfigDialog.FileName);
239 if (MessageBox.Show(Owner,
"You config has not been saved.\nDo you want to continue and discard your changes?",
"Discard changes", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
262 private void quitToolStripMenuItem_Click(
object sender, EventArgs e)
269 private void GlobalConfigEdit_FormClosing(
object sender, FormClosingEventArgs e)
271 e.Cancel = !ContinueDialog();
275 private bool ConfigHasChanged
bool EnableLogging
Gets or sets a value indicating whether impotant events in the framework are logged to a file...
int LedWizDefaultMinCommandIntervalMs
Gets or sets the mininimal interval between command for LedWiz units in miliseconds (Default: 1ms)...
void SaveGlobalConfig(string GlobalConfigFilename="")
Saves the GlobalConfig to the file specified in GlobalConfigFilename. Before saving the current glob...
FilePattern CabinetConfigFilePattern
Gets or sets the path and name of the cabinet config file.
FilePattern LogFilePattern
Gets or sets the log file pattern. The log file pattern supports the following placeholders: ...
string IniFilesPath
Gets or sets the path to the ini files used for table configurations
bool ClearLogOnSessionStart
Gets or sets a value indicating whether DOF clears the log file on session start. ...
Global configuration for the DirectOutput framework.
static GlobalConfig GetGlobalConfigFromConfigXmlFile(string GlobalConfigFileName)
Instanciates a GlobalConfig object from a global configuration in a XML file. If the global config f...