Exemple #1
0
        private void ImportModelSystem_Clicked(object obj)
        {
            var xtmf   = Session.GetRuntime();
            var openMS = new OpenWindow();

            openMS.Owner = GetWindow();
            using (var modelSystemSession = openMS.OpenModelSystem(xtmf))
            {
                var loading = openMS.LoadTask;
                if (loading != null)
                {
                    loading.Wait();
                    using (var realSession = openMS.ModelSystemSession)
                    {
                        if (realSession == null)
                        {
                            return;
                        }
                        string        error = null;
                        StringRequest sr    = new StringRequest("Save Model System As?", (newName) =>
                        {
                            return(Session.ValidateModelSystemName(newName));
                        });
                        sr.Owner = GetWindow();
                        if (sr.ShowDialog() == true)
                        {
                            if (!Session.AddModelSystem(realSession.ModelSystemModel, sr.Answer, ref error))
                            {
                                MessageBox.Show(GetWindow(), error, "Unable to Import Model System", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
                                return;
                            }
                            Model.RefreshModelSystems();
                        }
                    }
                }
            }
        }
Exemple #2
0
 private void ImportModelSystem_Clicked(object obj)
 {
     var xtmf = Session.GetRuntime();
     var openMS = new OpenWindow();
     openMS.Owner = GetWindow();
     using (var modelSystemSession = openMS.OpenModelSystem(xtmf))
     {
         var loading = openMS.LoadTask;
         if (loading != null)
         {
             loading.Wait();
             using (var realSession = openMS.ModelSystemSession)
             {
                 if (realSession == null)
                 {
                     return;
                 }
                 string error = null;
                 StringRequest sr = new StringRequest("Save Model System As?", (newName) =>
                 {
                     return Session.ValidateModelSystemName(newName);
                 });
                 sr.Owner = GetWindow();
                 if (sr.ShowDialog() == true)
                 {
                     if (!Session.AddModelSystem(realSession.ModelSystemModel, sr.Answer, ref error))
                     {
                         MessageBox.Show(GetWindow(), error, "Unable to Import Model System", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
                         return;
                     }
                     Model.RefreshModelSystems();
                 }
             }
         }
     }
 }
Exemple #3
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");
                    }
                    ));
                }
            });
        }
Exemple #4
0
 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");
             }));
         }
     });
 }
Exemple #5
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();
                    }));
                }
                EditProject(open.ProjectSession);
            });
        }