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; }
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 FontDialogViewModel(IEventAggregator eventAggragator, IFontService fontService) { this.Title = ResourceStrings.ResourceStrings.Dlg_Font_Title; this.IconSource = "pack://application:,,,/IgWord.Infrastructure;component/Images/Font.ico"; TextData = "Sample"; ComplexTextData = "عينة"; OkCommand = new DelegateCommand(ExecuteOk); CancelCommand = new DelegateCommand(ExecuteCancel); FontSizes = fontService.GetFontSizes(); FontFamilies = fontService.GetFontNames(); this.eventAggragator = eventAggragator; }
public FormatCellsDialogViewModel(IEventAggregator eventAggragator, IFontService fontService, IFormatsService formatsService) { this.Title = ResourceStrings.ResourceStrings.Text_FormatCells; this.IconSource = "pack://application:,,,/IgExcel.Infrastructure;component/Images/FormatCells.ico"; this.eventAggragator = eventAggragator; this.fontService = fontService; this.formatsService = formatsService; this.FontNames = fontService.GetFontNames(); this.FontSizes = fontService.GetFontSizes(); this.NumberFormats = formatsService.GetNumberFormats(); this.SelectedNumberFormatCategory = this.NumberFormats.FirstOrDefault(); this.modifiedProperties = new List <string>(); HookPropertyChanged(true); //Commands OkCommand = new DelegateCommand(ExecuteOk, CanExecuteOk); CancelCommand = new DelegateCommand(ExecuteCancel); ResetFontSettingsCommand = new DelegateCommand <bool?>(ExecuteResetFontSettings); }