Esempio n. 1
0
        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");
                    }
                    ));
                }
            });
        }
Esempio n. 2
0
 private void EditProject(ProjectEditingSession 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;
             PropertyChangedEventHandler onRename = (o, e) =>
             {
                 doc.Title = "Project - " + projectSession.Project.Name;
             };
             projectSession.NameChanged += onRename;
             display.RequestClose += (ignored) =>
             {
                 doc.Close();
                 display.Model.Unload();
                 projectSession.NameChanged -= onRename;
             };
             display.Focus();
             SetStatusText("Ready");
         }
         ));
     }
 }