public override void Initializer(IDocumentView <StorageFile, IRandomAccessStream> documentView
                                         , IQuickPadCommands <StorageFile, IRandomAccessStream> commands
                                         , IApplication <StorageFile, IRandomAccessStream> app)
        {
            App = app;

            commands.NewDocumentCommandBase.Executioner = NewDocument;
            commands.LoadCommandBase.Executioner        = LoadDocument;
            commands.SaveCommandBase.Executioner        = async documentViewModel => await SaveDocument(documentViewModel);

            commands.SaveAsCommandBase.Executioner = SaveAsDocument;
            commands.ExitCommandBase.Executioner   = ExitApplication;

            if (documentView.ViewModel == null)
            {
                documentView.ViewModel =
                    ServiceProvider.GetService <DocumentViewModel <StorageFile, IRandomAccessStream> >();
                documentView.ViewModel.Initialize = viewModel => viewModel.InitNewDocument();
            }
        }
Beispiel #2
0
        public DocumentViewModel(
            ILogger <DocumentViewModel <TStorageFile, TStream> > logger
            , IFindAndReplaceView <TStorageFile, TStream> findAndReplaceViewModel
            , IServiceProvider serviceProvider
            , SettingsViewModel <TStorageFile, TStream> settings
            , IDocumentViewModelStrings strings
            , IApplication <TStorageFile, TStream> app
            , IQuickPadCommands <TStorageFile, TStream> commands)
            : base(logger, app)
        {
            ServiceProvider         = serviceProvider;
            FindAndReplaceViewModel = findAndReplaceViewModel;

            Settings = settings;
            Commands = commands;

            RichTextDescription = strings.RichTextDescription;
            TextDescription     = strings.TextDescription;
            Untitled            = strings.Untitled;

            _timer = new Timer(AutoSaveTimer);
        }
 public abstract void Initializer(IDocumentView <TStorageFile, TStream> documentView,
                                  IQuickPadCommands <TStorageFile, TStream> commands
                                  , IApplication <TStorageFile, TStream> app);