private void ShowLayoutEditor(ConceptUsecase useCase) { options = new Options(); options.ApplyButton.Click += (s1, e1) => { useCase.ArrangerToolbar.FullLayout(useCase.GetCurrentDisplay().Layout.Options()); }; var editor = new LayoutEditor(); editor.Dock = DockStyle.Fill; editor.SelectedObject = useCase.GetCurrentDisplay().Layout; editor.PropertyValueChanged += (s1, e1) => { useCase.DisplayStyleChanged?.Invoke(s1, new EventArgs <IStyle> (null)); }; options.SuspendLayout(); options.Controls.Remove(options.OptionList); options.OptionChanger = editor; options.ContentPanel.Size = editor.Size; options.ContentPanel.Controls.Add(editor); options.ClientSize = ControlSize(options).Size; options.ResumeLayout(true); Application.DoEvents(); options.ClientSize = ControlSize(options).Size; Application.DoEvents(); options.Show(); }
private void OnLayoutsNewMenuItemClick(object sender, RoutedEventArgs e) { LayoutEditor editor = new LayoutEditor(null, AddInfo); editor.DataContext = editor.Layout; this.AddTabItem(editor); }
void LayoutEditorTestharness_Loaded(object sender, RoutedEventArgs e) { layoutEditor = new LayoutEditor(); //layoutEditor.ContextMenuController.onEditLabware += ContextMenu_onEditLabware; UserControlContainer.Children.Add(layoutEditor); CreateTwoLabwares(); }
private void OnLeftButtonDown(ListBox listBox, Point pt) { TabItem tabitem = (TabItem)tabDynamic.SelectedItem; LayoutEditor layoutEditor = GetLayoutEditor(); if (layoutEditor == null) { return; } HitTestResult result = VisualTreeHelper.HitTest(listBox, pt); ListBoxItem lbi = VisualCommon.FindParent <ListBoxItem>(result.VisualHit); if (lbi == null) { return; } int index = listBox.ItemContainerGenerator.IndexFromContainer(lbi); if (index == -1) { return; } layoutEditor.SuggestCandidate((WareBase)listBox.Items[index]); }
public override void InitializeEditor(LayoutEditor editor, object value, object dataSource) { QParam param = dataSource as QParam; listSource = param.Query.Parameters; base.InitializeEditor(editor, value, dataSource); }
private TabItem AddTabItem(UserControl control) { if (control == null) { return(null); } // create new tab item TabItem tab = new TabItem(); // Set the Tag of the tab as the UID of the instrument tab.Tag = ((PipettorElement)control.DataContext).SaveName; tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate; // If a recipeEditor is added, subscribe its EditWare event if (control is LayoutEditor) { LayoutEditor layoutEditor = control as LayoutEditor; layoutEditor.EditWare += OnLayoutEditorEditWare; } control.Width = this.ActualWidth - 300; Grid grid = new Grid(); grid.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; grid.Children.Add(control); tab.Content = grid; // insert tab at most left position _tabItems.Insert(0, tab); tabDynamic.DataContext = null; tabDynamic.DataContext = _tabItems; tabDynamic.SelectedItem = tab; return(tab); }
void DisableDrawingLayoutEditor() { if (LayoutEditor != null) { LayoutEditor.DetouchFromViewerEvents(); LayoutEditor = null; } }
public IViewerObject AddNode(Microsoft.Msagl.Drawing.Node drawingNode) { Graph.AddNode(drawingNode); var vNode = GetOrCreateViewerNode(drawingNode); LayoutEditor.AttachLayoutChangeEvent(vNode); LayoutEditor.CleanObstacles(); return(vNode); }
private void OnCommandTabItemSelectionChanged(object sender, SelectionChangedEventArgs e) { System.Collections.IList items = e.AddedItems; if (items.Count > 0 && items[0] is TabItem) { TabItem tabitem = (TabItem)items[0]; LayoutEditor layoutEditor = ((Grid)tabitem.Content).Children[0] as LayoutEditor; } }
void InitDrawingLayoutEditor() { if (LayoutEditor == null) { LayoutEditor = new LayoutEditor(this); LayoutEditor.ChangeInUndoRedoList += DrawingLayoutEditor_ChangeInUndoRedoList; } undoButton.ImageIndex = (int)ImageEnum.UndoDisabled; redoButton.ImageIndex = (int)ImageEnum.RedoDisabled; }
protected override void InitControls() { if (editor == null) { editor = UIHelper.LoadLayoutEditor(PanelContext.Panel.EditInfo.UcLayout); editor.ID = "UxLayoutCtr"; phContainer.Controls.Clear(); phContainer.Controls.Add(editor); } editor.InitLayout(PanelContext); }
public override LayoutItem GetLayoutItem(LayoutEditor editor, LayoutItem parent) { var item = new LayoutItem(editor, parent, this); foreach (var container in Containers) { item.Contents.Add(container.GetLayoutItem(editor, item)); } return(item); }
public override LayoutItem GetLayoutItem(LayoutEditor editor, LayoutItem parent) { var item = new LayoutItem(editor, parent, this); foreach (var element in _elements) { item.Contents.Add(element.GetLayoutItem(editor, item)); } return(item); }
/// <summary> /// Tightly fit the bounding box around the graph /// </summary> public void FitGraphBoundingBox() { if (LayoutEditor != null) { if (Graph != null) { LayoutEditor.FitGraphBoundingBox(DGraph); } Invalidate(); } }
private void SavePipettorElements_Executed(object sender, ExecutedRoutedEventArgs e) { LayoutEditor layoutEditor = GetLayoutEditor(); if (layoutEditor == null) { return; } var layout = layoutEditor.Layout; PipettorElementManager.Instance.SavePipettorElement(layout); }
protected override void InitContainer() { if (editor == null) { editor = UIHelper.LoadLayoutEditor(PanelContext.Panel.EditInfo.ViewerLayout); editor.ID = "UxLayoutCtr"; editor.IsViewer = true; UxLayout.Controls.Clear(); UxLayout.Controls.Add(editor); } editor.InitLayout(PanelContext); ModelLabel.Text = PanelContext.Model.Label; MenuTabLabel.Text = BuildNavString(); }
private LayoutEditor GetLayoutEditor() { //TabItem tabitem = (TabItem)tabDynamic.SelectedItem; LayoutEditor layoutEditor = null; foreach (TabItem tabItem in tabDynamic.Items) { layoutEditor = ((Grid)tabItem.Content).Children[0] as LayoutEditor; if (layoutEditor != null) { break; } } return(layoutEditor); }
private void lb_layouts_SelectionChanged(object sender, SelectionChangedEventArgs e) { recipeParent.Children.Clear(); Layout selectedLayout = (Layout)this.lb_layouts.SelectedItem; if (selectedLayout == null) { return; } CheckDitiBox(selectedLayout); LayoutEditor editor = new LayoutEditor(selectedLayout); editor.DataContext = selectedLayout; recipeParent.Children.Add(editor); }
private void DeleteTabItem(string tag) { var validTags = tabDynamic.Items.Cast <TabItem>().Where(i => ((i.Tag != null) && i.Tag.Equals(tag))); if (validTags.Count() > 1) { throw new Exception("有重名设置!"); } var item = validTags.SingleOrDefault(); TabItem tab = item as TabItem; if (tab != null) { // get selected tab TabItem selectedTab = tabDynamic.SelectedItem as TabItem; // clear tab control binding tabDynamic.DataContext = null; //call dispose for the editor UserControl editor = (UserControl)(((Grid)tab.Content).Children[0]); if (typeof(IDisposable).IsAssignableFrom(editor.GetType())) { ((IDisposable)editor).Dispose(); } // If the editor is a RecipeEditor, unsubscribe its EditWare event if (editor is LayoutEditor) { LayoutEditor recipeEditor = editor as LayoutEditor; recipeEditor.EditWare -= this.OnLayoutEditorEditWare; } // Remove the tab _tabItems.Remove(tab); // bind tab control tabDynamic.DataContext = _tabItems; // select previously selected tab. if that is removed then select first tab if ((selectedTab == null || selectedTab.Equals(tab)) && _tabItems.Count > 0) { selectedTab = _tabItems[0]; } tabDynamic.SelectedItem = selectedTab; } }
void RouteEdgesRectilinearly() { if (gViewer.Graph == null || gViewer.Graph.GeometryGraph == null) { return; } // var geomGraph = gViewer.Graph.GeometryGraph; // var rie = new RectilinearInteractiveEditor(); // rie.CreatePortsAndRouteEdges(geomGraph.NodeSeparation / 3, 1, geomGraph.Nodes, geomGraph.Edges, geomGraph.LayoutAlgorithmSettings.EdgeRoutingMode); // EdgeLabelPlacement.PlaceLabels(geomGraph); // // foreach(var edge in gViewer.Entities.Where(edge => edge is IViewerEdge)) // gViewer.Invalidate(edge); LayoutEditor.RouteEdgesRectilinearly(gViewer); }
public override void InitializeEditor(LayoutEditor editor, object value, object dataSource) { DataFilter = null; if (dataSource is GroupPermission) { GroupPermission gp = (GroupPermission)dataSource; if (gp.Type == PermissionType.GSchema) { DataType = typeof(DBSchema); } else if (gp.Type == PermissionType.GTable) { DataType = typeof(DBTable); } else if (gp.Type == PermissionType.GColumn) { DataType = typeof(DBColumn); } } if (dataSource is StageParam) { var gp = (StageParam)dataSource; if (gp.ItemType == (int)StageParamType.Procedure) { DataType = typeof(DBProcedure); } else if (gp.ItemType == (int)StageParamType.Reference) { DataType = typeof(Stage); } else if (gp.ItemType == (int)StageParamType.Template) { DataType = typeof(Template); } else if (gp.ItemType == (int)StageParamType.Foreign) { DataType = typeof(DBColumn); } else if (gp.ItemType == (int)StageParamType.Column) { DataType = typeof(DBColumn); DataFilter = Document.DBTable; } } base.InitializeEditor(editor, value, dataSource); }
private void OnLayoutsEditMenuItemClick(object sender, RoutedEventArgs e) { Layout selectedLayout = (Layout)this.lb_layouts.SelectedItem; if (selectedLayout == null) { return; } if (this.ActivateEditingTab(selectedLayout.SaveName)) { return; } LayoutEditor editor = new LayoutEditor(selectedLayout, AddInfo); editor.DataContext = selectedLayout; var tabItem = this.AddTabItem(editor); }
private void SetDitiPosition_Executed(object sender, ExecutedRoutedEventArgs e) { LayoutEditor layoutEditor = GetLayoutEditor(); if (layoutEditor == null) { AddErrorInfo("找不到布局!"); return; } Labware labware = e.Parameter as Labware; DitiEditor ditiEditor = new DitiEditor(labware, layoutEditor.Layout); ditiEditor.ShowDialog(); if (!ditiEditor.SetOk) { return; } var ditibox = layoutEditor.Layout.DitiInfo.DitiBoxInfos.Find(x => x.label == labware.Label); ditibox.count = ditiEditor.RemainTipCount; }
private void StartScript_Executed(object sender, ExecutedRoutedEventArgs e) { TabItem selectedTab = tabDynamic.SelectedItem as TabItem; LayoutEditor layoutEditor = (LayoutEditor)((Grid)selectedTab.Content).Children[0]; AdvancedPipettingCommand pipettingCmd1 = new AdvancedPipettingCommand("label1", new List <int>() { 1 }, new List <int>() { 1 }, new LiquidClass(), true, 100); AdvancedPipettingCommand pipettingCmd2 = new AdvancedPipettingCommand("label1", new List <int>() { 1 }, new List <int>() { 9 }, new LiquidClass(), false, 100); AdvancedPipettingCommand pipettingCmd3 = new AdvancedPipettingCommand("label1", new List <int>() { 1 }, new List <int>() { 2 }, new LiquidClass(), true, 100); AdvancedPipettingCommand pipettingCmd4 = new AdvancedPipettingCommand("label1", new List <int>() { 1 }, new List <int>() { 10 }, new LiquidClass(), false, 100); List <IPipettorCommand> pipettingCmds = new List <IPipettorCommand>() { pipettingCmd1, pipettingCmd2, pipettingCmd3, pipettingCmd4 }; layoutEditor.RunScript(pipettingCmds); }
public KosmographViewer(Canvas graphCanvas) { this.layoutEditor = new LayoutEditor(this); this.ViewChangeEvent += AdjustBtrectRenderTransform; this.GraphCanvas = graphCanvas; this.GraphCanvas.SizeChanged += GraphCanvasSizeChanged; this.GraphCanvas.MouseLeftButtonDown += GraphCanvasMouseLeftButtonDown; this.GraphCanvas.MouseRightButtonDown += GraphCanvasRightMouseDown; this.GraphCanvas.MouseMove += GraphCanvasMouseMove; this.GraphCanvas.MouseLeftButtonUp += GraphCanvasMouseLeftButtonUp; this.GraphCanvas.MouseWheel += GraphCanvasMouseWheel; this.GraphCanvas.MouseRightButtonUp += GraphCanvasRightMouseUp; //LargeGraphNodeCountThreshold = 0; this.LayoutEditingEnabled = true; this.clickCounter = new ClickCounter(() => Mouse.GetPosition((IInputElement)this.GraphCanvas.Parent)); this.clickCounter.Elapsed += ClickCounterElapsed; this.RunLayoutAsync = false; }
private void SetAsCurrentDiti_Executed(object sender, ExecutedRoutedEventArgs e) { LayoutEditor layoutEditor = GetLayoutEditor(); if (layoutEditor == null) { AddErrorInfo("找不到布局!"); return; } Layout layout = layoutEditor.Layout; DitiInfo ditiInfo = layout.DitiInfo; Labware labware = e.Parameter as Labware; var ditiType = DitiBox.Parse(labware.TypeName); if (ditiInfo.DitiBoxInfos.Find(x => x.type == ditiType) != null) { ditiInfo.DitiBoxInfos.Add(new DitiBoxInfo(ditiType, labware.Label, 96)); } else { ditiInfo.SetUsingDitiBox(ditiType, labware.Label); } this.InvalidateVisual(); }
public RemoveCommand(LayoutEditor editor, UIElement item) { m_LayoutEditor = editor; m_UIElement = item; }
public static HudLayout FromLayoutView(LayoutEditor editor) => new HudLayout(editor.Root.ToXml());
private void ShowLayoutEditor(ConceptUsecase useCase) { var editor = new LayoutEditor(); }
/// <summary> /// The create new control event handler. /// </summary> protected void OnCreateControl(object sender, PXCallBackEventArgs arg) { string[] ar = arg.Argument.Split('|'); string parent = ar[0], before = (ar.Length > 1) ? ar[1] : null, after = (ar.Length > 2) ? ar[2] : null; string controlType = ((PXButton)sender).Key; switch (controlType) { case "Row": LayoutEditor.CreateControl("<PXLayoutRule StartRow='True' />", parent, before, after); break; case "Column": LayoutEditor.CreateControl("<PXLayoutRule StartColumn='True' />", parent, before, after); break; case "Group": LayoutEditor.CreateControl("<PXLayoutRule StartGroup='True' />", parent, before, after); break; case "Merge": LayoutEditor.CreateControl("<PXLayoutRule Merge='True' />", parent, before, after); break; case "Grid": LayoutEditor.CreateControl("<PXGrid><Levels><PXGridLevel></PXGridLevel></Levels></PXGrid>", parent, before, after); break; case "Tab": LayoutEditor.CreateControl("<PXTab><Items><PXTabItem Text='TabItem1'></PXTabItem></Items></PXTab>", parent, before, after); break; case "Button": if (!string.IsNullOrEmpty(before)) { var type = LayoutEditor.GetPageNodeTypeByUID(before); if (typeof(PXToolBarItem).IsAssignableFrom(type)) { controlType = "PXToolBarButton"; } if (typeof(PXDSCallbackCommand).IsAssignableFrom(type)) { controlType = "PXDSCallbackCommand"; } } else if (!string.IsNullOrEmpty(parent)) { var type = parent.Contains(_customItemsName) ? typeof(PXToolBar) : LayoutEditor.GetPageNodeTypeByUID(parent); if (typeof(PXDataSource).IsAssignableFrom(type)) { controlType = "PXDSCallbackCommand"; } if (typeof(PXToolBar).IsAssignableFrom(type) || typeof(PXGrid).IsAssignableFrom(type)) { controlType = "PXToolBarButton"; } } if (controlType == "PXDSCallbackCommand") { break; } if (controlType != "Button") { LayoutEditor.CreateControl(string.Format("<{0}></{0}>", controlType), parent, before, after); } else { LayoutEditor.CreateControl(controlType, parent, before, after); } break; default: LayoutEditor.CreateControl(controlType, parent, before, after); break; } }