Пример #1
0
        private void ExecuteClearAllCommand()
        {
            MouseService.SetBusyState();

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

            SetCurrentBusinessData();
            OnPropertyChanged(nameof(HierarchialData));
            OnPropertyChanged(nameof(CollectionView));
        }
Пример #2
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);
        }
Пример #3
0
        private bool CanExecuteSaveCommand()
        {
            if (HierarchialData == null || HierarchialData.Count == 0)
            {
                return(false);
            }

            var visibleList = HierarchialData.Where(p => p.HasChildren).ToList();

            if (visibleList.Count == 0)
            {
                return(false);
            }

            if (visibleList.SelectMany(p => p.Children).Where(p => !string.IsNullOrWhiteSpace((p.Data as WinMdChecksumData)?.Hash)).ToList().Count == 0)
            {
                return(false);
            }

            return(_currentStatusbarState != EStatusbarState.Busy);
        }
Пример #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());
            }
        }