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(); })); } }
public void OpenProject() { var open = new OpenWindow() { Owner = this }; open.OpenProject(EditorController.Runtime); Task.Factory.StartNew(() => { if(open.LoadTask != null) { OperationProgressing progressing = null; Dispatcher.Invoke(new Action(() => { progressing = new OperationProgressing() { Owner = this }; })); Dispatcher.BeginInvoke(new Action(() => { progressing.ShowDialog(); })); open.LoadTask.Wait(); Dispatcher.BeginInvoke(new Action(() => { progressing.Close(); })); } var projectSession = open.ProjectSession; if(projectSession != null) { Dispatcher.BeginInvoke(new Action(() => { var display = new ProjectDisplay() { Session = projectSession, }; display.InitiateModelSystemEditingSession += (editingSession) => EditModelSystem(editingSession); var doc = AddNewWindow("Project - " + projectSession.Project.Name, display, () => { projectSession.Dispose(); }); doc.IsSelected = true; display.RequestClose += (ignored) => doc.Close(); display.Focus(); SetStatusText("Ready"); } )); } }); }
public void OpenModelSystem() { OpenWindow openWindow = new OpenWindow() { Owner = this }; openWindow.OpenModelSystem(EditorController.Runtime); Task.Factory.StartNew(() => { if(openWindow.LoadTask != null) { OperationProgressing progressing = null; Dispatcher.Invoke(new Action(() => { progressing = new OperationProgressing() { Owner = this }; })); Dispatcher.BeginInvoke(new Action(() => { progressing.ShowDialog(); })); openWindow.LoadTask.Wait(); Dispatcher.BeginInvoke(new Action(() => { progressing.Close(); })); } var session = openWindow.ModelSystemSession; if(session != null) { Dispatcher.BeginInvoke(new Action(() => { EditModelSystem(session); SetStatusText("Ready"); })); } }); }
public void OpenProject() { var open = new OpenWindow() { Owner = this }; open.OpenProject(EditorController.Runtime); Task.Factory.StartNew(() => { if (open.LoadTask != null) { OperationProgressing progressing = null; Dispatcher.Invoke(new Action(() => { progressing = new OperationProgressing() { Owner = this }; })); Dispatcher.BeginInvoke(new Action(() => { progressing.ShowDialog(); })); open.LoadTask.Wait(); Dispatcher.BeginInvoke(new Action(() => { progressing.Close(); })); } EditProject(open.ProjectSession); }); }