Exemple #1
0
        private void buttonSave_Clicked(object sender, EventArgs e)
        {
            try
            {
                serviceDocument.StartWidget = listBoxStartWidget.SelectedItem as Widget;
                if (serviceDocument.StartWidget == null)
                {
                    Dialog.ShowErrorDialog(SilverlightVisualDesigners.Properties.Resources.InvalidCustomService, SilverlightVisualDesigners.Properties.Resources.NoStartForm, this.LayoutRoot);
                    return;
                }

                Collection <Error> errors = serviceDocument.CheckDesignerLogic();
                if (errors.Count > 0)
                {
                    string message = String.Empty;
                    foreach (Error error in errors)
                    {
                        message = message + error.Name + ":" + error.Description + "\n";
                    }
                    Dialog.ShowErrorDialog(SilverlightVisualDesigners.Properties.Resources.InvalidCustomService, message, this.LayoutRoot);
                    return;
                }

                if (!serviceDocument.CheckValidPathForms())
                {
                    Dialog.ShowErrorDialog(SilverlightVisualDesigners.Properties.Resources.Error, SilverlightVisualDesigners.Properties.Resources.InvalidServicePath, this.LayoutRoot);
                    return;
                }

                // Llamar al Servicio Web.
                (App.Current as App).BeginSaveCustomerService(this.serviceDocument, new SaveCustomerServiceCallback(EndSaveCustomerService));
            }
            catch (NullReferenceException error)
            {
                Dialog.ShowErrorDialog(SilverlightVisualDesigners.Properties.Resources.UnhandledError, error.Message, this.LayoutRoot);
            }
            catch (Exception error)
            {
                Dialog.ShowErrorDialog(SilverlightVisualDesigners.Properties.Resources.SaveError, error.Message, this.LayoutRoot);
            }
        }