public void FileOpen() { using (var f = new OpenFileDialog()) { f.CheckFileExists = true; f.CheckPathExists = true; f.AddExtension = true; f.DefaultExt = ".spd"; f.Filter = "Speed files (*.spd)|*.spd|All files (*.*)|*.*"; f.FilterIndex = 0; if (f.ShowDialog() == DialogResult.OK) { var gen = new Speed.UI.UserControls.CtlGenerator(f.FileName); AddChildControl(gen, Path.GetFileName(f.FileName), "Gear", f.FileName); Program.Config.SetRecentFile(f.FileName); } } }
private void FormMain_Load(object sender, EventArgs e) { if (!this.DesignMode) { this.Text = Program.Title; this.Icon = Properties.Resources.APP; imlIcons.Images.Add("Gear", Speed.UI.Properties.Resources.Gear); } #if DEBUG2 if (count == 0 && Environment.MachineName == "QUASAR") { string fileName = null; // fileName = @"..\..\..\__Testes\MyProject\MyProject.spd"; // fileName = @"..\..\..\Testes\TestGen.Oracle\TestOracle.spd"; // fileName = @"..\..\..\Testes\TestGen.MySql\TestMySql.spd"; fileName = @"E:\_Projects\_Systems\SpeedCluster\SpeedCluster.spd"; if (fileName != null) { FileInfo fi = new FileInfo(fileName); if (fi.Exists) { var gen = new Speed.UI.UserControls.CtlGenerator(fi.FullName); AddChildControl(gen, fi.Name, "Gear", fi.FullName); //AddChildControl<Speed.UI.UserControls.CtlGenerator>("Generator", "Gear"); } } } #endif btnClose.Tag = btnClose.ForeColor; btnClose.MouseEnter += (o, ev) => btnClose.ForeColor = Color.Black; btnClose.MouseLeave += (o, ev) => btnClose.ForeColor = (Color)btnClose.Tag; mnuFile_Click(null, null); // abre o último arquivo #if DEBUG if (mnuFileRecenteFiles.DropDownItems.Count > 0) { mnuFileRecenteFilesItem_Click(mnuFileRecenteFiles.DropDownItems[0], null); } #endif SetControls(); }
public void FileOpen(string fileName) { Program.RunSafe(this, () => { if (!File.Exists(fileName)) { throw new Exception("File not found: " + fileName); } foreach (TabPage page in tabControl.TabPages) { if (page.ToolTipText.EqualsICIC(fileName)) { tabControl.SelectedTab = page; Program.Config.SetRecentFile(fileName); return; } } var gen = new Speed.UI.UserControls.CtlGenerator(fileName); AddChildControl(gen, Path.GetFileName(fileName), "Gear", fileName); Program.Config.SetRecentFile(fileName); }); }