예제 #1
0
 private void LoadStatement(int key)
 {
     try
     {
         IsBusy = true;
         CapitalServiceClient client = new CapitalServiceClient();
         client.GetStatementByIdCompleted += (s, e) =>
         {
             try
             {
                 if (e.Error == null)
                 {
                     if (e.Result != null)
                     {
                         Messenger.Default.Send(new StatementEditMessage { Statement = e.Result });
                         GoToView(new NavigationMessage()
                         {
                             Source = this.GetType().Assembly.ToString(),
                             Destination = "StatementViewer",
                             OnStack = false
                         });
                     }
                     else
                     {
                         GoToView(new NavigationMessage()
                         {
                             Source = this.GetType().Assembly.ToString(),
                             Destination = "Home",
                             OnStack = false
                         });
                     }
                 }
                 else
                     MessageBox.Show(e.Error.Message, "Error", MessageBoxButton.OK);
                 IsBusy = false;
                 popup.IsOpen = false;
             }
             catch
             {
                 IsBusy = false;
             }
         };
         client.GetStatementByIdAsync(User, key);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
     }
 }