/// <summary> /// /// </summary> /// <param name="tempComponent"></param> /// <returns></returns> public static Error VerifySingleOutputConnection(Component tempComponent) { if (tempComponent.OutputConnectionPoint.Connection.Count > 0) { EnterSingleDataForm inputForm = tempComponent as EnterSingleDataForm; if (inputForm != null) { bool haveOtherForm = CheckInputFormToOtherFormConnection(inputForm); bool haveStorage = CheckInputFormToStorageConnection(inputForm); if (haveStorage && haveOtherForm) { return(new Error("", "", LogicalLibrary.Properties.Resources.InputDataConnections)); } return(null); } DataSource dataSource = tempComponent as DataSource; if (dataSource == null) { return(new Error("", "", LogicalLibrary.Properties.Resources.FormOutputConnection)); } } return(null); }
public Collection <Error> IsPossibleSetDataContext(LogicalLibrary.Component source, LogicalLibrary.Component target) { Collection <Error> errors = new Collection <Error>(); Widget sourceWidget = source as Widget; FormMenuItem formMenuItem = source as FormMenuItem; EnterSingleDataForm enterSingleDataForm = source as EnterSingleDataForm; if (formMenuItem != null) { sourceWidget = activeWidget; } if (sourceWidget.OutputDataContext == null && (formMenuItem == null) && (enterSingleDataForm == null)) { errors.Add(new Error("", "", LogicalLibrary.Properties.Resources.NoOutputContext)); } if (sourceWidget.OutputDataContext != null && target.InputDataContext != null) { if (!(target is DataSource)) { if (sourceWidget.OutputDataContext.Name != target.InputDataContext.Name) { errors.Add(new Error("", "", LogicalLibrary.Properties.Resources.DifferentContext)); } } } return(errors); }
/// <summary> /// Crea una instancia de EnterSingleDataFormSilverlight basado en un enterSingleDataForm. /// </summary> /// <param name="enterSingleDataForm">EnterSingleDataForm relacionado con un enterSingleDataFormSilverlight.</param> public EnterSingleDataFormSilverlight(EnterSingleDataForm enterSingleDataForm) { // Inicializar variables. InitializeComponent(); EnterSingleDataForm = enterSingleDataForm; this.DataContext = enterSingleDataForm; AddMenu(canvasWidget); }
/// <summary> /// Crea una instancia de EnterSingleDataFormSilverlight. /// </summary> public EnterSingleDataFormSilverlight() { // Inicializar variables. InitializeComponent(); enterSingleDataForm = new EnterSingleDataForm(); enterSingleDataForm.InputConnectionPoint = new ConnectionPoint(ConnectionPointType.Input); enterSingleDataForm.InputConnectionPoint.Parent = enterSingleDataForm; enterSingleDataForm.OutputConnectionPoint = new ConnectionPoint(ConnectionPointType.Output); enterSingleDataForm.OutputConnectionPoint.Parent = enterSingleDataForm; this.DataContext = enterSingleDataForm; AddMenu(canvasWidget); }
private int CheckValidPathComponent(Component component, List <int> scope) { EnterSingleDataForm inputForm = component as EnterSingleDataForm; MenuForm menuForm = component as MenuForm; if (scope.Contains(component.GetHashCode())) { return(0); } scope.Add(component.GetHashCode()); if (menuForm != null) { int menuchildCount = 0; foreach (FormMenuItem menuItem in menuForm.MenuItems) { if (menuItem.OutputConnectionPoint.Connection.Count > 0) { menuchildCount += CheckValidPathComponent(menuItem.OutputConnectionPoint.Connection[0].Target.Parent, scope); } } return(menuchildCount + 1); } if (component.OutputConnectionPoint.Connection.Count == 0) { return(1); } if (inputForm != null) { foreach (Connection con in inputForm.OutputConnectionPoint.Connection) { if (!(con.Target.Parent is DataSource)) { return(CheckValidPathComponent(con.Target.Parent, scope) + 1); } } return(1); } return(CheckValidPathComponent(component.OutputConnectionPoint.Connection[0].Target.Parent, scope) + 1); }
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); } }
public Collection <Error> CheckDesignerLogic() { List <string> formTitle = new List <string>(); Collection <Error> errors = new Collection <Error>(); foreach (Widget component in Components) { DataSource dataSource = component as DataSource; EnterSingleDataForm enterSingleDataForm = component as EnterSingleDataForm; MenuForm menuDataForm = component as MenuForm; ShowDataForm showDataForm = component as ShowDataForm; // Verifica si el título esta repetido. if (formTitle.Contains(component.Title)) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.TitleRepited + component.Title)); } else { formTitle.Add(component.Title); } if (dataSource != null) { if (component.OutputDataContext == null || dataSource.RelatedTable.IsStorage) { if (component.InputConnectionPoint.Connection.Count == 0) { errors.Add(new Error(LogicalLibrary.Properties.Resources.DataStorageError, "", LogicalLibrary.Properties.Resources.NoInputToStorage + " " + dataSource.Name)); } } else if (component.OutputConnectionPoint.Connection.Count == 0) { errors.Add(new Error(LogicalLibrary.Properties.Resources.DataSourceError, "", LogicalLibrary.Properties.Resources.NoDataSourceConnection + " " + dataSource.Name)); } } else if (component is ListForm) { if (component.InputDataContext == null) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.NoInputContextListForm + " " + component.Title)); } if (component.OutputDataContext == null) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.NoOutputContextListForm + " " + component.Title)); } } else if (menuDataForm != null) { if (menuDataForm.MenuItems.Count == 0) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.NoMenuOptionItem + " " + component.Title)); } foreach (FormMenuItem menuItem in menuDataForm.MenuItems) { if (menuItem.OutputConnectionPoint.Connection.Count == 0) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.NoMenuOptionItemTarget + " " + component.Title)); } } } else if (enterSingleDataForm != null) { if (String.IsNullOrEmpty(enterSingleDataForm.DescriptiveText) || String.IsNullOrEmpty(enterSingleDataForm.DataName)) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.InputFormNoEdited + " " + component.Title)); } bool haveStorage = false; foreach (Connection con in enterSingleDataForm.OutputConnectionPoint.Connection) { if (con.Target.Parent is DataSource) { haveStorage = true; } } if (!haveStorage) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.NoStorageForInputForm + " " + component.Title)); } } else if (showDataForm != null) { if (component.InputDataContext == null) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.NoInputContextShowForm + " " + component.Title)); } if (component.OutputDataContext == null) { errors.Add(new Error(LogicalLibrary.Properties.Resources.FormError, "", LogicalLibrary.Properties.Resources.NoOutputContextShowForm + " " + component.Title)); } } } return(errors); }