Ejemplo n.º 1
0
        private void ClickGroupChildInUnselected()
        {
            ClickInitialStatus = GroupStatus.UnSelect;
            DesignerCanvas  designer = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(this))) as DesignerCanvas;
            IGroupOperation pageVM   = designer.DataContext as IGroupOperation;

            //this is option for the common widget
            if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
            {
                foreach (BaseWidgetItem item in designer.SelectedItems)
                {
                    if (item.IsSelected == true &&
                        item.ParentID != Guid.Empty)
                    {
                        return;
                    }
                }
                pageVM.SetGroupStatus(ParentID, GroupStatus.Selected);
            }
            else
            {
                designer.DeselectAll();
                pageVM.DeselectAllGroups();
                pageVM.SetGroupStatus(ParentID, GroupStatus.Selected);
            }
        }
Ejemplo n.º 2
0
 protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
 {
     base.OnMouseDoubleClick(e);
     IsInEditModel = true;
     if (this.IsGroup != true)
     {
         IsSelected = true;
         DesignerCanvas  designer = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(this))) as DesignerCanvas;
         IGroupOperation pageVM   = designer.DataContext as IGroupOperation;
         if (this.ParentID != Guid.Empty)
         {
             if (pageVM != null)
             {
                 pageVM.SetGroupStatus(ParentID, GroupStatus.Edit);
             }
         }
         else
         {
             if (pageVM != null)
             {
                 pageVM.DeselectAllGroups();
             }
         }
     }
     //Event should can continue it's route to let canvas DeSelect all other widgets selected
     e.Handled = false;
 }
Ejemplo n.º 3
0
        public void OnPageChildMouseUp()
        {
            DesignerCanvas designer = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(this))) as DesignerCanvas;

            //object cc = VisualTreeHelper.GetParent(this);
            if (designer == null || IsInEditModel == true)
            {
                return;
            }

            IGroupOperation pageVM = designer.DataContext as IGroupOperation;

            //this is option for the common widget
            if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
            {
                return;
            }
            else
            {
                if (_isSelectedDone == false)
                {
                    if (IsSelected == true &&
                        designer.SelectedItems.Count() == 1)
                    {
                        return;
                    }
                    designer.DeselectAll();
                    pageVM.DeselectAllGroups();
                    this.IsSelected = true;
                }
            }
        }
Ejemplo n.º 4
0
        public void DeselectAll()
        {
            ISelectionService _selectionSrv = ServiceLocator.Current.GetInstance <SelectionServiceProvider>();

            _selectionSrv.RemoveAllWidgets();


            foreach (BaseWidgetItem item in this.SelectedItems)
            {
                item.IsSelected = false;
            }
            IGroupOperation pageVM = DataContext as IGroupOperation;

            pageVM.DeselectAllGroups();
        }
Ejemplo n.º 5
0
        private void ClickPageWidget()
        {
            DesignerCanvas designer = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(this))) as DesignerCanvas;

            //object cc = VisualTreeHelper.GetParent(this);
            if (designer == null)
            {
                return;
            }

            IGroupOperation pageVM = designer.DataContext as IGroupOperation;

            //this is option for the common widget
            if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
            {
                int count = designer.SelectedItems.Count();

                foreach (BaseWidgetItem item in designer.SelectedItems)
                {
                    if (item.IsSelected == true &&
                        item.ParentID != Guid.Empty)
                    {
                        return;
                    }
                    if (count == 1)
                    {
                        item.IsTarget = true;
                    }
                }

                this.IsSelected = !this.IsSelected;
                if (count == 0 && IsSelected)
                {
                    this.IsTarget = true;
                }
            }
            else
            {
                if (!this.IsSelected)
                {
                    designer.DeselectAll();
                    pageVM.DeselectAllGroups();
                    this.IsSelected = true;
                    _isSelectedDone = true;
                }
            }
        }
Ejemplo n.º 6
0
        //protected override void OnMouseUp(MouseButtonEventArgs e)
        //{
        //    base.OnMouseUp(e);
        //}
        //protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
        //{
        //    base.OnPreviewMouseLeftButtonUp(e);
        //}

        #region Public function called bye Move Thumb
        public void OnGroupChildMouseUp()
        {
            DesignerCanvas designer = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(this))) as DesignerCanvas;

            if (designer == null)
            {
                return;
            }
            //e.Handled = false;
            IGroupOperation pageVM      = designer.DataContext as IGroupOperation;
            GroupStatus     groupStatus = pageVM.GetGroupStatus(ParentID);

            if (ClickInitialStatus == GroupStatus.UnSelect && groupStatus == GroupStatus.Selected)
            {
                return;
            }

            //this is option for the group's child widget
            if (groupStatus == GroupStatus.UnSelect)
            {
                //if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                //{
                //    pageVM.SetGroupStatus(ParentID, GroupStatus.Selected);
                //}
                //else
                //{
                //    designer.DeselectAll();
                //    pageVM.DeselectAllGroups();
                //    pageVM.SetGroupStatus(ParentID, GroupStatus.Selected);
                //}
            }
            else if (groupStatus == GroupStatus.Selected)
            {
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    pageVM.SetGroupStatus(ParentID, GroupStatus.UnSelect);
                }
                else
                {
                    designer.DeselectAll();
                    pageVM.DeselectAllGroups();
                    pageVM.SetGroupStatus(ParentID, GroupStatus.Edit);
                    this.IsSelected = true;
                }
            }
            else
            {
                //this is option for the common widget
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    return;
                }
                else
                {
                    if (_isSelectedDone == false)
                    {
                        if (IsSelected == true &&
                            designer.SelectedItems.Count() == 1)
                        {
                            return;
                        }
                        pageVM.DeselectAllChildren(ParentID);
                        this.IsSelected = true;
                    }
                }
            }
        }