private void MasterBreakAwayCommandHandler(object parameter) { MasterWidgetViewModel master = _selectionService.GetSelectedWidgets()[0] as MasterWidgetViewModel; if (master == null) { return; } Naver.Compass.InfoStructure.CompositeCommand cmds = new Naver.Compass.InfoStructure.CompositeCommand(); var delCmd = new DeleteWidgetCommand(this, master); cmds.AddCommand(delCmd); Items.Remove(master); IObjectContainer container = _model.BreakMaster2Dom(master.widgetGID); AddObjects2Page2(container, _curAdaptiveViewGID, null, false, master.ZOrder, cmds); //TODO:Master Parent group operation }
private void MasterLock2LocationCommandHandler(object parameter) { MasterWidgetViewModel master = _selectionService.GetSelectedWidgets()[0] as MasterWidgetViewModel; if (master == null) { return; } //Change UI Naver.Compass.InfoStructure.CompositeCommand cmds = new Naver.Compass.InfoStructure.CompositeCommand(); List <Guid> updateGroupList = new List <Guid>(); CreatePropertyChangeUndoCommand(cmds, master, "IsLocked2MasterLocation", master.IsLocked2MasterLocation, !master.IsLocked2MasterLocation); master.IsLocked2MasterLocation = !master.IsLocked2MasterLocation; //Update X and Y if (master.IsLocked2MasterLocation == true) { if (master.MasterLockedLocationX != master.Left) { CreatePropertyChangeUndoCommand(cmds, master, "Left", master.Left, master.MasterLockedLocationX); master.ForceSetX(master.MasterLockedLocationX); } if (master.MasterLockedLocationY != master.Top) { CreatePropertyChangeUndoCommand(cmds, master, "Top", master.Top, master.MasterLockedLocationY); master.ForceSetY(master.MasterLockedLocationY); } } //Update Group if (master.ParentID != Guid.Empty) { updateGroupList.Add(master.ParentID); UpdateGroup(master.ParentID); } PushToUndoStack(cmds, updateGroupList); }
//Create Widget VM According to XML data public static WidgetViewModBase CreateWidget(IRegion obj) { //string timeStamp = "_" + DateTime.Now.ToString("MMddHHmmssfff"); WidgetViewModBase vmItem; if (obj is IMaster) { IMaster master = obj as IMaster; AutoSetWdgName(obj, "Master ", WidgetType.None); vmItem = new MasterWidgetViewModel(master); return(vmItem); } IWidget it = obj as IWidget; switch (it.WidgetType) { case WidgetType.Button: { AutoSetWdgName(it, "Button ", WidgetType.Button); vmItem = new ButtonWidgetViewModel(it); break; } case WidgetType.Image: { AutoSetWdgName(it, "Image ", WidgetType.Image); vmItem = new ImageWidgetViewModel(it); break; } case WidgetType.SVG: { AutoSetWdgName(it, "Svg ", WidgetType.SVG); vmItem = new SVGWidgetViewModel(it); break; } case WidgetType.HotSpot: { AutoSetWdgName(it, "Link ", WidgetType.HotSpot); vmItem = new HotSpotWidgetViewModel(it); break; } case WidgetType.Line: { ILine line = it as ILine; if (line.Orientation == Orientation.Vertical) { AutoSetWdgName(it, "VLine ", WidgetType.Line); vmItem = new VLineWidgetViewModel(it); } else { AutoSetWdgName(it, "HLine ", WidgetType.Line); vmItem = new HLineWidgetViewModel(it); } break; } case WidgetType.Shape: { IShape shape = it as IShape; if (shape.ShapeType == ShapeType.Diamond) { AutoSetWdgName(it, "Diamond ", WidgetType.Shape); vmItem = new DiamondWidgetViewModel(it); } else if (shape.ShapeType == ShapeType.Ellipse) { AutoSetWdgName(it, "Ellipse ", WidgetType.Shape); vmItem = new CircleWidgetViewModel(it); } else if (shape.ShapeType == ShapeType.Rectangle) { AutoSetWdgName(it, "Rectangle ", WidgetType.Shape); vmItem = new RectangleWidgetViewModel(it); } else if (shape.ShapeType == ShapeType.RoundedRectangle) { AutoSetWdgName(it, "Round ", WidgetType.Shape); vmItem = new RoundedRecWidgetViewModel(it); } else if (shape.ShapeType == ShapeType.Paragraph) { AutoSetWdgName(it, "Paragraph ", WidgetType.Shape); vmItem = new LabelWidgetViewModel(it); } else if (shape.ShapeType == ShapeType.Triangle) { AutoSetWdgName(it, "Triangle ", WidgetType.Shape); vmItem = new TriangleWidgetViewModel(it); } else { AutoSetWdgName(it, "Image ", WidgetType.Shape); vmItem = new ImageWidgetViewModel(it); } break; } case WidgetType.ListBox: { AutoSetWdgName(it, "ListBox ", WidgetType.ListBox); vmItem = new ListboxWidgetViewModel(it); break; } case WidgetType.DropList: { AutoSetWdgName(it, "DropList ", WidgetType.DropList); vmItem = new DroplistWidgetViewModel(it); break; } case WidgetType.Checkbox: { AutoSetWdgName(it, "Checkbox ", WidgetType.Checkbox); vmItem = new CheckBoxWidgetViewModel(it); break; } case WidgetType.RadioButton: { AutoSetWdgName(it, "RadioButton ", WidgetType.RadioButton); vmItem = new RadioButtonWidgetViewModel(it); break; } case WidgetType.TextArea: { AutoSetWdgName(it, "TextArea ", WidgetType.TextArea); vmItem = new TextAreaWidgetViewModel(it); break; } case WidgetType.TextField: { AutoSetWdgName(it, "TextField ", WidgetType.TextField); vmItem = new TextFieldWidgetViewModel(it); break; } case WidgetType.HamburgerMenu: { AutoSetWdgName(it, "Drawer ", WidgetType.HamburgerMenu); vmItem = new HamburgerMenuViewModel(it); break; } case WidgetType.DynamicPanel: { AutoSetWdgName(it, "Flicking ", WidgetType.DynamicPanel); vmItem = new DynamicPanelViewModel(it); break; } case WidgetType.Toast: { AutoSetWdgName(it, "Toast ", WidgetType.Toast); vmItem = new ToastViewModel(it); break; } case WidgetType.FlowShape: // To avoid crash when load old file as we don't support flow shape right now. // This is temporary code and remove it once we support flow shape. return(null); case WidgetType.None: return(null); default: { vmItem = null; break; } }//switch return(vmItem); }