示例#1
0
        private async void AddEntry(string passwd)
        {
            if (!KeyProvider.CorrectPassword(passwd))
            {
                RaiseAddEntryFailed();
            }
            var newEntry = new JournalEntry(Content, DateTime.Now);
            var task     = Task.Factory.StartNew(() =>
            {
                _entriesProvider.AddEntry(newEntry, passwd);
            });

            try
            {
                await task;
                RaiseAddEntryCompleted();
            }
            catch (Exception)
            {
                RaiseAddEntryFailed();
            }
        }