示例#1
0
        public MailViewModel()
        {
            SelectFolderCommand  = new AsyncDelegateCommand(GetMailHeaders);
            SelectMailCommand    = new AsyncDelegateCommand(GetMailBody);
            DeleteMailCommand    = new AsyncDelegateCommand(DeleteMail);
            DeleteAllMailCommand = new AsyncDelegateCommand(DeleteAllMail);
            RefreshCommand       = new AsyncDelegateCommand(Refresh);
            NewMailCommand       = new AsyncDelegateCommand(NewMail);
            SendMailCommand      = new AsyncDelegateCommand(SendMail);

            using (new BusyIndicator())
            {
                try
                {
                    _mailbox = Mailbox.GetInstance();
                    Folders  = _mailbox.GetFolders();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Произошла ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }