public override async Task NewDocument(DocumentViewModel <StorageFile, IRandomAccessStream> documentViewModel)
        {
            var canceled = false;

            if (documentViewModel.Document.IsDirty)
            {
                var saved = await AskSaveDocument(documentViewModel, false);

                canceled = saved == SaveState.Canceled;
            }

            if (!canceled)
            {
                documentViewModel.Initialize = viewModel => viewModel.InitNewDocument();

                documentViewModel.Initialize(documentViewModel);

                Settings.Status("New document initialized.", TimeSpan.FromSeconds(10),
                                Verbosity.Debug);
            }
        }
Esempio n. 2
0
            private static async Task NewDocument(DocumentViewModel documentViewModel)
            {
                var canceled = false;

                if (documentViewModel.IsDirty)
                {
                    var saved = await AskSaveDocument(documentViewModel, false);

                    canceled = saved == SaveState.Canceled;
                }

                if (!canceled)
                {
                    documentViewModel.Initialize = async viewModel =>
                    { await viewModel.InitNewDocument(); };

                    documentViewModel.Initialize(documentViewModel);

                    Settings.Status("New document initialized.", TimeSpan.FromSeconds(10),
                                    Verbosity.Debug);
                }
            }