/// <summary>
        /// </summary>
        /// <param name="modelSystemDisplay"></param>
        public ModelSystemRegionViewDisplay(ModelSystemDisplay modelSystemDisplay)
        {
            InitializeComponent();

            _modelSystemDisplay = modelSystemDisplay;
            _modelSystemDisplay.ModelSystemEditingSessionChanged += ModelSystemDisplay_ModelSystemEditingSessionChanged;
        }
示例#2
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();
        }
示例#3
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();
            }
        }
示例#4
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();
            }
        }