Ejemplo n.º 1
0
        private void TreatSwipePanelFlags(WidgetListItem PanelItem)
        {
            bool?HideFlag = null;

            PanelItem.OptionFlag = true;
            if (PanelItem.OrderedChildren != null)
            {
                foreach (WidgetListItem item in PanelItem.OrderedChildren)
                {
                    if (HideFlag == null)
                    {
                        if ((item.ItemType == ListItemType.GroupItem) && (item.OptionFlag == false))
                        {
                            PanelItem.HideFlag   = false;
                            PanelItem.OptionFlag = false;
                            return;
                        }
                        else
                        {
                            HideFlag = item.HideFlag;
                        }
                    }
                    else if ((item.ItemType == ListItemType.GroupItem) && (item.OptionFlag == false) || (HideFlag != item.HideFlag))
                    {
                        PanelItem.HideFlag   = false;
                        PanelItem.OptionFlag = false;
                        return;
                    }
                }

                PanelItem.HideFlag = (HideFlag == null) ? false : HideFlag.Value;
            }
        }
Ejemplo n.º 2
0
        private void ListBoxItem_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (mouse_P == default(Point))
                {
                    mouse_P = e.GetPosition(ObjectList);
                }
                else
                {
                    var pcurrent = e.GetPosition(ObjectList);
                    var distance = Math.Sqrt(Math.Pow(mouse_P.X - pcurrent.X, 2) + Math.Pow(mouse_P.Y - pcurrent.Y, 2));
                    if (distance > 2 && _MouseDownInfo != null)
                    {
                        var SelectItem = ObjectList.SelectedValue as WidgetListItem;
                        if (SelectItem != null && EnableDrag(SelectItem))
                        {
                            if (_MouseDownInfo.WidgetID.Equals(SelectItem.WidgetID))
                            {
                                _dragInfo = SelectItem;

                                DragDropEffects finalDropEffect = DragDrop.DoDragDrop(ObjectList, ObjectList.SelectedValue, DragDropEffects.Move);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void ListBoxItem_DragOver(object sender, DragEventArgs e)
        {
            WidgetListItem item = (e.Source as ContentPresenter).Content as WidgetListItem;

            if (item != null && _dragInfo != null)
            {
                //if ((!item.ParentID.Equals(_dragInfo.ParentID))||
                //    (item.WidgetID.Equals(_dragInfo.WidgetID)) ||
                //    (item.zOrder - _dragInfo.zOrder == 1))
                if ((!item.ParentID.Equals(_dragInfo.ParentID))
                    )
                {
                    if (item.WidgetID.Equals(_dragInfo.ParentID))
                    {
                        item.EnableDropFlag = true;
                    }
                    else
                    {
                        e.Handled = true;
                        e.Effects = DragDropEffects.None;
                        return;
                    }
                }
                else
                {
                    item.EnableDropFlag = true;
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Last drag info is error");
            }
        }
Ejemplo n.º 4
0
        private void AddStatusMenu(ContextMenu menu)
        {
            MenuItem item = new MenuItem();//Show status

            item.Icon = new Image {
                Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Naver.Compass.Module.WidgetManagerPanel;component/Resources/disable.png", UriKind.RelativeOrAbsolute))
                    };
                }

                item.Command          = WidgetSwitchDisplayCommand;
                item.CommandParameter = _oldSelectedList[0];
            }
            else
            {
                item.IsEnabled = false;
            }

            menu.Items.Add(item);
        }
Ejemplo n.º 5
0
        private bool IsEnableMenuOpen()
        {
            if (_oldSelectedList != null)
            {
                if (_oldSelectedList.Count < 1)
                {
                    return(false);
                }
            }
            else
            {
                NLogger.Warn("IsEnableMenuOpen->_oldSelectedList = null");//test code for find out reason
                return(false);
            }

            foreach (Guid ID in _oldSelectedList)
            {
                WidgetListItem item = FindUIItemByGUID(ID);

                if (item != null)
                {
                    if (item.ItemType == ListItemType.GroupItem || item.ItemType == ListItemType.DynamicPanelStateItem)
                    {
                        return(false);
                    }
                }
                else
                {
                    NLogger.Warn("IsEnableMenuOpen->Founded item = null");//test code for find out reason
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 6
0
        public void WidgetSelectionChangeHandler(string EventArg)
        {
            try
            {
                List <Guid> SelectList = _selectionService.GetSelectedWidgetGUIDs();

                foreach (Guid id in SelectList)
                {
                    _oldSelectedList.Remove(id);

                    WidgetListItem Item = FindUIItemByGUID(id);

                    if (Item != null)
                    {
                        Item.UpdateItemSelectInfo(true);
                    }
                }

                if (_oldSelectedList != null)
                {
                    foreach (Guid id in _oldSelectedList)
                    {
                        WidgetListItem Item = FindUIItemByGUID(id);
                        if (Item != null && !Item.PlaceFlag)
                        {
                            Item.UpdateItemSelectInfo(false);
                        }
                    }
                }

                _oldSelectedList.Clear();
                //_oldSelectedList = SelectList;

                foreach (WidgetListItem item in _control.ObjectList.Items)
                {
                    if (item.IsSelected)
                    {
                        _oldSelectedList.Add(item.WidgetID);
                    }
                }


                if (SelectList.Count > 0)
                {
                    WidgetListItem Item22 = FindUIItemByGUID(SelectList.First());
                    if (Item22 != null)
                    {
                        // ScrollToCenterOfView(_control.Tree, Item22);

                        _control.ObjectList.ScrollIntoView(Item22);
                    }
                }

                RefreshToolbarCommands();
            }
            catch (System.Exception ex)
            {
                NLogger.Error("WidgetSelectionChange" + ex.Message);
            }
        }
Ejemplo n.º 7
0
        private bool CovertPageData(IPage page, Guid curViewID, WidgetListItem ParentItem)
        {
            try
            {
                WidgetListItem.CurViewID = curViewID;

                List <Guid> ALLGroupWidgetList = new List <Guid>();

                CovertGroup(page, ParentItem, page.Groups, ALLGroupWidgetList);

                foreach (IRegion region in page.WidgetsAndMasters)
                {
                    if (ALLGroupWidgetList.Contains(region.Guid))
                    {
                        continue;
                    }

                    CovertWidget(region, page, ParentItem);
                }

                ParentItem.OrderedChildren.Sort(CompareByZorder);
            }
            catch (System.Exception ex)
            {
                NLogger.Error("CovertPageData" + ex.Message.ToString());
            }


            return(true);
        }
Ejemplo n.º 8
0
        private void ClearData(string rootName)
        {
            _Page = null;

            SearchString  = String.Empty;
            HideSearchBox = true;

            if (_oldSelectedList != null)
            {
                _oldSelectedList.Clear();
            }

            if (_expandStatusList != null)
            {
                _expandStatusList.Clear();
            }

            _rootItem = new RootListItem();
            _rootItem.OrderedChildren = new List <WidgetListItem>();

            RootName = rootName;

            if (_UIWidgetLIst != null)
            {
                _UIWidgetLIst.Clear();
                FirePropertyChanged("UIWidgetItems");
            }

            if (this._inputDelayTimer.IsEnabled)
            {
                this._inputDelayTimer.Stop();
            }
        }
Ejemplo n.º 9
0
        private void ListBoxItem_DragLeave(object sender, DragEventArgs e)
        {
            WidgetListItem item = (e.Source as ContentPresenter).Content as WidgetListItem;

            if (item != null && _dragInfo != null)
            {
                item.EnableDropFlag = false;
            }
        }
Ejemplo n.º 10
0
        private void ListBoxItem_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            WidgetListItem item = (e.Source as ContentPresenter).Content as WidgetListItem;

            if (item != null)
            {
                _MouseDownInfo = item;
            }
        }
Ejemplo n.º 11
0
        public void ListItemSelectedChangedNotify(object data)
        {
            WidgetSelectionInfo info    = (WidgetSelectionInfo)data;
            WidgetListItem      curitem = null;

            curitem = FindUIItemByGUID(info.WidgetID);
            if (curitem != null)
            {
                if (curitem.ItemType == ListItemType.GroupChildItem)
                {
                    curitem.UpdateItemSelectInfo(false);
                }
                else
                {
                    if (info.bSelected)
                    {
                        foreach (Guid ItemID in _oldSelectedList)
                        {
                            WidgetListItem tempitem = FindItemByGUID(ItemID);

                            if ((tempitem != null && tempitem.IsSelected == true) && curitem.ParentID != tempitem.ParentID)
                            {
                                curitem.UpdateItemSelectInfo(false);
                                return;
                            }
                        }

                        if (curitem.PlaceFlag == true)
                        {
                            _oldSelectedList.Add(info.WidgetID);
                            RefreshToolbarCommands();
                            return;
                        }
                    }
                    else
                    {
                        if (curitem.PlaceFlag == true)
                        {
                            _oldSelectedList.Remove(info.WidgetID);
                            return;
                        }
                    }


                    WidgetSelectionInfoExtra Notifydata = new WidgetSelectionInfoExtra();
                    Notifydata.WidgetID     = curitem.WidgetID;
                    Notifydata.bSelected    = info.bSelected;
                    Notifydata.PageID       = curitem.ParentPage.Guid;
                    Notifydata.BelongWidget = WidgetListItem.BelongWidget;
                    Notifydata.pageType     = GetparentType(curitem.ParentPage);
                    Notifydata.IsGroup      = (curitem.ItemType == ListItemType.GroupItem);
                    Notifydata.IsSwipePanel = (curitem.ItemType == ListItemType.DynamicPanelStateItem);
                    _ListEventAggregator.GetEvent <WdgMgrChangeSelectionEvent>().Publish(Notifydata);
                }
            }
        }
Ejemplo n.º 12
0
        public void ProcessHideChange(List <Guid> ChildList, IPagePropertyData pageVM)
        {
            foreach (Guid id in ChildList)
            {
                WidgetListItem Item = FindItemByGUID(id);

                if (Item != null && Item.ItemType != ListItemType.DynamicPanelStateItem && Item.ItemType != ListItemType.GroupItem)
                {
                    Item.UpdateHideFlag();

                    //if (_rootItem.ItemType == ListItemType.DynamicPanelItem)
                    //{

                    if (Item.ParentID != null && !Item.ParentID.Equals(Guid.Empty))
                    {
                        WidgetListItem parentItem = FindItemByGUID(Item.ParentID);
                        if (parentItem != null)
                        {
                            if (_rootItem.ItemType == ListItemType.DynamicPanelItem)
                            {
                                if (parentItem.ItemType == ListItemType.GroupItem)
                                {
                                    TreatGroupFlags(parentItem as GroupListItem);

                                    WidgetListItem PanelItem = FindItemByGUID(parentItem.ParentID);

                                    TreatSwipePanelFlags(PanelItem);
                                }
                                else if (parentItem.ItemType == ListItemType.DynamicPanelStateItem)
                                {
                                    TreatSwipePanelFlags(parentItem);
                                }
                                else if (parentItem.ItemType == ListItemType.GroupChildItem)
                                {
                                    WidgetListItem RootGroupItem = FindRootGroupItem(parentItem);
                                    TreatGroupFlags(RootGroupItem as GroupListItem);

                                    WidgetListItem PanelItem = FindItemByGUID(RootGroupItem.ParentID);
                                    TreatSwipePanelFlags(PanelItem);
                                }
                            }
                            else if (parentItem.ItemType == ListItemType.GroupItem)
                            {
                                TreatGroupFlags(parentItem as GroupListItem);
                            }
                            else if (parentItem.ItemType == ListItemType.GroupChildItem)
                            {
                                TreatGroupFlags(FindRootGroupItem(parentItem) as GroupListItem);
                            }
                        }
                    }
                    //}
                }
            }
        }
Ejemplo n.º 13
0
        private void CovertGroup(IPage page, WidgetListItem ParentItem, IGroups groupList, List <Guid> GroupWidget, bool bTop = true)
        {
            foreach (IGroup group in groupList)
            {
                if (group.ParentGroup != null && bTop)
                {
                    continue;
                }

                WidgetListItem GroupItem = null;

                if (group.ParentGroup == null)
                {
                    GroupItem          = new GroupListItem(group);
                    GroupItem.ItemType = ListItemType.GroupItem;
                }
                else
                {
                    GroupItem            = new GroupChildListItem(group);
                    GroupItem.ItemType   = ListItemType.GroupChildItem;
                    GroupItem.OptionFlag = false;
                }

                GroupItem.ParentPage = page;
                GroupItem.ParentID   = ParentItem.WidgetID;
                GroupItem.IsExpanded = true;

                GroupItem.OrderedChildren = new List <WidgetListItem>();

                CovertGroup(page, GroupItem, group.Groups, GroupWidget, false);
                foreach (IRegion region in group.Widgets)
                {
                    CovertWidget(region, page, GroupItem);
                    GroupWidget.Add(region.Guid);
                }
                foreach (IRegion region in group.Masters)
                {
                    CovertWidget(region, page, GroupItem);
                    GroupWidget.Add(region.Guid);
                }

                GroupItem.OrderedChildren.Sort(CompareByZorder);

                if (GroupItem.OrderedChildren.Count > 0)
                {
                    GroupItem.zOrder = GroupItem.OrderedChildren[0].zOrder;
                }
                if (bTop)
                {
                    TreatGroupFlags(GroupItem as GroupListItem);
                }

                ParentItem.OrderedChildren.Add(GroupItem);
            }
        }
Ejemplo n.º 14
0
        private void ProcessPageZorderChange(WidgetListItem item)
        {
            if (item == null || item.OrderedChildren == null)
            {
                return;
            }

            ProcessChildZorderChange(item);

            UpdateUIData();
        }
Ejemplo n.º 15
0
 public bool IsChildofRootItem(WidgetListItem item)
 {
     if (item.ParentID == _rootItem.WidgetID)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 16
0
        public void OnWidgetDisplayNameChanged()
        {
            List <Guid> SelectList = _selectionService.GetSelectedWidgetGUIDs();

            foreach (Guid id in SelectList)
            {
                WidgetListItem Item = FindUIItemByGUID(id);
                if (Item != null)
                {
                    Item.UpdateWidgetName();
                }
            }
        }
Ejemplo n.º 17
0
        private void ListBoxItem_Drop(object sender, DragEventArgs e)
        {
            WidgetListItem item = (e.Source as ContentPresenter).Content as WidgetListItem;

            if (item != null && _dragInfo != null)
            {
                if (item.ParentID.Equals(_dragInfo.ParentID) || item.WidgetID.Equals(_dragInfo.ParentID))
                {
                    (DataContext as WidgetManagerViewMode).ProcessDrapDropChangeZorder(_dragInfo, item);
                }

                item.EnableDropFlag = false;
            }
        }
Ejemplo n.º 18
0
        private bool EnableDrag(WidgetListItem item)
        {
            if (!(item.ItemType == ListItemType.GroupChildItem ||
                  item.ItemType == ListItemType.PageItem ||
                  item.ItemType == ListItemType.DynamicPanelStateItem))
            {
                if (!item.PlaceFlag)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 19
0
        private bool IsSelectUnplaceValue()
        {
            foreach (Guid ID in _oldSelectedList)
            {
                WidgetListItem item = FindUIItemByGUID(ID);

                if (item.PlaceFlag == true)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 20
0
        private void ExpandCollapseWidget(WidgetListItem item, bool expandFlag)
        {
            if (item != null)
            {
                foreach (WidgetListItem child in item.OrderedChildren)
                {
                    child.CollapseFlag = !expandFlag;

                    if (child.OrderedChildren != null && child.OrderedChildren.Count > 0)
                    {
                        ExpandCollapseWidget(child, expandFlag);
                    }
                }
            }
        }
Ejemplo n.º 21
0
        private int GetMinZorder(WidgetListItem item)
        {
            System.Diagnostics.Debug.Assert(item.OrderedChildren.Count > 0, "GetMinZorder->child count error!");
            WidgetListItem childitem = item.OrderedChildren[item.OrderedChildren.Count - 1];

            int rValue = -1;

            if (childitem.OrderedChildren != null && childitem.OrderedChildren.Count > 0)
            {
                return(GetMinZorder(childitem));
            }
            else
            {
                return(childitem.zOrder);
            }
        }
Ejemplo n.º 22
0
        public WidgetListItem FindRootGroupItem(WidgetListItem GroupChildItem)
        {
            WidgetListItem parentItem = FindItemByGUID(GroupChildItem.ParentID);

            while (parentItem.ParentID != null)
            {
                if (parentItem.ItemType == ListItemType.GroupItem)
                {
                    break;
                }

                parentItem = FindItemByGUID(parentItem.ParentID);
            }

            return(parentItem);
        }
Ejemplo n.º 23
0
        private void SetGroupFilterFlag(WidgetListItem GroupItem)
        {
            GroupItem.UnFilter = GetgroupFlag(GroupItem);

            foreach (WidgetListItem child in GroupItem.OrderedChildren)
            {
                if (child.ItemType == ListItemType.GroupItem || child.ItemType == ListItemType.GroupChildItem)
                {
                    SetGroupFilterFlag(child);
                }
                else
                {
                    child.UnFilter = GroupItem.UnFilter;
                }
            }
        }
Ejemplo n.º 24
0
 private void GetGroupAllwidget(WidgetListItem item, List <WidgetListItem> list)
 {
     if (item.OrderedChildren != null)
     {
         foreach (WidgetListItem childitem in item.OrderedChildren)
         {
             if (childitem.ItemType == ListItemType.GroupChildItem)
             {
                 GetGroupAllwidget(childitem, list);
             }
             else
             {
                 list.Add(childitem);
             }
         }
     }
 }
Ejemplo n.º 25
0
        private void OnChangeZorder(bool bForward)
        {
            List <Guid> SelectList = GetSelectItemList();

            if (SelectList.Count != 0)
            {
                Guid ItemID = SelectList.First();

                WidgetListItem Item = FindItemByGUID(ItemID);
                if (Item != null && Item.ParentPage != null)
                {
                    WDMgrZorderChangeInfo Info = new WDMgrZorderChangeInfo();
                    Info.PageID   = Item.ParentPage.Guid;
                    Info.bForward = bForward;
                    _ListEventAggregator.GetEvent <WdgMgrZorderChangedEvent>().Publish(Info);
                }
            }
        }
Ejemplo n.º 26
0
        private void ExcuteWidgetEditCommand(object cmdParameter)
        {
            Guid ItemID = (Guid)cmdParameter;

            WidgetListItem item = FindItemByGUID(ItemID);

            if (item != null)
            {
                if (item.ItemType == ListItemType.defaultItem)
                {
                    _ListEventAggregator.GetEvent <WdgMgrEditSelectionEvent>().Publish(item.ParentPage.Guid);
                }
                else
                {
                    OnOpenChildwidgetPage(item);
                }
            }
        }
Ejemplo n.º 27
0
        public void OnWidgetPlacePropertyChanged()
        {
            List <Guid> SelectList = GetSelectListinPage();

            IPagePropertyData pageVM = _selectionService.GetCurrentPage();

            if (pageVM != null && pageVM.ActivePage != null)
            {
                foreach (Guid id in SelectList)
                {
                    WidgetListItem Item = FindItemByGUID(id);
                    if (Item != null)
                    {
                        Item.UpdateAllFlagByViewChange();
                    }
                }
            }
        }
Ejemplo n.º 28
0
        public void OnOpenChildwidgetPage(object obj)
        {
            try
            {
                WidgetListItem item = (WidgetListItem)obj;// as WidgetListItem;

                if ((item != null) && (item.ItemType == ListItemType.DynamicPanelItem ||
                                       item.ItemType == ListItemType.MenuItem ||
                                       item.ItemType == ListItemType.MasterItem ||
                                       item.ItemType == ListItemType.ToastItem) && (item.OptionFlag))
                {
                    _ListEventAggregator.GetEvent <WdgMgrOpenChildWidgetPage>().Publish(item.WidgetID);
                }
            }
            catch (System.Exception ex)
            {
                NLogger.Info("OnOpenChildWidgetPage exception:" + ex.Message.ToString());
            }
        }
Ejemplo n.º 29
0
        private static int CompareByZorder(WidgetListItem widget1, WidgetListItem widget2)
        {
            if (widget1 == null)
            {
                if (widget2 == null)
                {
                    return(0);
                }

                return(-1);
            }

            if (widget2 == null)
            {
                return(1);
            }

            return(widget2.zOrder - widget1.zOrder);;
        }
Ejemplo n.º 30
0
        private bool CanExecuteWidgetForWard(object cmdParameter)
        {
            List <Guid> SelectList = GetSelectItemList();

            Guid ParentGUID = Guid.Empty;

            if (SelectList.Count == 0)
            {
                return(false);
            }

            foreach (Guid itemID in SelectList)
            {
                WidgetListItem curitem = FindItemByGUID(itemID);

                if (curitem == null)
                {
                    continue;
                }

                if (curitem.PlaceFlag)
                {
                    return(false);
                }

                if (ParentGUID.Equals(Guid.Empty))
                {
                    ParentGUID = curitem.ParentID;
                }
                else if (!ParentGUID.Equals(curitem.ParentID))
                {
                    return(false);
                }

                if (IsMaxOrderInPage(curitem))
                {
                    return(false);
                }
            }

            return(true);
        }