Beispiel #1
0
 private void NewBusiness()
 {
     try
     {
         formBusyIndicator.IsBusy = true;
         PartyService.Business business     = new PartyService.Business();
         BusinessForm          businessForm = new BusinessForm();
         businessForm.DataContext = business;
         SetContent(businessForm);
     }
     catch (Exception ex)
     {
         app.ShowError(ex.Message);
     }
     finally
     {
         formBusyIndicator.IsBusy = false;
     }
 }
Beispiel #2
0
        void PartyLoadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            try
            {
                CheckForErrors(e);

                string returnTypeName = app.GetBusinessObjectType(e.Result);

                switch (returnTypeName)
                {
                case "Business":
                    PartyService.Business bus          = app.LoadBusinessObject <PartyService.Business>(e.Result);
                    BusinessForm          businessForm = new BusinessForm();
                    businessForm.DataContext = bus;
                    SetContent(businessForm);
                    break;

                case "Person":
                    PartyService.Person per        = app.LoadBusinessObject <PartyService.Person>(e.Result);
                    PersonForm          personForm = new PersonForm();
                    personForm.DataContext = per;
                    SetContent(personForm);
                    break;

                case "Error":
                    PartyService.Error err = app.LoadBusinessObject <PartyService.Error>(e.Result);
                    throw (new Exception(err.Message));

                default:
                    throw (new Exception("Unrecognised object type in server response"));
                }
            }
            catch (Exception ex)
            {
                app.ShowError(ex.Message);
            }
            finally
            {
                formBusyIndicator.IsBusy = false;
            }
        }
        void PartyLoadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            try
            {
                CheckForErrors(e);

                string returnTypeName = app.GetBusinessObjectType(e.Result);

                switch (returnTypeName)
                {
                    case "Business":
                        PartyService.Business bus = app.LoadBusinessObject<PartyService.Business>(e.Result);
                        BusinessForm businessForm = new BusinessForm();
                        businessForm.DataContext = bus;
                        SetContent(businessForm);
                        break;
                    case "Person":
                        PartyService.Person per = app.LoadBusinessObject<PartyService.Person>(e.Result);
                        PersonForm personForm = new PersonForm();
                        personForm.DataContext = per;
                        SetContent(personForm);
                        break;
                    case "Error":
                        PartyService.Error err = app.LoadBusinessObject<PartyService.Error>(e.Result);
                        throw (new Exception(err.Message));
                    default:
                        throw (new Exception("Unrecognised object type in server response"));
                }

            }
            catch (Exception ex)
            {
                app.ShowError(ex.Message);
            }
            finally
            {
                formBusyIndicator.IsBusy = false;
            }
        }
 private void NewBusiness()
 {
     try
     {
         formBusyIndicator.IsBusy = true;
         PartyService.Business business = new PartyService.Business();
         BusinessForm businessForm = new BusinessForm();
         businessForm.DataContext = business;
         SetContent(businessForm);
     }
     catch (Exception ex)
     {
         app.ShowError(ex.Message);
     }
     finally
     {
         formBusyIndicator.IsBusy = false;
     }
 }