public void SaveAs() { var sfdialog = new SaveFileDialog(); sfdialog.Filters.Add(_spritefontFileFilter); sfdialog.Filters.Add(_anyFilesFilter); var result = sfdialog.Run(this); if (result) { var err = sfwidget1.Save((sfdialog.FileName.ToLower().EndsWith(".spritefont")) ? sfdialog.FileName : sfdialog.FileName + ".spritefont"); if (err != SaveError.Nothing) MessageDialog.ShowError("Unknown Error has Occured"); } sfwidget1.Dispose(); ReloadTitle(); }
public static string SaveFileDialog(this IWindow window, string folder, string title, string extension = null) { window.Sensitive = false; FileDialog dialog = new SaveFileDialog (I18N._ (title)); dialog.CurrentFolder = folder; if (extension != null) { dialog.Filters.Add (new FileDialogFilter ("." + extension, "*." + extension)); } if (dialog.Run ()) { window.Sensitive = true; string fileName = dialog.FileName; if (extension != null && !fileName.EndsWith ("." + extension)) { fileName += "." + extension; } return Path.Combine (dialog.CurrentFolder, fileName); } window.Sensitive = true; return null; }
public Windows() { Button b = new Button ("Show borderless window"); PackStart (b); b.Clicked += delegate { Window w = new Window (); w.Decorated = false; Button c = new Button ("This is a window"); // c.Margin.SetAll (10); w.Content = c; c.Clicked += delegate { w.Dispose (); }; var bpos = b.ScreenBounds; w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Width, w.Height); w.Show (); }; b = new Button ("Show message dialog"); PackStart (b); b.Clicked += delegate { MessageDialog.ShowMessage (ParentWindow, "Hi there!"); }; Button db = new Button ("Show custom dialog"); PackStart (db); db.Clicked += delegate { Dialog d = new Dialog (); d.Title = "This is a dialog"; Table t = new Table (); t.Attach (new Label ("Some field:"), 0, 1, 0, 1); t.Attach (new TextEntry (), 1, 2, 0, 1); t.Attach (new Label ("Another field:"), 0, 1, 1, 2); t.Attach (new TextEntry (), 1, 2, 1, 2); d.Content = t; Command custom = new Command ("Custom"); d.Buttons.Add (new DialogButton (custom)); d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok)); d.Buttons.Add (new DialogButton (Command.Cancel)); d.Buttons.Add (new DialogButton (Command.Ok)); var r = d.Run (this.ParentWindow); db.Label = "Result: " + r.Label; d.Dispose (); }; b = new Button ("Show Open File dialog"); PackStart (b); b.Clicked += delegate { OpenFileDialog dlg = new OpenFileDialog ("Select a file"); dlg.InitialFileName = "Some file"; dlg.Multiselect = true; dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt")); dlg.Filters.Add (new FileDialogFilter ("All files", "*.*")); if (dlg.Run ()) MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames)); }; b = new Button ("Show Save File dialog"); PackStart (b); b.Clicked += delegate { SaveFileDialog dlg = new SaveFileDialog ("Select a file"); dlg.InitialFileName = "Some file"; dlg.Multiselect = true; dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt")); dlg.Filters.Add (new FileDialogFilter ("All files", "*.*")); if (dlg.Run ()) MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames)); }; b = new Button ("Show Select Folder dialog (Multi select)"); PackStart (b); b.Clicked += delegate { SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder"); dlg.Multiselect = true; if (dlg.Run ()) MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders)); }; b = new Button ("Show Select Folder dialog (Single select)"); PackStart (b); b.Clicked += delegate { SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder"); dlg.Multiselect = false; if (dlg.Run ()) MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders)); }; b = new Button ("Show Select Color dialog"); PackStart (b); b.Clicked += delegate { SelectColorDialog dlg = new SelectColorDialog ("Select a color"); dlg.SupportsAlpha = true; dlg.Color = Xwt.Drawing.Colors.AliceBlue; if (dlg.Run (ParentWindow)) MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ()); }; b = new Button("Show window shown event"); PackStart(b); b.Clicked += delegate { Window w = new Window(); w.Decorated = false; Button c = new Button("This is a window with events on"); w.Content = c; c.Clicked += delegate { w.Dispose(); }; w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown"); w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden"); w.Show(); }; }
private bool Save(bool saveas) { if (saveas || string.IsNullOrEmpty(fileName)) { var sfdialog = new SaveFileDialog(); sfdialog.Filters.Add(_urmFileFilter); sfdialog.Filters.Add(_txtFileFilter); sfdialog.Filters.Add(_anyFilesFilter); if (sfdialog.Run(this)) { fileName = sfdialog.FileName; var e = sfdialog.ActiveFilter.Patterns.GetEnumerator(); e.MoveNext(); var pattern = e.Current; if (pattern != "*") if (!fileName.EndsWith(pattern.Substring(1))) fileName += pattern.Substring(1); } else return false; } savedContent = te1.Document.Text; File.WriteAllText(fileName, te1.Document.Text); ReloadMenuAndTitle(); return true; }
public void SaveAs () { SaveFileDialog dlg = new SaveFileDialog ("Select a file"); dlg.Multiselect = false; dlg.Filters.Add (new FileDialogFilter ("PDF files", "*.pdf")); dlg.Filters.Add (new FileDialogFilter ("XML files", "*.xml")); dlg.Filters.Add (new FileDialogFilter ("HTML files", "*.html")); dlg.Filters.Add (new FileDialogFilter ("CSV files", "*.csv")); dlg.Filters.Add (new FileDialogFilter ("RTF files", "*.rtf")); dlg.Filters.Add (new FileDialogFilter ("TIF files", "*.tif")); dlg.Filters.Add (new FileDialogFilter ("Excel files", "*.xlsx")); dlg.Filters.Add (new FileDialogFilter ("MHT files", "*.mht")); Uri file = this.SourceFile; if (file != null) { dlg.InitialFileName = "*.pdf"; } else { dlg.InitialFileName = "*.pdf"; } if (dlg.Run () == false) { return; } // save the report in a rendered format string ext = null; int i = dlg.FileName.LastIndexOf ('.'); if (i < 1) { ext = ""; } else { ext = dlg.FileName.Substring (i + 1).ToLower (); } fyiReporting.RDL.OutputPresentationType type = fyiReporting.RDL.OutputPresentationType.Internal; switch (ext) { case "pdf": type = fyiReporting.RDL.OutputPresentationType.PDF; break; case "xml": type = fyiReporting.RDL.OutputPresentationType.XML; break; case "html": type = fyiReporting.RDL.OutputPresentationType.HTML; break; case "htm": type = fyiReporting.RDL.OutputPresentationType.HTML; break; case "csv": type = fyiReporting.RDL.OutputPresentationType.CSV; break; case "rtf": type = fyiReporting.RDL.OutputPresentationType.RTF; break; case "mht": type = fyiReporting.RDL.OutputPresentationType.MHTML; break; case "mhtml": type = fyiReporting.RDL.OutputPresentationType.MHTML; break; case "xlsx": type = fyiReporting.RDL.OutputPresentationType.Excel; break; case "tif": type = fyiReporting.RDL.OutputPresentationType.TIF; break; case "tiff": type = fyiReporting.RDL.OutputPresentationType.TIF; break; default: MessageDialog.ShowMessage(String.Format("{0} is not a valid file type. File extension must be PDF, XML, HTML, CSV, MHT, RTF, TIF, XLSX.", dlg.FileName)); break; } SaveAs(dlg.FileName, type); }
/// <summary> /// Initialize components. /// </summary> private void _initializeComponents() { InfoBox _infoBox = new InfoBox(Director.Properties.Resources.ExportDialog, DirectorImages.SERVER_IMAGE); VBox _contentBox = new VBox(); _contentBox.PackStart(_infoBox); // Create scenarios frame Frame f = new Frame() { Label = Director.Properties.Resources.SelectScenarios, Padding = 10 }; // Scenario view ScenarioListWidget = new ScenarioList(ActiveServer); f.Content = ScenarioListWidget; // Add to content box _contentBox.PackStart(f); // Add Export path ExportPath = new TextEntry() { Sensitive = false, HorizontalPlacement = WidgetPlacement.Fill }; // Button for selecting path Button SelectPath = new Button("...") { WidthRequest = 35, MinWidth = 35, HorizontalPlacement = WidgetPlacement.End }; SelectPath.Clicked += delegate { SaveFileDialog dlg = new SaveFileDialog(Director.Properties.Resources.DialogSaveScenario) { Multiselect = false, InitialFileName = ActiveServer.Name }; dlg.Filters.Add(new FileDialogFilter("Director files", "*.adfe")); if (dlg.Run() && dlg.FileNames.Count() == 1) { ExportPath.Text = dlg.FileName; if (Path.GetExtension(dlg.FileName) != ".adfe") { ExportPath.Text += ".adfe"; } } }; Frame save = new Frame() { Label = Director.Properties.Resources.DialogSaveScenario, Padding = 10 }; HBox SaveBox = new HBox(); SaveBox.PackStart(ExportPath, true, true); SaveBox.PackStart(SelectPath, false, false); save.Content = SaveBox; _contentBox.PackStart(save); // Save button Button SaveBtn = new Button(Director.Properties.Resources.SaveServer) { HorizontalPlacement = WidgetPlacement.End, ExpandHorizontal = false, ExpandVertical = false, WidthRequest = (Config.Cocoa) ? 95 : 80, MinWidth = (Config.Cocoa) ? 95 : 80, Image = Image.FromResource(DirectorImages.SAVE_SCENARIO_ICON) }; SaveBtn.Clicked += SaveBtn_Clicked; // Add to form _contentBox.PackStart(SaveBtn, false, WidgetPlacement.End, WidgetPlacement.End); // Set content box as content Content = _contentBox; }
public Windows() { Button bp = new Button ("Show borderless window"); PackStart (bp); bp.Clicked += delegate { Window w = new Window (); w.Decorated = false; Button c = new Button ("This is a window"); // c.Margin.SetAll (10); w.Content = c; c.Clicked += delegate { w.Dispose (); }; var bpos = bp.ScreenBounds; w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + bp.Size.Height, w.Width, w.Height); w.Show (); }; Button b = new Button ("Show message dialog"); PackStart (b); b.Clicked += delegate { MessageDialog.ShowMessage (ParentWindow, "Hi there!"); }; Button db = new Button ("Show custom dialog"); PackStart (db); db.Clicked += delegate { Dialog d = new Dialog (); d.Title = "This is a dialog"; Table t = new Table (); t.Add (new Label ("Some field:"), 0, 0); t.Add (new TextEntry (), 1, 0); t.Add (new Label ("Another field:"), 0, 1); t.Add (new TextEntry (), 1, 1); d.Content = t; d.CloseRequested += delegate(object sender, CloseRequestedEventArgs args) { args.AllowClose = MessageDialog.Confirm ("Really close?", Command.Close); }; Command custom = new Command ("Custom"); d.Buttons.Add (new DialogButton (custom)); d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok)); d.Buttons.Add (new DialogButton (Command.Cancel)); d.Buttons.Add (new DialogButton (Command.Ok)); var r = d.Run (this.ParentWindow); db.Label = "Result: " + (r != null ? r.Label : "(Closed)"); d.Dispose (); }; b = new Button ("Show Open File dialog"); PackStart (b); b.Clicked += delegate { OpenFileDialog dlg = new OpenFileDialog ("Select a file"); dlg.InitialFileName = "Some file"; dlg.Multiselect = true; dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt")); dlg.Filters.Add (new FileDialogFilter ("All files", "*.*")); if (dlg.Run ()) MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames)); }; b = new Button ("Show Save File dialog"); PackStart (b); b.Clicked += delegate { SaveFileDialog dlg = new SaveFileDialog ("Select a file"); dlg.InitialFileName = "Some file"; dlg.Multiselect = true; dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt")); dlg.Filters.Add (new FileDialogFilter ("All files", "*.*")); if (dlg.Run ()) MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames)); }; b = new Button ("Show Select Folder dialog (Multi select)"); PackStart (b); b.Clicked += delegate { SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder"); dlg.Multiselect = true; if (dlg.Run ()) MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders)); }; b = new Button ("Show Select Folder dialog (Single select)"); PackStart (b); b.Clicked += delegate { SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder"); dlg.Multiselect = false; if (dlg.Run ()) MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders)); }; b = new Button ("Show Select Folder dialog (Single select, allow creation)"); PackStart (b); b.Clicked += delegate { SelectFolderDialog dlg = new SelectFolderDialog ("Select or create a folder"); dlg.Multiselect = false; dlg.CanCreateFolders = true; if (dlg.Run ()) MessageDialog.ShowMessage ("Folders have been selected/created!", string.Join ("\n", dlg.Folders)); }; b = new Button ("Show Select Color dialog"); PackStart (b); b.Clicked += delegate { SelectColorDialog dlg = new SelectColorDialog ("Select a color"); dlg.SupportsAlpha = true; dlg.Color = Xwt.Drawing.Colors.AliceBlue; if (dlg.Run (ParentWindow)) MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ()); }; b = new Button("Show window shown event"); PackStart(b); b.Clicked += delegate { Window w = new Window(); w.Decorated = false; Button c = new Button("This is a window with events on"); w.Content = c; c.Clicked += delegate { w.Dispose(); }; w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown"); w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden"); w.Show(); }; b = new Button("Show dialog with dynamically updating content"); PackStart(b); b.Clicked += delegate { var dialog = new Dialog (); dialog.Content = new Label ("Hello World"); Xwt.Application.TimeoutInvoke (TimeSpan.FromSeconds (2), () => { dialog.Content = new Label ("Goodbye World"); return false; }); dialog.Run (); }; }
/// <summary> /// Export variables. /// </summary> void ExportVariablesMenu_Clicked(object sender, EventArgs e) { SaveFileDialog dlg = new SaveFileDialog(Director.Properties.Resources.ExportVariablesStates) { Multiselect = false, InitialFileName = "variables.xml" }; dlg.Filters.Add(new FileDialogFilter("XML format document", "*.xml")); if (dlg.Run() && dlg.FileNames.Count() == 1) { ExportVariables.Export(UServer, dlg.FileName); } }
/// <summary> /// do a "save as" /// </summary> private void saveAs() { TreeNavigator tn = TsData.GetFirstNode(); if (tn.CurrentPosition == null) { TextviewMessages.LoadText("no glade files in list!\n",TextFormat.Markdown); return; } //FileDialogFilter fi = new FileDialogFilter( SaveFileDialog fc = new SaveFileDialog("save as"); fc.Filters.Add(new FileDialogFilter("Gladebuilder","*.gladebuilder")); if (fc.Run()) { CurrentFile = fc.FileName; doSave(CurrentFile,false); } }
protected void Browse(object sender, EventArgs e) { SaveFileDialog d = new SaveFileDialog("Export " + this); d.Filters.Add(new FileDialogFilter("Arff", "*.arff")); d.Filters.Add(new FileDialogFilter("Other", "*.*")); if (Filename != null) { d.InitialFileName = Path.GetFileName(Filename); d.CurrentFolder = Path.GetDirectoryName(Filename); } if (d.Run()) { string tmpFilename = d.FileName; if (string.IsNullOrEmpty(Path.GetExtension(tmpFilename))) { tmpFilename += ".arff"; } Filename = tmpFilename; } }
/// <summary> /// Initializes the user inferface /// </summary> private void InitializeUI() { // restore last window size and location Location = new Point( Settings.Default.WindowLocationX, Settings.Default.WindowLocationY ); Size = new Size( Settings.Default.WindowSizeWidth, Settings.Default.WindowSizeHeight ); // set window preference Title = "BAIMP"; // file menu var fileMenu = new MenuItem("_File"); fileMenu.SubMenu = new Menu(); MenuItem menuNew = new MenuItem("_New..."); menuNew.Clicked += (object sender, EventArgs e) => project.NewDialog(); fileMenu.SubMenu.Items.Add(menuNew); MenuItem menuOpen = new MenuItem("_Open..."); menuOpen.Clicked += delegate { if (!project.OpenDialog() && !string.IsNullOrEmpty(project.ErrorMessage)) { MessageDialog.ShowMessage ("Error while opening the file", project.ErrorMessage); project.ErrorMessage = null; } }; fileMenu.SubMenu.Items.Add(menuOpen); if (Settings.Default.LastOpenedProjects != null) { MenuItem menuLastOpened = new MenuItem("Recently opened"); menuLastOpened.SubMenu = new Menu(); fileMenu.SubMenu.Items.Add(menuLastOpened); for (int i = Settings.Default.LastOpenedProjects.Count-1; i >= 0; i--) { string path = Settings.Default.LastOpenedProjects[i]; MenuItem menuLastOpenedi = new MenuItem(path); menuLastOpenedi.Clicked += delegate(object sender, EventArgs e) { if (!project.Open(path) && !string.IsNullOrEmpty(project.ErrorMessage)) { MessageDialog.ShowMessage ("Error while opening the file", project.ErrorMessage); project.ErrorMessage = null; } }; menuLastOpened.SubMenu.Items.Add(menuLastOpenedi); } } fileMenu.SubMenu.Items.Add(new SeparatorMenuItem()); MenuItem menuImport = new MenuItem("_Import..."); menuImport.Clicked += (object sender, EventArgs e) => project.ImportDialog(); fileMenu.SubMenu.Items.Add(menuImport); MenuItem menuSave = new MenuItem("_Save"); menuSave.Clicked += (object sender, EventArgs e) => SaveAll(); fileMenu.SubMenu.Items.Add(menuSave); fileMenu.SubMenu.Items.Add(new SeparatorMenuItem()); MenuItem menuClose = new MenuItem("_Exit"); menuClose.Clicked += (object sender, EventArgs e) => Close(); fileMenu.SubMenu.Items.Add(menuClose); // View menu MenuItem viewMenu = new MenuItem("_View"); viewMenu.SubMenu = new Menu(); RadioButtonMenuItemGroup viewRadioGroup = new RadioButtonMenuItemGroup(); RadioButtonMenuItem menuViewOverview = new RadioButtonMenuItem("Overview"); menuViewOverview.Checked = true; menuViewOverview.Group = viewRadioGroup; viewMenu.SubMenu.Items.Add(menuViewOverview); RadioButtonMenuItem menuViewPipeline = new RadioButtonMenuItem("Pipeline"); menuViewPipeline.Group = menuViewOverview.Group; viewMenu.SubMenu.Items.Add(menuViewPipeline); menuViewOverview.Clicked += delegate { splitMain_Status.Remove(pipelineShelf); splitScan_Pipeline.Panel2.Content = pipelineShelf; splitMain_Status.PackStart(splitScan_Pipeline, true, true); }; menuViewPipeline.Clicked += delegate { splitScan_Pipeline.Panel2.Content = null; splitMain_Status.Remove(splitScan_Pipeline); splitMain_Status.PackStart(pipelineShelf, true, true); }; // Edit menu MenuItem editMenu = new MenuItem("_Edit"); editMenu.SubMenu = new Menu(); MenuItem menuWorksheetRename = new MenuItem("_Rename worksheet..."); editMenu.SubMenu.Items.Add(menuWorksheetRename); menuWorksheetRename.Clicked += (object sender, EventArgs e) => pipelineController.RenameCurrentWorksheetDialog(); // Pipeline menu MenuItem pipelineMenu = new MenuItem("_Pipeline"); pipelineMenu.SubMenu = new Menu(); MenuItem menuExecute = new MenuItem("_Execute"); menuExecute.Clicked += (object sender, EventArgs e) => pipelineController.CurrentPipeline.Execute(project); pipelineMenu.SubMenu.Items.Add(menuExecute); pipelineMenu.SubMenu.Items.Add(new SeparatorMenuItem()); MenuItem menuExport = new MenuItem("Export"); menuExport.SubMenu = new Menu(); pipelineMenu.SubMenu.Items.Add(menuExport); Type exporterType = typeof(BaseExporter); IEnumerable<Type> exporter = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(t => t.BaseType == exporterType); foreach (Type export in exporter) { MenuItem ni = new MenuItem(string.Format("As {0}...", export.Name)); ni.Tag = export.Name; menuExport.SubMenu.Items.Add(ni); var lExport = export; ni.Clicked += delegate(object sender, EventArgs e) { MenuItem s = sender as MenuItem; if (s != null) { if (exporterList.ContainsKey(s.Tag.ToString())) { exporterList[s.Tag.ToString()].ShowDialog(pipelineController.CurrentPipeline.Nodes); } else { BaseExporter instance = Activator.CreateInstance(lExport, pipelineController.CurrentPipeline.PipelineName) as BaseExporter; if (instance != null) { exporterList[s.Tag.ToString()] = instance; instance.ShowDialog(pipelineController.CurrentPipeline.Nodes); } } } }; } // Extras menu MenuItem extrasMenu = new MenuItem("E_xtras"); extrasMenu.SubMenu = new Menu(); MenuItem menuResetAllMasks = new MenuItem("_Reset all masks"); menuResetAllMasks.Clicked += delegate { foreach (BaseScan scan in project.scanCollection) { scan.Mask.ResetMask(); } }; MenuItem menuExportLog = new MenuItem("Export _logs"); menuExportLog.Clicked += delegate { SaveFileDialog d = new SaveFileDialog("Export logs"); if (d.Run()) { string filename = d.FileName; if (!string.IsNullOrEmpty(filename)) { System.IO.File.WriteAllText(filename, Log.ToText()); } } d.Dispose(); }; extrasMenu.SubMenu.Items.Add(menuResetAllMasks); extrasMenu.SubMenu.Items.Add(menuExportLog); // main menu Menu menu = new Menu(); menu.Items.Add(fileMenu); menu.Items.Add(viewMenu); menu.Items.Add(editMenu); menu.Items.Add(pipelineMenu); menu.Items.Add(extrasMenu); MainMenu = menu; // initialize preview widget preview = new Preview(); // load tree view with all available files fileTree = new FileTreeView(); VBox splitFileTreeSearch_FileTree = new VBox(); splitFileTreeSearch_FileTree.PackStart(new FileTreeFilter(fileTree)); splitFileTreeSearch_FileTree.PackStart(fileTree, true); // load pipeline controller pipelineShelf = new VBox(); pipelineController = new PipelineController(project, pipelineShelf); splitFiletree_Preview = new HPaned(); splitFiletree_Preview.Panel1.Content = splitFileTreeSearch_FileTree; splitFiletree_Preview.Panel1.Shrink = true; fileTree.HorizontalScrollPolicy = ScrollPolicy.Never; splitFiletree_Preview.Panel2.Content = preview; splitFiletree_Preview.Panel2.Resize = true; splitController_Preview = new VBox(); //splitController_Preview.PackStart(controllbarShelf, false, false); splitController_Preview.PackEnd(splitFiletree_Preview, true, true); splitScan_Pipeline = new VPaned(); splitScan_Pipeline.Panel1.Content = splitController_Preview; splitScan_Pipeline.Panel2.Content = pipelineShelf; splitScan_Pipeline.Panel2.Resize = true; splitMain_Status = new VBox(); splitMain_Status.PackStart(splitScan_Pipeline, true, true); splitMain_Status.PackEnd(new StatusBar()); Content = splitMain_Status; }
public bool NewDialog(bool reset = true) { SaveFileDialog saveDialog = new SaveFileDialog("New Project"); saveDialog.Filters.Add(new FileDialogFilter("BAIMP Project file", "*.baimp")); if (saveDialog.Run()) { string filename = saveDialog.FileName; if (string.IsNullOrEmpty(filename)) { ErrorMessage = "Invalid file path."; Log.Add(LogLevel.Error, this.GetType().Name, ErrorMessage); return false; } if (Path.GetExtension(filename) != "baimp") { filename = Path.GetDirectoryName(filename) + "/" + Path.GetFileNameWithoutExtension(filename) + ".baimp"; } Project.ProjectFile = filename; using (ZipFile zipFile = ZipFile.Create(ProjectFile)) { zipFile.BeginUpdate(); zipFile.CommitUpdate(); zipFile.Close(); } if (reset) { LoadedPipelines = new List<PipelineNodeWrapper>(); LoadedPipelines.Add(new PipelineNodeWrapper("Master")); scanCollection.Clear(); if (projectChanged != null) { projectChanged(this, new ProjectChangedEventArgs(true)); } } return true; } return false; }