private void buttonDataInput_Clicked(object sender, EventArgs e) { try { isMakeConnectionAction = false; EnterSingleDataFormSilverlight singleDataSilverlight = new EnterSingleDataFormSilverlight(); singleDataSilverlight.ChangeTitle(SilverlightVisualDesigners.Properties.Resources.EnterSingleDataFormName + " " + numberOfForms); numberOfForms++; Builder(singleDataSilverlight); serviceDocument.AddWidget(singleDataSilverlight.EnterSingleDataForm); } 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); } }
private void LoadServiceData(ServiceDocument serviceDocument) { Dictionary <Component, IConnection> widgetEquivalences = new Dictionary <Component, IConnection>(); foreach (Component component in serviceDocument.Components) { Type type = component.GetType(); switch (type.Name) { case "DataSource": DataSource dataSource = component as DataSource; DataSourceSilverlight dataSourceSilverlight = new DataSourceSilverlight(dataSource); Builder(dataSourceSilverlight); widgetEquivalences.Add(dataSource, dataSourceSilverlight); break; case "ListForm": ListForm listForm = component as ListForm; ListFormSilverlight listFormSilverlight = new ListFormSilverlight(listForm); Builder(listFormSilverlight); widgetEquivalences.Add(listForm, listFormSilverlight); break; case "ShowDataForm": ShowDataForm showDataForm = component as ShowDataForm; ShowDataFormSilverlight showDataFormSilverlight = new ShowDataFormSilverlight(showDataForm); Builder(showDataFormSilverlight); widgetEquivalences.Add(showDataForm, showDataFormSilverlight); break; case "EnterSingleDataForm": EnterSingleDataForm enterSingleDataForm = component as EnterSingleDataForm; EnterSingleDataFormSilverlight singleDataSilverlight = new EnterSingleDataFormSilverlight(enterSingleDataForm); Builder(singleDataSilverlight); widgetEquivalences.Add(enterSingleDataForm, singleDataSilverlight); break; case "MenuForm": MenuForm menuForm = component as MenuForm; MenuFormSilverlight menuSilverlight = new MenuFormSilverlight(menuForm); Builder(menuSilverlight); widgetEquivalences.Add(menuForm, menuSilverlight); foreach (MenuItemSilverlight menuItemSilverlight in menuSilverlight.MenuItemsSilverlight) { widgetEquivalences.Add(menuItemSilverlight.FormMenuItem, menuItemSilverlight); } break; default: throw new ArgumentException(SilverlightVisualDesigners.Properties.Resources.InvalidTypeOfWidget); } } this.canvasDraw.UpdateLayout(); foreach (Connection connection in serviceDocument.Connections) { IConnection from = widgetEquivalences[connection.Source.Parent]; IConnection target = widgetEquivalences[connection.Target.Parent]; ConnectionSilverlight connectionSilverlight = new ConnectionSilverlight(from, target); connectionSilverlight.Connection = connection; AddRelation(connectionSilverlight); } }
/// <summary> /// Crea un EditDataSourceControl basado en datos de un EnterSingleDataForm. /// </summary> /// <param name="singleDataSilverlight">EnterSingleDataForm que se usará para crear.</param> public EditEnterSingleDataFormControl(EnterSingleDataFormSilverlight singleDataSilverlight) { // Inicializar variables. InitializeComponent(); this.enterSingleDataFormSilverlight = singleDataSilverlight; }