private void ShowNewForm(object sender, EventArgs e) { SetEditor childForm = new SetEditor(ref _AppSettings); childForm.MdiParent = this; childForm.Text = "Untitled"; childForm.Tag = null; childForm.Show(); AdjustMenu(); }
private void publishAsToolStripMenuItem_Click(object sender, EventArgs e) { try { SetEditor o = (SetEditor)this.ActiveMdiChild; } catch { MessageBox.Show("Only a configuration set can be saved to a file--not a tester.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } SetEditor f = (SetEditor)this.ActiveMdiChild; f.SaveToFile(string.Empty, true); }
private void adjustNTPermissionsToolStripMenuItem_Click(object sender, EventArgs e) { this.toolStripStatusLabel.Text = "Apply or Remove an NT Account with permissions to delete items in the target folder(s)"; try { SetEditor o = (SetEditor)this.ActiveMdiChild; } catch { MessageBox.Show("You must have an configuration item selected in an editor window to adjust the server filter", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } SetEditor f = (SetEditor)this.ActiveMdiChild; f.AdjustNTAccountPermissions(); this.toolStripStatusLabel.Text = string.Empty; }
private void adjustWorkerServersToolStripMenuItem_Click(object sender, EventArgs e) { this.toolStripStatusLabel.Text = "Adjust the list of servers which can execute the configurations in this set."; try { SetEditor o = (SetEditor)this.ActiveMdiChild; } catch { MessageBox.Show("You must have an configuration item selected in an editor window to adjust the server filter", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } SetEditor f = (SetEditor)this.ActiveMdiChild; f.AdjustServerExectionFilter(); this.toolStripStatusLabel.Text = string.Empty; }
private void testSelectedProcessToolStripMenuItem_Click(object sender, EventArgs e) { this.toolStripStatusLabel.Text = "Tester active.. close it to return to editor."; try { SetEditor o = (SetEditor)this.ActiveMdiChild; } catch { MessageBox.Show("You must have an configuration item selected in an editor window to launch a tester", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } SetEditor f = (SetEditor)this.ActiveMdiChild; f.LaunchTester(); this.toolStripStatusLabel.Text = string.Empty; }
public void OpenFile(string filename) { string corePath = Path.GetDirectoryName(filename); bool InUse = false; foreach (SetEditor childForm in MdiChildren) { if (filename == (string)childForm.ConfigurationFilePath) { childForm.Activate(); InUse = true; break; } } if (!InUse) { bool FileIsOk = true; SetEditor childForm = new SetEditor(ref _AppSettings); childForm.ConfigurationFilePath = filename; try { childForm.LoadFromFile(); AddMRU(filename); } catch (Exception e) { FileIsOk = false; childForm.Dispose(); MessageBox.Show(string.Format("Error loading configuration file: {0}\r\n{1}\r\nThe file may be corrupt.", filename, e.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } if (FileIsOk) { childForm.StorageFolder = corePath; childForm.MdiParent = this; childForm.Show(); } AdjustMenu(); } if (corePath != _StorageFolder) { _AppSettings.LoadSettings(); _AppSettings.SetSetting("LastFolderLocation", corePath); _AppSettings.SaveSettings(); } _StorageFolder = corePath; }
private void PasteToolStripMenuItem_Click(object sender, EventArgs e) { try { SetEditor o = (SetEditor)this.ActiveMdiChild; } catch { MessageBox.Show("Only a configuration set can be saved to a file--not a tester.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } SetEditor f = (SetEditor)this.ActiveMdiChild; if (f.PasteConfigFromClipboard()) { this.toolStripStatusLabel.Text = "New configuration item(s) creted from clipboard."; } }
private void CopyToolStripMenuItem_Click(object sender, EventArgs e) { try { SetEditor o = (SetEditor)this.ActiveMdiChild; } catch { MessageBox.Show("Only a selected configuration item can be copied from the editor--not from the tester.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } SetEditor f = (SetEditor)this.ActiveMdiChild; if (f.CopyConfigToClipboard()) { this.toolStripStatusLabel.Text = "Selected configuration item(s) copied to clipboard."; } }
public ManagerMDI(string[] args) { InitializeComponent(); LocalFileList.Columns.Add("Timestamp", Type.GetType("System.DateTime")); LocalFileList.Columns.Add("FileName", Type.GetType("System.String")); BOG.Framework.AssemblyVersion a = new BOG.Framework.AssemblyVersion(System.Reflection.Assembly.GetEntryAssembly()); _ExecutablePath = a.FullPath.Substring(0, a.FullPath.Length - a.Name.Length); _HelpURL = Path.Combine(_ExecutablePath, "WeedKillerHelp.htm"); _ConfigurationPath = Path.Combine(Path.Combine(System.Environment.GetEnvironmentVariable("APPDATA"), "Bits of Genius"), "Weed Killer Manager"); _ConfigurationFile = Path.Combine(_ConfigurationPath, "usersettings.xml"); _DefaultConfigurationFile = Path.Combine(_ExecutablePath, "default_usersettings.xml"); _StorageFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); try { if (!File.Exists(_ConfigurationFile) && File.Exists(_DefaultConfigurationFile)) { File.Copy(_DefaultConfigurationFile, _ConfigurationFile); } } catch { } _AppSettings = new SettingsDictionary(_ConfigurationFile); _AppSettings.LoadSettings(); LoadOptions(); string FileName = string.Empty; for (int i = 0; i < 100 && (FileName = (string)_AppSettings.GetSetting(string.Format("Recovery{0:0#}", i), string.Empty)) != string.Empty; i++) { if (File.Exists(FileName)) { string NewFileName = string.Empty; // a file which was previously saved, but was not current at the time of closing. if (FileName.Length >= 13 && FileName.Substring(FileName.Length - 13, 13).ToLower() == ".recovery.wkconf") { NewFileName = FileName.Substring(0, FileName.Length - 13); } OpenFile(FileName); Application.DoEvents(); SetEditor ChildForm = (SetEditor)this.MdiChildren[this.MdiChildren.GetUpperBound(0)]; ChildForm.ConfigurationFilePath = NewFileName; ChildForm.Saved = false; ChildForm.Text = ChildForm.ConfigurationFilePath == string.Empty ? "Untitled" : Path.GetFileNameWithoutExtension(NewFileName); File.Delete(FileName); } _AppSettings.DeleteSetting(string.Format("Recovery{0:0#}", i)); } _AppSettings.SaveSettings(); // If the command line is not empty, treat each argument as a configuration file, // and open the file. This allows files to be opened from the explorer extension // "Open" for (int Index = 0; args != null && Index < args.Length; Index++) { if (args[Index].IndexOfAny(new char[] { '*', '?' }) < 0 && !File.Exists(args[Index])) { MessageBox.Show(string.Format("Non-existent file specific on command line: {0}", args[Index]), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { foreach (string ThisFileName in Directory.GetFiles(Path.GetDirectoryName(args[Index]), Path.GetFileName(args[Index]), SearchOption.TopDirectoryOnly)) { OpenFile(ThisFileName); if (this.MdiChildren.Length > 0) { Application.DoEvents(); SetEditor ChildForm = (SetEditor)this.MdiChildren[this.MdiChildren.GetUpperBound(0)]; if (ChildForm.ConfigurationFilePath == ThisFileName) { ChildForm.Saved = true; ChildForm.Text = Path.GetFileNameWithoutExtension(ThisFileName); } } } } } LoadMRU(); AdjustMenu(); this.toolStripStatusLabel.Text = "Ready"; }