private void LoadTools() { var fileDialog = new OpenFileDialog(); var result = fileDialog.ShowDialog(); if (result != DialogResult.OK) { return; } if (m_Tools == null) { m_Tools = new List <SendCommandToolForm>(); } else if (m_Tools.Count > 0) { var result2 = MessageBox.Show("There are tools, keep them?", "Load tools...", MessageBoxButtons.YesNo); if (result2 == DialogResult.No) { CloseAllTools(); } } using (var reader = new StreamReader(fileDialog.FileName)) { string str; while ((str = reader.ReadLine()) != null) // Location { var tool = new SendCommandToolForm(m_HostedWindowHwnd, String.Empty); var g = Regex.Replace(str, @"[\{\}a-zA-Z=]", "").Split(','); tool.Location = new Point( int.Parse(g[0]), int.Parse(g[1])); str = reader.ReadLine(); // Size g = Regex.Replace(str, @"[\{\}a-zA-Z=]", "").Split(','); tool.Size = new Size( int.Parse(g[0]), int.Parse(g[1])); str = reader.ReadLine(); // BackgroundImagePath tool.BackgroundImagePath = str; m_Tools.Add(tool); tool.Show(); } } }
private void btnNewToolItem_Click(object sender, EventArgs e) { var tool = new SendCommandToolForm(m_HostedWindowHwnd, txtCommands.Text) { Owner = this }; tool.Location = new Point(this.Location.X + 125, this.Location.Y + 85); if (m_Tools == null) { m_Tools = new List <SendCommandToolForm>(); } tool.Exit += OnToolExit; m_Tools.Add(tool); tool.Show(); }