Ejemplo n.º 1
0
        private void ExecuteStopCommand()
        {
            MouseService.SetBusyState();

            _cts?.Cancel();
            _myStopwatch.Reset();
            _currentStatusbarState = EStatusbarState.Default;
            SetCurrentBusinessData();
            EnvironmentContainer.CreatePopUpWindow(EnvironmentContainer.ApplicationTitle, Application.Current.TryFindResource("CalculationStopped").ToString());
        }
Ejemplo n.º 2
0
        private void ExecuteClearAllCommand()
        {
            MouseService.SetBusyState();

            HierarchialData.RowData.Clear();
            HierarchialData.Clear();
            _myStopwatch.Reset();

            SetCurrentBusinessData();
            OnPropertyChanged(nameof(HierarchialData));
            OnPropertyChanged(nameof(CollectionView));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        private async Task ExecuteSaveCommandAsync()
        {
            if (InteractionService.ShowQuestionMessageBox(Application.Current.TryFindResource("QWantToSave").ToString()) == MessageBoxResult.No)
            {
                return;
            }

            MouseService.SetBusyState();

            _cts?.Dispose();
            _cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));

            bool result = await EnvironmentContainer.Instance.SaveHashAsync(HierarchialData.Where(p => p.HasChildren).ToList(), _cts.Token).ConfigureAwait(false);

            if (result)
            {
                InteractionService.ShowInformationMessageBox(Application.Current.TryFindResource("SuccessfullySaved").ToString());
            }
            else
            {
                InteractionService.ShowErrorMessageBox(Application.Current.TryFindResource("SaveFailed").ToString());
            }
        }