public OpenFileViewModel(IEventAggregator eventAggragator, IRecentFilesService recentFilesService, IRegionManager regionManager)
        {
            RecentFolders = recentFilesService.RecentFolders;

            NavigateCommand = new DelegateCommand <string>(Navigate);

            this.eventAggragator = eventAggragator;
            this.regionManager   = regionManager;
        }
		public MainPresenter(
			ISettingsService settingsService, IRecentFilesService recentFilesService,
			IDataService dataService, ITaskService taskService)
		{
			this.settingsService = settingsService;
			this.recentFilesService = recentFilesService;
			this.dataService = dataService;
			this.taskService = taskService;
		}
        public ShellViewModel(IEventAggregator eventAggragator, IDialogService dialogService, IMessageBoxService messageBoxService, IFontService fontService, IStyleService styleService, IRecentFilesService recentFilesService)
        {
            this.eventAggragator    = eventAggragator;
            this.dialogService      = dialogService;
            this.messageBoxService  = messageBoxService;
            this.recentFilesService = recentFilesService;
            this.styleService       = styleService;

            this.FontSizes   = fontService.GetFontSizes();
            this.FontNames   = fontService.GetFontNames();
            this.TableStyles = styleService.GetAllTableStyles();
            this.CellStyles  = styleService.GetAllCellStyles();
            this.GoodBadAndNeutralCellStyles = styleService.GetGoodBadAndNeutralCellStyles();
            this.DataAndModelCellStyles      = styleService.GetDataAndModelCellStyles();
            this.TitlesAndHeadingsCellStyles = styleService.GetTitlesAndHeadingsCellStyles();
            this.NumberFormatCellStyles      = styleService.GetNumberFormatCellStyles();
            this.ThemedCellStyles            = styleService.GetThemedCellStyles();

            this.IsUiPartEnabled = false;
            this.SetTitle();

            this.SelectedBackstageMenuItem = ShellParameters.NewTabName;

            // TFS 191000 - Workaround: do not initialize the value of the IsBackstageOpen property to true before the ribbon is loaded
            //this.IsBackstageOpened = true;

            this.ZoomLevel = 100;

            this.recentFilesService.SetRepositories(Properties.Settings.Default, p => Properties.Settings.Default.RecentFilesRepo, p => Properties.Settings.Default.RecentFoldersRepo);

            this.eventAggragator.GetEvent <FileOpenedEvent>().Subscribe(OnFileLoaded);
            this.eventAggragator.GetEvent <FileSavedEvent>().Subscribe(OnFileSaved);
            this.eventAggragator.GetEvent <NewDocumentEvent>().Subscribe(OnNewDocumentEvent);
            this.eventAggragator.GetEvent <TableAddedEvent>().Subscribe(OnTableAddedEvent);
            this.eventAggragator.GetEvent <CustomZoomLevelChangedEvent>().Subscribe(OnCustomZoomLevelChangedEvent);
            this.eventAggragator.GetEvent <PasswordToOpenEnteredEvent>().Subscribe(OnPasswordToOpenEnteredEvent);
            this.eventAggragator.GetEvent <PasswordToModifyEnteredEvent>().Subscribe(OnPasswordToModifyEnteredEvent);

            //Commands
            this.ShowNumberSettingsDialogCommand    = new DelegateCommand <object>(ExecuteShowNumberSettingsDialog);
            this.ShowFontSettingsDialogCommand      = new DelegateCommand <object>(ExecuteShowFontSettingsDialog);
            this.ShowFillSettingsDialogCommand      = new DelegateCommand <object>(ExecuteShowFillSettingsDialog);
            this.ShowAlignmnetSettingsDialogCommand = new DelegateCommand <object>(ExecuteShowAlignmnetSettingsDialog);
            this.ShowDimensionDialogCommand         = new DelegateCommand <DimensionDialogMode?>(ExecuteShowDimensionDialog);
            this.CloseDocumentCommand            = new DelegateCommand(ExecuteCloseDocument);
            this.FormatAsTableCommand            = new DelegateCommand <string>(ExecuteFormatAsTable);
            this.SaveDocumentCommand             = new DelegateCommand(ExecuteSaveDocument);
            this.CreateNewDocumentCommand        = new DelegateCommand <string>(CreateNewDocument);
            this.ShowZoomDialogCommand           = new DelegateCommand(ExecuteShowZoomDialog);
            this.ShowDataValidationDialogCommand = new DelegateCommand(ExecuteShowDataValidationDialog);

            this.PropertyChanged += OnPropertyChanged;
        }
Exemple #4
0
        public ShellViewModel(IEventAggregator eventAggragator, IDialogService dialogService, IMessageBoxService messageBoxService, IFontService fontService, IRecentFilesService recentFilesService)
        {
            this.SetTitle();

            this.eventAggragator    = eventAggragator;
            this.dialogService      = dialogService;
            this.messageBoxService  = messageBoxService;
            this.recentFilesService = recentFilesService;
            this.fontService        = fontService;

            this.FontSizes       = fontService.GetFontSizes();
            this.FontNames       = fontService.GetFontNames();
            this.HighlightColors = fontService.GetHighlightColors();

            this.ClearDataProperties();
            this.DeactivateAdaptersRefreshTrigger();

            this.DelayAfterFirstEdit = TimeSpan.FromSeconds(10);
            this.DelayAfterLastEdit  = TimeSpan.FromSeconds(10);
            this.ZoomLevel           = 1;
            this.FontColor           = Colors.Red;
            this.TextHighlightColor  = Colors.Yellow;

            this.DocumentStatus            = IgWordDocumentStatus.NoDocumentLoaded;
            this.SelectedBackstageMenuItem = "New";

            // TFS 190054 - Workaround: do not initialize the value of the IsBackstageOpen property to true before the ribbon is loaded
            //this.IsBackstageOpened = true;

            this.recentFilesService.SetRepositories(Properties.Settings.Default, p => Properties.Settings.Default.RecentFilesRepo, p => Properties.Settings.Default.RecentFoldersRepo);

            //Subscribe to events
            this.eventAggragator.GetEvent <FileOpenedEvent>().Subscribe(OnFileLoaded);
            this.eventAggragator.GetEvent <FileSavedEvent>().Subscribe(OnFileSaved);
            this.eventAggragator.GetEvent <NewDocumentEvent>().Subscribe(OnNewDocumentEvent);
            this.eventAggragator.GetEvent <CharacterSettingsUpdatedEvent>().Subscribe(OnCharacterSettingsUpdatedEvent);
            this.eventAggragator.GetEvent <ParagraphSettingsUpdatedEvent>().Subscribe(OnParagraphSettingsUpdatedEvent);

            //Commands
            SaveDocumentCommand            = new DelegateCommand(ExecuteSaveDocument);
            CloseDocumentCommand           = new DelegateCommand(ExecuteCloseDocument);
            CreateNewDocumentCommand       = new DelegateCommand <string>(CreateNewDocument);
            ShowFontDialogCommand          = new DelegateCommand <RichTextDocument>(ExecuteShowFontDialog, CanExecuteShowFormattingDialog);
            ShowParagraphDialogCommand     = new DelegateCommand <RichTextDocument>(ExecuteShowParagraphDialog, CanExecuteShowFormattingDialog);
            ShowFindDialogCommand          = new DelegateCommand <FindReplaceManager>(ExecuteShowFindDialog, CanExecuteShowFindReplaceDialog);
            ShowReplaceDialogCommand       = new DelegateCommand <FindReplaceManager>(ExecuteShowReplaceDialog, CanExecuteShowFindReplaceDialog);
            ShowHyperlinkDialogCommand     = new DelegateCommand <RichTextDocument>(ExecuteShowHyperlinkDialog, CanExecuteShowFormattingDialog);
            ShowInsertTableDialogCommand   = new DelegateCommand <RichTextDocument>(ExecuteShowInsertTableDialog, CanExecuteShowFormattingDialog);
            ShowInsertPictureDialogCommand = new DelegateCommand <RichTextDocument>(ExecuteShowInsertPictureDialog, CanExecuteShowFormattingDialog);
            ResetZoomLevelCommand          = new DelegateCommand(ExecuteResetZoomLevel);
            IncreaseZoomLevelCommand       = new DelegateCommand(ExecuteIncreaseZoomLevel);
            DecreaseZoomLevelCommand       = new DelegateCommand(ExecuteDecreaseZoomLevel);
        }
        public RecentFoldersViewModel(IEventAggregator eventAggragator, IRecentFilesService recentFilesService, IDialogService dialogService)
        {
            this.eventAggragator    = eventAggragator;
            this.dialogService      = dialogService;
            this.recentFilesService = recentFilesService;

            this.recentFilesService.SetRepositories(Properties.Settings.Default, p => Properties.Settings.Default.RecentFilesRepo, p => Properties.Settings.Default.RecentFoldersRepo);

            this.recentFilesService.PropertyChanged += (s, a) =>
            {
                if (a.PropertyName == "RecentFolders")
                {
                    this.RecentFolders = this.recentFilesService.RecentFolders;
                }
            };

            this.RecentFolders = this.recentFilesService.RecentFolders;

            OpenFileCommand = new DelegateCommand <string>(OpenFile);
        }