private void LoadModelSystem(ModelSystem modelSystem) { if (modelSystem != null) { ModelSystemEditingSession session = null; OperationProgressing progressing = new OperationProgressing { Owner = GetWindow() }; var loadingTask = Task.Run(() => { session = Runtime.ModelSystemController.EditModelSystem(modelSystem); }); MainWindow.Us.Dispatcher.BeginInvoke(new Action(() => { progressing.ShowDialog(); })); loadingTask.Wait(); if (session != null) { MainWindow.Us.EditModelSystem(session); } MainWindow.Us.Dispatcher.BeginInvoke(new Action(() => { progressing.Close(); })); } }
private void LoadCurrentProject() { var project = Display.SelectedItem as Project; if (project != null) { ProjectEditingSession session = null; OperationProgressing progressing = new OperationProgressing() { Owner = GetWindow() }; var loadingTask = Task.Run(() => { session = Runtime.ProjectController.EditProject(project); }); MainWindow.Us.Dispatcher.BeginInvoke(new Action(() => { progressing.ShowDialog(); })); loadingTask.Wait(); if (session != null) { MainWindow.Us.EditProject(session); } MainWindow.Us.Dispatcher.BeginInvoke(new Action(() => { progressing.Close(); })); } }