예제 #1
0
 public RunWindow(ModelSystemEditingSession session, XTMFRun run, string runName)
 {
     InitializeComponent();
     Session = session;
     session.SessionClosed += Session_SessionClosed;
     StartRun(run, runName);
 }
예제 #2
0
 public RunWindow(ModelSystemEditingSession session, XTMFRun run, string runName)
 {
     InitializeComponent();
     Session = session;
     session.SessionClosed += Session_SessionClosed;
     StartRun(run, runName);
 }
예제 #3
0
 public FreeVariableEntry(Type freeVariable, ModelSystemEditingSession session)
 {
     InitializeComponent();
     Session    = session;
     Conditions = freeVariable.GetGenericParameterConstraints();
     Loaded    += FreeVariableEntry_Loaded;
 }
예제 #4
0
        private void Select()
        {
            var index = Display.SelectedIndex;

            if (index < 0)
            {
                return;
            }
            IsEnabled = false;

            var result = InternalModel.Data[InternalModel.Data.IndexOf((Model.ModelElement)Display.SelectedItem)].Data;

            if (result is Project)
            {
                MainWindow.SetStatusText("Loading Project...");
            }
            else
            {
                MainWindow.SetStatusText("Loading Model System...");
            }
            LoadTask = Task.Factory.StartNew(() =>
            {
                if (result is Project)
                {
                    ProjectSession = PEditSession = Runtime.ProjectController.EditProject(result as Project);
                }
                else
                {
                    ModelSystemSession = MSEditSession = Runtime.ModelSystemController.EditModelSystem(result as ModelSystem);
                }
            });
            Close();
        }
예제 #5
0
 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();
         }));
     }
 }
예제 #6
0
 public ModuleTypeSelect(ModelSystemEditingSession session, ModelSystemStructureModel selectedModule)
     : this()
 {
     _modelSystemSession = session;
     _selectedModule     = selectedModule;
     BuildRequirements(session);
     FilterBox.Filter  = CheckAgainstFilter;
     FilterBox.Display = Display;
 }
예제 #7
0
 public ModuleTypeSelect(ModelSystemEditingSession session, ModelSystemStructureModel selectedModule)
     : this()
 {
     ModelSystemSession = session;
     SelectedModule = selectedModule;
     BuildRequirements( session );
     FilterBox.Filter = CheckAgainstFilter;
     FilterBox.Display = Display;
 }
예제 #8
0
 public ModelSystemEditingSession OpenModelSystem(XTMFRuntime runtime)
 {
     Runtime = runtime;
     MSEditSession = null;
     InternalModel.Initialize(runtime.ModelSystemController.GetModelSystems());
     DataContext = InternalModel;
     Display.ItemsSource = InternalModel.Data;
     FilterBox.Display = Display;
     FilterBox.Filter = Filter;
     ShowDialog();
     return MSEditSession;
 }
예제 #9
0
        public ModelSystemEditingSessionDisplayModel(ModelSystemDisplay display) : base(true)
        {
            var session = display.Session;

            _Display = display;
            _Session = session;
            _CanUndo = _Session.CanUndo;
            _CanRedo = _Session.CanRedo;
            UndoList = new ObservableCollection <CommandDisplayModel>();
            RedoList = new ObservableCollection <CommandDisplayModel>();
            _Session.CommandExecuted += Session_CommandExecuted;
        }
예제 #10
0
 public ModelSystemEditingSession OpenModelSystem(XTMFRuntime runtime)
 {
     ExportButton.IsEnabled = true;
     Runtime = runtime;
     MSEditSession = null;
     InternalModel.Initialize(runtime.ModelSystemController.GetModelSystems());
     DataContext = InternalModel;
     lock (InternalModel.Data)
     {
         Display.ItemsSource = InternalModel.Data;
     }
     FilterBox.Display = Display;
     FilterBox.Filter = Filter;
     ShowDialog();
     return MSEditSession;
 }
예제 #11
0
 public ModelSystemEditingSession OpenModelSystem(XTMFRuntime runtime)
 {
     ExportButton.IsEnabled = true;
     Runtime       = runtime;
     MSEditSession = null;
     InternalModel.Initialize(runtime.ModelSystemController.GetModelSystems());
     DataContext = InternalModel;
     lock (InternalModel.Data)
     {
         Display.ItemsSource = InternalModel.Data;
     }
     FilterBox.Display = Display;
     FilterBox.Filter  = Filter;
     ShowDialog();
     return(MSEditSession);
 }
예제 #12
0
        public SelectRunDateTimeDialog(ModelSystemEditingSession session)
        {
            InitializeComponent();
            var getNames = session.GetPreviousRunNamesAsync();

            getNames.ContinueWith(previousRuns =>
            {
                if (!DidComplete && !Dispatcher.HasShutdownStarted)
                {
                    Dispatcher.Invoke(() =>
                    {
                        StringInputTextBox.ItemsSource = previousRuns.Result;
                    });
                }
            });
            getNames.Start();
        }
예제 #13
0
 public RunWindow(ModelSystemEditingSession session)
 {
     InitializeComponent();
     Session = session;
     session.SessionClosed += Session_SessionClosed;
     var runName = "Run Name";
     StringRequest req = new StringRequest("Run Name", ValidateName);
     if(req.ShowDialog() == true)
     {
         runName = req.Answer;
         StartRun(session, runName);
     }
     else
     {
         MainWindow.Us.CloseWindow(this);
     }
 }
예제 #14
0
        private void EditModelSystem(ModelSystemEditingSession modelSystemSession)
        {
            if (modelSystemSession != null)
            {
                var display = new ModelSystemDisplay()
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    ModelSystem         = modelSystemSession.ModelSystemModel,
                    Session             = modelSystemSession,
                };

                var titleBarName = modelSystemSession.EditingProject ?
                                   modelSystemSession.ProjectEditingSession.Name + " - " + modelSystemSession.ModelSystemModel.Name
                    : "Model System - " + modelSystemSession.ModelSystemModel.Name;
                var doc = AddNewWindow(titleBarName, display);
                PropertyChangedEventHandler onRename = (o, e) =>
                {
                    Dispatcher.Invoke(() =>
                    {
                        doc.Title = modelSystemSession.EditingProject ?
                                    modelSystemSession.ProjectEditingSession.Name + " - " + modelSystemSession.ModelSystemModel.Name
                       : "Model System - " + modelSystemSession.ModelSystemModel.Name;;
                    });
                };
                modelSystemSession.NameChanged += onRename;
                doc.Closing += (o, e) =>
                {
                    e.Cancel = !display.CloseRequested();
                    if (e.Cancel == false)
                    {
                        modelSystemSession.NameChanged -= onRename;
                    }
                };
                doc.Closed           += (o, e) => { modelSystemSession.Dispose(); };
                display.RequestClose += (ignored) => doc.Close();
                doc.IsSelected        = true;
                Keyboard.Focus(display);
                display.Focus();
            }
        }
예제 #15
0
        /// <summary>
        /// Figure out what types we are going to be restricted by
        /// </summary>
        private void BuildRequirements(ModelSystemEditingSession session)
        {
            List <Type> available = session.GetValidModules(SelectedModule);

            Display.ItemsSource = AvailableModules = Convert(available);
        }
예제 #16
0
        private void Select()
        {
            var index = Display.SelectedIndex;
            if (index < 0) return;
            IsEnabled = false;

            var result = InternalModel.Data[InternalModel.Data.IndexOf((Model.ModelElement)Display.SelectedItem)].Data;
            if (result is Project)
            {
                MainWindow.SetStatusText("Loading Project...");
            }
            else
            {
                MainWindow.SetStatusText("Loading Model System...");
            }
            LoadTask = Task.Factory.StartNew(() =>
                {
                    if (result is Project)
                    {
                        ProjectSession = PEditSession = Runtime.ProjectController.EditProject(result as Project);
                    }
                    else
                    {
                        ModelSystemSession = MSEditSession = Runtime.ModelSystemController.EditModelSystem(result as ModelSystem);
                    }
                });
            Close();
        }
예제 #17
0
 private void StartRun(ModelSystemEditingSession session, string runName)
 {
     string error = null;
     Dispatcher.BeginInvoke(new Action(() =>
         {
             MainWindow.Us.SetWindowName(this, "Run - " + runName);
             RunNameLabel.Text = runName;
         }));
     Run = session.Run(runName, ref error);
     ProgressReports = Run.Configuration.ProgressReports;
     Run.RunComplete += Run_RunComplete;
     Run.RunStarted += Run_RunStarted;
     Run.RuntimeError += Run_RuntimeError;
     Run.RuntimeValidationError += Run_RuntimeValidationError;
     Run.ValidationStarting += Run_ValidationStarting;
     Run.ValidationError += Run_ValidationError;
     RunDirectory = Run.RunDirectory;
     Timer = new DispatcherTimer();
     Timer.Interval = TimeSpan.FromMilliseconds(1000 / 30);
     Timer.Tick += new EventHandler(Timer_Tick);
     if(Environment.OSVersion.Platform == PlatformID.Win32NT)
     {
         var major = Environment.OSVersion.Version.Major;
         if(major > 6 || (major >= 6 && Environment.OSVersion.Version.Minor >= 1))
         {
             Windows7OrAbove = true;
             TaskbarInformation = new TaskbarItemInfo();
         }
     }
     StartRunAsync();
     Timer.Start();
 }
예제 #18
0
        private void EditModelSystem(ModelSystemEditingSession modelSystemSession)
        {
            if (modelSystemSession != null)
            {
                var display = new ModelSystemDisplay()
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment = VerticalAlignment.Stretch,
                    ModelSystem = modelSystemSession.ModelSystemModel,
                    Session = modelSystemSession,
                };

                var titleBarName = modelSystemSession.EditingProject ?
                     modelSystemSession.ProjectEditingSession.Name + " - " + modelSystemSession.ModelSystemModel.Name
                    : "Model System - " + modelSystemSession.ModelSystemModel.Name;
                var doc = AddNewWindow(titleBarName, display);
                PropertyChangedEventHandler onRename = (o, e) =>
                {
                    Dispatcher.Invoke(() =>
                   {
                       doc.Title = modelSystemSession.EditingProject ?
                        modelSystemSession.ProjectEditingSession.Name + " - " + modelSystemSession.ModelSystemModel.Name
                       : "Model System - " + modelSystemSession.ModelSystemModel.Name; ;
                   });
                };
                modelSystemSession.NameChanged += onRename;
                doc.Closing += (o, e) =>
                {
                    e.Cancel = !display.CloseRequested();
                    if (e.Cancel == false)
                    {
                        modelSystemSession.NameChanged -= onRename;
                    }
                };
                doc.Closed += (o, e) => { modelSystemSession.Dispose(); };
                display.RequestClose += (ignored) => doc.Close();
                doc.IsSelected = true;
                Keyboard.Focus(display);
                display.Focus();
            }
        }
예제 #19
0
        private void EditModelSystem(ModelSystemEditingSession modelSystemSession)
        {
            if(modelSystemSession != null)
            {
                var display = new ModelSystemDisplay()
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment = VerticalAlignment.Stretch,
                    ModelSystem = modelSystemSession.ModelSystemModel,
                    Session = modelSystemSession,
                };

                var doc = AddNewWindow("Model System - " + modelSystemSession.ModelSystemModel.Name, display);
                doc.Closed += (o, e) => { modelSystemSession.Dispose(); };
                display.RequestClose += (ignored) => doc.Close();
                doc.IsSelected = true;
                Keyboard.Focus(display);
                display.Focus();
            }
        }
예제 #20
0
 private bool RunAlreadyExists(string runName, ModelSystemEditingSession session)
 {
     return(session.RunNameExists(runName));
 }
예제 #21
0
        /// <summary>
        /// </summary>
        /// <param name="session"></param>
        /// <param name="run"></param>
        /// <param name="runName"></param>
        /// <param name="immediateRun"></param>
        /// <param name="launchedFrom"></param>
        public RunWindow(ModelSystemEditingSession session, XTMFRun run, string runName, DateTime delayedStartTime,
                         ModelSystemDisplay launchedFrom = null, SchedulerWindow schedulerWindow = null)
        {
            InitializeComponent();
            ErrorVisibility = Visibility.Collapsed;
            Session         = session;
            Run             = run;
            SchedulerWindow = schedulerWindow;
            OpenDirectoryButton.IsEnabled = true;
            Dispatcher.BeginInvoke(new Action(() =>
            {
                RunNameLabel.Text = runName;
                RunNameText.Text  = runName;
                IsRunClearable    = false;
            }));
            if (launchedFrom != null)
            {
                _launchedFromModelSystemDisplay = launchedFrom;
            }
            _progressReports               = Run.Configuration.ProgressReports;
            _progressReports.ListChanged  += ProgressReports_ListChanged;
            _progressReports.BeforeRemove += ProgressReports_BeforeRemove;
            _subProgressBars.ListChanged  += SubProgressBars_ListChanged;
            _subProgressBars.BeforeRemove += SubProgressBars_BeforeRemove;
            Run.RunCompleted              += Run_RunComplete;
            Run.RunStarted             += Run_RunStarted;
            Run.RuntimeError           += Run_RuntimeError;
            Run.RuntimeValidationError += Run_RuntimeValidationError;
            Run.ValidationStarting     += RunOnValidationStarting;
            Run.ValidationError        += RunOnValidationError;

            ErrorGroupBox.Visibility          = Visibility.Collapsed;
            BaseGrid.RowDefinitions[1].Height = new GridLength(0);
            _runDirectory = Run.RunDirectory;
            _timer        = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(100)
            };
            _isFinished  = false;
            _wasCanceled = false;
            _timer.Tick += Timer_Tick;
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                var major = Environment.OSVersion.Version.Major;
                if (major > 6 || major >= 6 && Environment.OSVersion.Version.Minor >= 1)
                {
                    _windows7OrAbove = true;
                    MainWindow.Us.TaskbarItemInfo     = _taskbarInformation = new TaskbarItemInfo();
                    _taskbarInformation.ProgressState = TaskbarItemProgressState.Normal;
                    _taskbarInformation.ProgressValue = 0;
                }
            }
            ConfigureLogger();
            var conc = new ConsoleOutputController(this, Run, iLog);

            ConsoleOutput.DataContext = conc;
            _consoleAppener.ConsoleOutputController = conc;
            ConsoleBorder.DataContext = ConsoleOutput.DataContext;
            session.ExecuteDelayedRun(run, delayedStartTime);
            DetailsGroupBox.DataContext = this;
            StartRunAsync();
            _timer.Start();
        }
예제 #22
0
 /// <summary>
 /// Figure out what types we are going to be restricted by
 /// </summary>
 private void BuildRequirements(ModelSystemEditingSession session)
 {
     List<Type> available = session.GetValidModules( SelectedModule );
     Display.ItemsSource = AvailableModules = Convert( available );
 }
예제 #23
0
 /// <summary>
 /// Figure out what types we are going to be restricted by
 /// </summary>
 private void BuildRequirements(ModelSystemEditingSession session)
 {
     Display.ItemsSource = Convert(session.GetValidModules(_selectedModule));
 }