public void AddVertGuideLineHandler(object obj) { if (GuideType == GuideType.Global || _page == null || _pageView == null) { return; } var values = (object[])obj; Ruler ruler = values[0] as Ruler; PageEditorViewModel editor = values[1] as PageEditorViewModel; System.Windows.Point point = Mouse.GetPosition(ruler); IGuide guide = _pageView.CreateGuide(Orientation.Vertical, (point.X + ruler.CountShift) / Scale, 0); VerticalGuideLine vLine = new VerticalGuideLine(guide, GuideType.Local, editor.EditorScale); editor.EditorCanvas.Focus(); GuideItems.Add(vLine); _document.IsDirty = true; List <IGuide> guides = new List <IGuide>(); guides.Add(guide); CreatePageGuideCommand cmd = new CreatePageGuideCommand(_pageView, guides); CurrentUndoManager.Push(cmd); ShowGuide(editor); }
/// <summary> /// If Guide is hidden, show it. /// Fired when page guide is hidden, and create a new page guide. /// </summary> /// <param name="obj">PageEditorViewModel</param> private void ShowGuide(PageEditorViewModel editor) { if (GlobalData.IsShowPageGuide == false) { editor.IsPageGuideVisible = true; } }
private void PresetsBtn_Click(object sender, RoutedEventArgs e) { PageEditorViewModel editorVm = this.DataContext as PageEditorViewModel; editorVm.EditorCanvas.Focus(); editorVm.CheckDevices(); //Point point = PresetsBtn.TransformToAncestor(DiagramEditor).Transform(new Point(0, 0)); PresetsMenu.IsOpen = true; PresetsMenu.PlacementTarget = PresetsBtn; //PresetsMenu.PlacementRectangle = new Rect(point.X, point.Y, 0, 0); PresetsMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Top; }
public ImageEditorViewModel(PageEditorViewModel pageViewModel) { this._pageEditorViewModel = pageViewModel; this.EditType = ImageEditType.None; SliceCrossCommand = new DelegateCommand <object>(SliceCrossCommandHandler); SliceHorizontalCommand = new DelegateCommand <object>(SliceHorizontalCommandHandler); SliceVerticalCommand = new DelegateCommand <object>(SliceVerticalCommandHandler); CancelCommand = new DelegateCommand <object>(CancelCommandHandler); CropCropCommand = new DelegateCommand <object>(CropCropCommandHandler); CropCutCommand = new DelegateCommand <object>(CropCutCommandHandler); CropCopyCommand = new DelegateCommand <object>(CropCopyCommandHandler); }
private void RulerEditorPanel_Loaded(object sender, RoutedEventArgs e) { if (_bIsFirestLoaded == false) { PageEditorViewModel page = DataContext as PageEditorViewModel; if (page != null) { page.InitialLoadWidget(); } _bIsFirestLoaded = true; } }
public DeleteWidgetCommand(PageEditorViewModel pageVM, WidgetViewModBase widgetVM) { _pageVM = pageVM; _widgetVM = widgetVM; foreach (IPageView pageView in _pageVM.PageEditorModel.PageViews) { if (pageView.Widgets.Contains(_widgetVM.WidgetID)) { _placedPageViewGuids.Add(pageView.Guid); } } }
public DeleteWidgetInGroupSubCommand(PageEditorViewModel pageVM, WidgetViewModBase widgetVM) { _pageVM = pageVM; _widgetVM = widgetVM; _parentGroupInVM = _pageVM.PageEditorModel.Groups[widgetVM.ParentID]; _parentGroupInDOM = _widgetVM.WidgetModel.RealParentGroup; foreach (IPageView pageView in _pageVM.PageEditorModel.PageViews) { if (pageView.Widgets.Contains(_widgetVM.WidgetID)) { _placedPageViewGuids.Add(pageView.Guid); } } }
public PasteGroupCommand(PageEditorViewModel pageVM, GroupViewModel groupVM) { _pageVM = pageVM; _group = groupVM.ExternalGroup; _childWidgetVMs = new List <WidgetViewModBase>(groupVM.WidgetChildren); foreach (WidgetViewModBase widgetVM in _childWidgetVMs) { List <Guid> placedPageViewGuids = new List <Guid>(); foreach (IPageView pageView in _pageVM.PageEditorModel.PageViews) { if (pageView.Widgets.Contains(widgetVM.WidgetID)) { placedPageViewGuids.Add(pageView.Guid); } } _placedPageViewGuidsMap[widgetVM.WidgetID] = placedPageViewGuids; } }
private void ComboBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && sender is ComboBox) { ComboBox control = sender as ComboBox; PageEditorViewModel VM = control.DataContext as PageEditorViewModel; string sText = control.Text; sText = sText.Replace("%", ""); try { double scale = Convert.ToDouble(sText) / 100; VM.EditorScale = scale; } catch { control.Text = VM.EditorScale * 100 + "%";; } } }
public UngroupCommand(PageEditorViewModel pageVM, GroupViewModel groupVM) { _pageVM = pageVM; _group = groupVM.ExternalGroup; }
public UnplaceWidgetCommand(PageEditorViewModel pageVM, List <Guid> widgetList) { _pageVM = pageVM; _widgetList = widgetList; }
public void IniParentVM(PageEditorViewModel pageViewModel) { this._pageEditorViewModel = pageViewModel; }
public MenuPageEditorViewModel(PageEditorViewModel pageViewModel) { this._pageEditorViewModel = pageViewModel; _ListEventAggregator.GetEvent <RefreshWidgetChildPageEvent>().Subscribe(RefreshFlickingUIHandler); }