private void loadVisualizationDesigner() { foreach (LogicalLibrary.Component component in tempComponents) { TemplateListItemWpf templateListItemWPF = component as TemplateListItemWpf; templateListItemWPF.Rectangle.Width = component.Width; templateListItemWPF.Rectangle.Height = component.Height; templateListItemWPF.MakeCanvas(); templateListItemWPF.ComponentPreviewMouseDown += new MouseButtonEventHandler(templateListItem_ComponentPreviewMouseDown); templateListFormDocument.AttachTemplateListItemEvents(templateListItemWPF); templateListFormDocument.AddCanvasToCanvasDraw(templateListItemWPF); } }
/// <summary> /// Funcion llamada cuando el boton agregar es presionado. Este metodo agrega un template list item a la lista de items a mostrar /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonAdd_Click(object sender, RoutedEventArgs e) { try { Field selectedField = listBoxFields.SelectedItem as Field; TemplateListItemWpf templateListItem = new TemplateListItemWpf(selectedField, FontName.Arial, PresentationLayer.ServerDesignerClasses.FontSize.Medium, selectedField.DataType); templateListItem.MakeCanvas(); templateListItem.ComponentPreviewMouseDown += new MouseButtonEventHandler(templateListItem_ComponentPreviewMouseDown); templateListFormDocument.AttachTemplateListItemEvents(templateListItem); tempComponents.Add(templateListItem); templateListFormDocument.AddCanvasToCanvasDraw(templateListItem); } catch (Exception error) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.UnhandledError + ": " + error.Message); } }