예제 #1
0
        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("");
        }
예제 #2
0
        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;
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
 void OnError(Util.ErrorEventArgs e)
 {
     UtilGUI.Error(e.Text);
 }
예제 #5
0
 bool OnWarnAndDecide(Util.WarnAndDecideEventArgs e)
 {
     return(UtilGUI.WarnAndDecide(e.Text));
 }