Exemple #1
0
        private void ExecuteStopCommand()
        {
            MouseService.SetBusyState();

            _cts?.Cancel();
            _myStopwatch.Reset();
            _currentStatusbarState = EStatusbarState.Default;
            SetCurrentBusinessData();
            EnvironmentContainer.CreatePopUpWindow(EnvironmentContainer.ApplicationTitle, Application.Current.TryFindResource("CalculationStopped").ToString());
        }
Exemple #2
0
        private void OnStartCalculationPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (!e.PropertyName.Equals("IsSuccessfullyCompleted"))
            {
                return;
            }

            _currentStatusbarState = EStatusbarState.Default;
            _myStopwatch?.Stop();
            SetCurrentBusinessData();
            EnvironmentContainer.CreatePopUpWindow(EnvironmentContainer.ApplicationTitle, Application.Current.TryFindResource("CalculationFinished").ToString());

            OnPropertyChanged(nameof(HierarchialData));
            OnPropertyChanged(nameof(CollectionView));
        }
Exemple #3
0
        private async Task ExecuteStartCalculationCommandAsync()
        {
            MouseService.SetBusyState();
            EnvironmentContainer.CreatePopUpWindow(EnvironmentContainer.ApplicationTitle, Application.Current.TryFindResource("CalculationStart").ToString());

            _myStopwatch.Reset();
            _myStopwatch.Start();

            _currentStatusbarState = EStatusbarState.Busy;
            SetCurrentBusinessData();

            _cts?.Dispose();
            _cts = new CancellationTokenSource();

            await EnvironmentContainer.Instance.StartCalculationAsync(HierarchialData.Where(p => p.HasChildren).ToList(), _cts.Token).ConfigureAwait(false);
        }
Exemple #4
0
        /// <summary>
        /// Standard constructor
        /// </summary>
        public MainWindowViewModel()
        {
            // Set XAML language culture info
            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
                                                               new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name)));

            _currentStatusbarState        = EStatusbarState.Default;
            _baseWindowStatusbarViewModel = BaseWindowStatusbarViewModel.Instance;
            _myStopwatch         = new Stopwatch();
            _elapsedTimeResource = Application.Current.TryFindResource("ElapsedTime").ToString();

            HierarchialData = new VsDataGridHierarchialData();
            CollectionView  = (ListCollectionView) new CollectionViewSource {
                Source = HierarchialData
            }.View;
            HashsumCollectionViewHolder.Cv = CollectionView;

            ((AsyncCommand <object>)StartCalculationCommand).PropertyChanged += OnStartCalculationPropertyChanged;
        }