예제 #1
0
 private void OnOpenRecentAccountCommand(RecentAccountViewModel account)
 {
     try
     {
         Application.Repository.Open(account.Path);
         var createdRequests = UpdateStandingOrdersToCurrentMonth();
         Application.ActivateRequestmanagementPage(createdRequests);
     }
     catch (FileLockedException)
     {
         var message = string.Format(Properties.Resources.RecentAccountLockedFormat, account.Path);
         Application.WindowManager.ShowError(Properties.Resources.ErrorOpenRecentAccount, message);
     }
     catch (FileNotFoundException)
     {
         var message = string.Format(Properties.Resources.RecentAccountNotFoundFormat, account.Path);
         Application.WindowManager.ShowQuestion(Properties.Resources.ErrorOpenRecentAccount,
                                                message,
                                                () =>
         {
             Application.ApplicationContext.DeleteRecentAccountInformation(account.Path);
             _accounts.Remove(account);
         }, () => { });
     }
     catch (Exception ex)
     {
         var message = string.Format(Properties.Resources.RecentAccountUnexpectedErrorFormat, ex.Message);
         Application.WindowManager.ShowError(Properties.Resources.ErrorOpenRecentAccount, message);
     }
 }
예제 #2
0
        private void OnOpenAccountCommand()
        {
            string filePath = string.Empty;

            try
            {
                filePath = Application.WindowManager.ShowOpenFileDialog(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Properties.Resources.AccountManagementFilterOpenAccount);
                if (string.IsNullOrEmpty(filePath))
                {
                    return;
                }
                Application.Repository.Open(filePath);
                var createdRequests = UpdateStandingOrdersToCurrentMonth();
                Application.ActivateRequestmanagementPage(createdRequests);
            }
            catch (FileLockedException)
            {
                var message = string.Format(Properties.Resources.RecentAccountLockedFormat, filePath);
                Application.WindowManager.ShowError(Properties.Resources.ErrorOpenRecentAccount, message);
            }
            catch (Exception ex)
            {
                var message = string.Format(Properties.Resources.RecentAccountUnexpectedErrorFormat, ex.Message);
                Application.WindowManager.ShowError(Properties.Resources.ErrorOpenRecentAccount, message);
            }
        }
예제 #3
0
 private void OnCreateNewAccountCommand()
 {
     ExecuteWithErrorHandling(() =>
     {
         Application.Repository.Create(NewAccountFilePath, NewAccountNameProperty.Value);
         NewAccountNameProperty.Value = string.Empty;
         NewAccountFilePath           = string.Empty;
         Application.ActivateRequestmanagementPage(null);
     });
 }