Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SchedulerRunItem_OnLoaded(object sender, RoutedEventArgs e)
        {
            this._schedulerWindow = this.Tag as SchedulerWindow;
            var             layer       = AdornerLayer.GetAdornerLayer(this);
            DragDropAdorner moveAdorner = new DragDropAdorner(this);

            layer.Add(moveAdorner);
        }
Пример #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();
        }