void LoadProjectExecute() { string?path = UtilGUI.OpenFileDialogToGetFolder(); if (path == null) { return; } if (projectData?.IsBusy ?? false) { if (UtilGUI.WarnAndDecide("Current project is busy.\nTerminate and continue?")) { projectData?.Terminate(); } else { return; } } projectData = NnProjectData.Load(path); if (projectData == null) { UtilGUI.Error("Error!"); return; } projectData.PropertyChanged += OnComponentPropertyChanged; ResetSelectionAndCollections(); OnPropertyChanged(""); }
void AddTaskFromFileExecute() { var(fileOpened, _, content) = UtilGUI.OpenFileDialogToGetNameAndContent( "NN++ template files (*.nnptmpl)|*.nnptmpl|All files (*.*)|*.*", "Choose a parameter file..." ); if (fileOpened == false) { return; } selectedPlan?.AddTaskFromFile(content); SelectionMode = SelectionModes.Plan; }
void AddTemplateExecute() { var(fileOpened, id, content) = UtilGUI.OpenFileDialogToGetNameAndContent( "All files (*.*)|*.*", $"Choose a template..." ); if (fileOpened == false) { return; } NnTemplateData?temp; if ((temp = projectData?.AddTemplate(id, content)) != null) { SelectedTemplate = temp; SelectionMode = SelectionModes.Template; } }
void OnError(Util.ErrorEventArgs e) { UtilGUI.Error(e.Text); }
bool OnWarnAndDecide(Util.WarnAndDecideEventArgs e) { return(UtilGUI.WarnAndDecide(e.Text)); }