Beispiel #1
0
        private async Task DoNewAsync()
        {
            await SafeExecutionContext.ExecuteAsync(
                this,
                async() =>
            {
                //var newNoteForm = new TextInputBox(Resources.NewNoteTitleText,
                //    Resources.NewNotePrompt, new[]
                //    {
                //        new Tuple<Func<string, bool>, string>(string.IsNullOrEmpty, Resources.TitleRequired),
                //        new Tuple<Func<string, bool>, string>(this.ExistingNotesTitle.Contains,
                //            Resources.TitleExists)
                //    });

                var newNoteForm = new FrmCreateNote(Resources.NewNotePrompt, this.styleManager, this.settings, new[]
                {
                    new Tuple <Func <string, bool>, string>(string.IsNullOrEmpty, Resources.TitleRequired),
                    new Tuple <Func <string, bool>, string>(this.ExistingNotesTitle.Contains,
                                                            Resources.TitleExists)
                });

                if (newNoteForm.ShowDialog() == DialogResult.OK)
                {
                    var title = newNoteForm.SelectedTitle;
                    var note  =
                        new Note
                    {
                        ID            = Guid.Empty,
                        Title         = title,
                        Content       = newNoteForm.SelectedEmptyHtml,
                        DatePublished = DateTime.UtcNow
                    };
                    await this.ImportNote(note);
                }
            });
        }
Beispiel #2
0
        private async Task DoNewAsync()
        {
            await SafeExecutionContext.ExecuteAsync(
                this,
                async () =>
                {
                    //var newNoteForm = new TextInputBox(Resources.NewNoteTitleText,
                    //    Resources.NewNotePrompt, new[]
                    //    {
                    //        new Tuple<Func<string, bool>, string>(string.IsNullOrEmpty, Resources.TitleRequired),
                    //        new Tuple<Func<string, bool>, string>(this.ExistingNotesTitle.Contains,
                    //            Resources.TitleExists)
                    //    });

                    var newNoteForm = new FrmCreateNote(Resources.NewNotePrompt, this.styleManager, this.settings, new[]
                    {
                        new Tuple<Func<string, bool>, string>(string.IsNullOrEmpty, Resources.TitleRequired),
                        new Tuple<Func<string, bool>, string>(this.ExistingNotesTitle.Contains,
                            Resources.TitleExists)
                    });

                    if (newNoteForm.ShowDialog() == DialogResult.OK)
                    {
                        var title = newNoteForm.SelectedTitle;
                        var note =
                            new Note
                            {
                                ID = Guid.Empty,
                                Title = title,
                                Content = newNoteForm.SelectedEmptyHtml,
                                DatePublished = DateTime.UtcNow
                            };
                        await this.ImportNote(note);
                    }
                });
        }