示例#1
0
        public StandardEngine(
            ISettingsManager settingsManager,
            IBranchManager branchManager,
            ICommandLineManager commandLineManager,
            IBannerManager bannerManager,
            IAppearanceManager appearanceManager,
            IErrorManager errorManager,
            IDialogsManager dialogsManager,
            IHelpManager helpManager,
            IAdvancedMenuManager advancedMenuManager,
            IEndpointManager endpointManager
            )
        {
            SettingsManager = settingsManager;
            BranchManager = branchManager;
            BannerManager = bannerManager;
            AppearanceManager = appearanceManager;
            CommandLineManager = commandLineManager;
            ErrorManager = errorManager;
            DialogsManager = dialogsManager;
            HelpManager = helpManager;
            AdvancedMenuManager = advancedMenuManager;
            EndpointManager = endpointManager;

            Identifier = Guid.NewGuid();
        }
示例#2
0
        public MainWindowViewModel(
            IDialogsManager dialogsManager,
            IExcelToPdfConverter excelToPdfConverter)
        {
            FilesToConvertToPdf  = new ObservableCollection <ExcelFileInfos>();
            _dialogManager       = dialogsManager ?? throw new ArgumentNullException(nameof(dialogsManager));
            _excelToPdfConverter = excelToPdfConverter ?? throw new ArgumentNullException(nameof(excelToPdfConverter));

            SelectFilesToConvertToPdfCommand = new RelayCommand(
                () =>
            {
                var filesToConvertToPdf = _dialogManager.SelectExcelFilesToConvertToPdf();
                if (filesToConvertToPdf == null)
                {
                    return;
                }

                foreach (var filePath in filesToConvertToPdf)
                {
                    FilesToConvertToPdf.Add(new ExcelFileInfos(filePath));
                }
            },
                () => ProgressBarVisibility != Visibility.Visible);

            ConvertToPdfCommand = new RelayCommand(
                async() =>
            {
                try
                {
                    ProgressBarVisibility = Visibility.Visible;
                    await _excelToPdfConverter.ConvertToPdf(FilesToConvertToPdf);
                    _dialogManager.ShowInformation("Operation completed");
                }
                catch (Exception ex)
                {
                    _dialogManager.ShowError(ex.Message);
                }
                finally
                {
                    ProgressBarVisibility = Visibility.Hidden;
                }
            },
                () => FilesToConvertToPdf.Any() && ProgressBarVisibility != Visibility.Visible);

            RestartCommand = new RelayCommand(
                () =>
            {
                FilesToConvertToPdf.Clear();
                ProgressBarVisibility = Visibility.Collapsed;
            },
                () => FilesToConvertToPdf.Any() && ProgressBarVisibility != Visibility.Visible);
        }
 public BorderlessChildDialogModel(IDialogsManager dialogsManager, IBannerManager bannerManager, IAppearanceManager appearanceManager)
     : base(dialogsManager, bannerManager, appearanceManager)
 {
     ShowInTaskbar = false;
 }
 public BorderedChildDialogModel(IDialogsManager dialogsManager, IBannerManager bannerManager, IAppearanceManager appearanceManager)
     : base(dialogsManager, bannerManager, appearanceManager)
 {
     ShowInTaskbar = false;
     WindowStyle = WindowStyle.ToolWindow;
 }
 public BorderlessDialogModel(IDialogsManager dialogsManager, IBannerManager bannerManager, IAppearanceManager appearanceManager)
     : base(dialogsManager, bannerManager, appearanceManager, new BorderlessWindow())
 {
     ShowInTaskbar = true;
     SuppressCloseQuestion = true;
 }
示例#6
0
        }                                                // TODO: finché non è completato non mostrare la form

        public MainWindowViewModel(
            ITagsRepository tagsRepository,
            IMoneyTransactionsImporter moneyTransactionsImporter,
            IImportingRules importingRules,
            IDialogsManager dialogsManager,
            INavigator navigator)
        {
            _tagsRepository            = tagsRepository ?? throw new ArgumentNullException(nameof(tagsRepository));
            _moneyTransactionsImporter = moneyTransactionsImporter ?? throw new ArgumentNullException(nameof(moneyTransactionsImporter));
            _importingRules            = importingRules ?? throw new ArgumentNullException(nameof(importingRules));
            _dialogsManager            = dialogsManager ?? throw new ArgumentNullException(nameof(dialogsManager));
            _navigator = navigator ?? throw new ArgumentNullException(nameof(navigator));

            MoneyTransactions = new ObservableCollection <MoneyTransaction>();
            ParseBPMCommand   = new RelayCommand(ImportBPMCommandMethod);
            INGCommand        = new RelayCommand(ImportINGCommandMethod);

            ExitApplicationCommand = new RelayCommand(() => System.Windows.Application.Current.Shutdown());
            ImportAllCommand       = new RelayCommand(ImportAllMethod, () => MoneyTransactions.Any() && !MoneyTransactions.Any(m => !m.Tags.Any()));
            ClearAllCommand        = new RelayCommand(() => MoneyTransactions.Clear(), () => MoneyTransactions.Any());

            ShowAnalysisCommand = new RelayCommand(() => _navigator.ShowFormAnalysisWindow());

            AddTagToSelectedTransaction = new RelayCommand(
                AddTagToSelectedTransactionMethod,
                () =>
            {
                if (SelectedTransaction == null)
                {
                    return(false);
                }

                if (SelectedTagListTag == null)
                {
                    return(false);
                }

                if (SelectedTransaction.Tags.Contains(SelectedTagListTag))
                {
                    return(false);
                }

                return(true);
            });

            RemoveTagFromSelectedTransaction = new RelayCommand(
                RemoveTagFromSelectedTransactionMethod,
                () =>
            {
                if (SelectedTransaction == null)
                {
                    return(false);
                }

                if (SelectedTransactionTag == null)
                {
                    return(false);
                }

                if (!SelectedTransaction.Tags.Contains(SelectedTransactionTag))
                {
                    return(false);
                }

                return(true);
            });

            Initialization = InitializeAsync();
        }
示例#7
0
 public BorderedDialogModel(IDialogsManager dialogsManager, IBannerManager bannerManager, IAppearanceManager appearanceManager)
     : base(dialogsManager, bannerManager, appearanceManager, new StarkBorderedWindow())
 {
     ShowInTaskbar = true;
     WindowStyle = WindowStyle.SingleBorderWindow;
 }