Exemplo n.º 1
0
        void CubeBrowser_DragDelta(object sender, DragNodeArgs <DragDeltaEventArgs> e)
        {
            Point m_DragDelta = new Point(m_PrevDrag.X + e.Args.HorizontalChange, m_PrevDrag.Y + e.Args.VerticalChange);

            if (MemberCtrl.Visibility == Visibility.Visible)
            {
                MemberCtrl.HighlightDrop(m_DragDelta);
            }
            if (SetCtrl.Visibility == Visibility.Visible)
            {
                SetCtrl.HighlightDrop(m_DragDelta);
            }

            m_PrevDrag = m_DragDelta;
        }
Exemplo n.º 2
0
        void CubeBrowser_DragCompleted(object sender, DragNodeArgs <DragCompletedEventArgs> e)
        {
            if (e.Args.Canceled == false)
            {
                TreeViewItem node = e.Node;

                Point point = new Point(m_DragStart.X + e.Args.HorizontalChange, m_DragStart.Y + e.Args.VerticalChange);
                if (MemberCtrl.Visibility == Visibility.Visible && MemberCtrl.CanDrop(point))
                {
                    MemberCtrl.Drop(point, CubeBrowser.GetNodeString(node as CustomTreeNode));
                }
                if (SetCtrl.Visibility == Visibility.Visible && SetCtrl.CanDrop(point))
                {
                    SetCtrl.Drop(point, CubeBrowser.GetNodeString(node as CustomTreeNode));
                }
            }
        }
 void CubeBrowser_DragStarted(object sender, DragNodeArgs<DragStartedEventArgs> e)
 {
     m_DragStart = new Point(e.Args.HorizontalOffset, e.Args.VerticalOffset);
     m_PrevDrag = m_DragStart;
 }
        void CubeBrowser_DragDelta(object sender, DragNodeArgs<DragDeltaEventArgs> e)
        {
            Point m_DragDelta = new Point(m_PrevDrag.X + e.Args.HorizontalChange, m_PrevDrag.Y + e.Args.VerticalChange);

            if (MemberCtrl.Visibility == Visibility.Visible)
                MemberCtrl.HighlightDrop(m_DragDelta);
            if (SetCtrl.Visibility == Visibility.Visible)
                SetCtrl.HighlightDrop(m_DragDelta);

            m_PrevDrag = m_DragDelta;
        }
        void CubeBrowser_DragCompleted(object sender, DragNodeArgs<DragCompletedEventArgs> e)
        {
            if (e.Args.Canceled == false)
            {
                TreeViewItem node = e.Node;

                Point point = new Point(m_DragStart.X + e.Args.HorizontalChange, m_DragStart.Y + e.Args.VerticalChange);
                if (MemberCtrl.Visibility == Visibility.Visible && MemberCtrl.CanDrop(point))
                {
                    MemberCtrl.Drop(point, CubeBrowser.GetNodeString(node as CustomTreeNode));
                }
                if (SetCtrl.Visibility == Visibility.Visible && SetCtrl.CanDrop(point))
                {
                    SetCtrl.Drop(point, CubeBrowser.GetNodeString(node as CustomTreeNode));
                }
            }
        }
 void CubeBrowser_DragStarted(object sender, DragNodeArgs<System.Windows.Controls.Primitives.DragStartedEventArgs> e)
 {
     m_DragStart = new Point(e.Args.HorizontalOffset, e.Args.VerticalOffset);
     m_PrevDrag = m_DragStart;
 }
        void CubeBrowser_DragDelta(object sender, DragNodeArgs<System.Windows.Controls.Primitives.DragDeltaEventArgs> e)
        {
            this.KpiDataContainer.IsReadyToDrop = false;

            Point m_DragDelta = new Point(m_PrevDrag.X + e.Args.HorizontalChange, m_PrevDrag.Y + e.Args.VerticalChange);          


            if (e.Node is KpiTreeNode)
            {
                Rect m_DataArea_Bounds = AgControlBase.GetSLBounds(this.KpiDataContainer);
                if (m_DataArea_Bounds.Contains(m_DragDelta))
                {
                    this.KpiDataContainer.IsReadyToDrop = true;
                }
            }

            m_PrevDrag = m_DragDelta;
        }
        void CubeBrowser_DragCompleted(object sender, DragNodeArgs<System.Windows.Controls.Primitives.DragCompletedEventArgs> e)
        {
            try
            {
                if (e.Args.Canceled == false)
                {
                    TreeViewItem node = e.Node;

                    if (e.Node is KpiTreeNode)
                    {
                        DropToArea(node as KpiTreeNode);
                        Raise_KpisLoadCompleted();
                    }
                }
            }
            finally
            {
                this.KpiDataContainer.IsReadyToDrop = false;
            }
        }
Exemplo n.º 9
0
 void CubeBrowser_DragStarted(object sender, DragNodeArgs <DragStartedEventArgs> e)
 {
     m_DragStart = new Point(e.Args.HorizontalOffset, e.Args.VerticalOffset);
     m_PrevDrag  = m_DragStart;
 }
        void m_CubeBrowser_DragDelta(object sender, DragNodeArgs<DragDeltaEventArgs> e)
        {
            m_RowsAreaContainer.IsReadyToDrop = false;
            m_ColumnsAreaContainer.IsReadyToDrop = false;
            m_FilterAreaContainer.IsReadyToDrop = false;
            m_DataAreaContainer.IsReadyToDrop = false;
            MDXQueryIsReadyToDrop = false;

            Point m_DragDelta = new Point(m_PrevDrag.X + e.Args.HorizontalChange, m_PrevDrag.Y + e.Args.VerticalChange);

            //m_RowsAreContainer.Caption = m_DragDelta.ToString();
            //List<UIElement> hits = (List<UIElement>)VisualTreeHelper.FindElementsInHostCoordinates(m_DragDelta, Application.Current.RootVisual);
            //if (hits != null)
            //{
            //    foreach (UIElement item in hits)
            //    {
            //        PivotAreaContainer container = item as PivotAreaContainer;
            //        if (container != null)
            //            container.IsReadyToDrop = true;
            //    }
            //}

            if (Mdx_Border.Visibility == Visibility.Visible && !m_MdxQuery.IsReadOnly)
            {
                // Получаем границы поля MDX
                Rect m_MdxQuery_Bounds = AgControlBase.GetSLBounds(m_MdxQuery);
                if (m_MdxQuery_Bounds.Contains(m_DragDelta))
                {
                    MDXQueryIsReadyToDrop = true;
                    m_PrevDrag = m_DragDelta;
                    return;
                }
            }

            if (e.Node is MeasureTreeNode ||
                e.Node is KpiValueTreeNode ||
                e.Node is KpiStatusTreeNode ||
                e.Node is KpiTrendTreeNode ||
                e.Node is KpiGoalTreeNode ||
                e.Node is CalculatedMemberTreeNode ||
                e.Node is NamedSetTreeNode ||
                e.Node is CalculatedNamedSetTreeNode ||
                e.Node is DimensionTreeNode ||
                e.Node is LevelTreeNode ||
                e.Node is HierarchyTreeNode || 
                e.Node is MemberLiteTreeNode)
            {
                // В область данных можно таскать только меры, KPI и вычисляемые элементы
                if (e.Node is MeasureTreeNode ||
                    e.Node is KpiValueTreeNode ||
                    e.Node is KpiStatusTreeNode ||
                    e.Node is KpiTrendTreeNode ||
                    e.Node is KpiGoalTreeNode ||
                    e.Node is CalculatedMemberTreeNode)
                {
                    Rect m_DataArea_Bounds = AgControlBase.GetSLBounds(m_DataAreaContainer);
                    if (m_DataArea_Bounds.Contains(m_DragDelta))
                    {
                        m_DataAreaContainer.IsReadyToDrop = true;
                    }
                }
                else
                {
                    Rect m_RowsArea_Bounds = AgControlBase.GetSLBounds(m_RowsAreaContainer);
                    if (m_RowsArea_Bounds.Contains(m_DragDelta))
                    {
                        m_RowsAreaContainer.IsReadyToDrop = true;
                    }

                    Rect m_ColumnsArea_Bounds = AgControlBase.GetSLBounds(m_ColumnsAreaContainer);
                    if (m_ColumnsArea_Bounds.Contains(m_DragDelta))
                    {
                        m_ColumnsAreaContainer.IsReadyToDrop = true;
                    }

                    // Set(ы) в фильтры не добавляются
                    if (!(e.Node is NamedSetTreeNode || e.Node is CalculatedNamedSetTreeNode))
                    {
                        Rect m_FilterArea_Bounds = AgControlBase.GetSLBounds(m_FilterAreaContainer);
                        if (m_FilterArea_Bounds.Contains(m_DragDelta))
                        {
                            m_FilterAreaContainer.IsReadyToDrop = true;
                        }
                    }
                }
            }

            m_PrevDrag = m_DragDelta;
        }
        void m_CubeBrowser_DragCompleted(object sender, DragNodeArgs<DragCompletedEventArgs> e)
        {
            try
            {
                if (e.Args.Canceled == false)
                {
                    TreeViewItem node = e.Node;

                    // Если кидаем в область MDX запроса
                    if (MDXQueryIsReadyToDrop)
                    {
                        String str = m_ServerExplorer.CubeBrowser.GetNodeString(node as CustomTreeNode);
                        if (!String.IsNullOrEmpty(str))
                        {
                            m_MdxQuery.Text += " " + str;
                        }
                        MDXQueryIsReadyToDrop = false;
                    }
                    else
                    {
                        // Если тягается измерение, то подменяем этот узел на первый из узлов иерархий
                        DimensionTreeNode dimNode = node as DimensionTreeNode;
                        if (dimNode != null)
                        {
                            HierarchyTreeNode hierarchyNode = null;

                            // Для начала ищем иерархию среди дочерних
                            foreach (TreeViewItem child in dimNode.Items)
                            {
                                hierarchyNode = child as HierarchyTreeNode;
                                if (hierarchyNode != null)
                                {
                                    node = hierarchyNode;
                                    break;
                                }
                            }
                            if (hierarchyNode == null)
                            {
                                // раз иерархии не нашли среди дочерних, то возможно средидочерних есть папки, в которые иерархия может быть вложена
                                // Значит пытаемся найти рекурсивно
                                hierarchyNode = FindHierarchy(dimNode);
                                if (hierarchyNode == null)
                                    return;
                                else
                                    node = hierarchyNode;
                            }
                        }

                        Members_FilterWrapper custom_MemberFilter = null;

                        // Убиваем конкурентов :D
                        if (m_RowsAreaContainer.IsReadyToDrop ||
                            m_ColumnsAreaContainer.IsReadyToDrop ||
                            m_FilterAreaContainer.IsReadyToDrop ||
                            m_DataAreaContainer.IsReadyToDrop)
                        {
                            // Если таскается элемент, то в случае если в данной области есть узел для иерархии или уровня, то элемент добавляется в фильтр
                            var memberNode = node as MemberLiteTreeNode;
                            if (memberNode != null && memberNode.Info != null)
                            {
                                PivotAreaContainer currentContainer = null;
                                // Убиваем конкурентов во всех областях кроме данной :D
                                if (m_RowsAreaContainer.IsReadyToDrop)
                                {
                                    currentContainer = m_RowsAreaContainer;
                                    m_ColumnsAreaContainer.RemoveItem(FindConcurent(m_ColumnsAreaContainer, node), false);
                                    m_FilterAreaContainer.RemoveItem(FindConcurent(m_FilterAreaContainer, node), false);
                                    m_DataAreaContainer.RemoveItem(FindConcurent(m_DataAreaContainer, node), false);
                                }
                                if (m_ColumnsAreaContainer.IsReadyToDrop)
                                {
                                    currentContainer = m_ColumnsAreaContainer;
                                    m_RowsAreaContainer.RemoveItem(FindConcurent(m_RowsAreaContainer, node), false);
                                    m_FilterAreaContainer.RemoveItem(FindConcurent(m_FilterAreaContainer, node), false);
                                    m_DataAreaContainer.RemoveItem(FindConcurent(m_DataAreaContainer, node), false);
                                }
                                if (m_FilterAreaContainer.IsReadyToDrop)
                                {
                                    currentContainer = m_FilterAreaContainer;
                                    m_ColumnsAreaContainer.RemoveItem(FindConcurent(m_ColumnsAreaContainer, node), false);
                                    m_RowsAreaContainer.RemoveItem(FindConcurent(m_RowsAreaContainer, node), false);
                                    m_DataAreaContainer.RemoveItem(FindConcurent(m_DataAreaContainer, node), false);
                                }
                                if (m_DataAreaContainer.IsReadyToDrop)
                                {
                                    currentContainer = m_DataAreaContainer;
                                    m_ColumnsAreaContainer.RemoveItem(FindConcurent(m_ColumnsAreaContainer, node), false);
                                    m_RowsAreaContainer.RemoveItem(FindConcurent(m_RowsAreaContainer, node), false);
                                    m_FilterAreaContainer.RemoveItem(FindConcurent(m_FilterAreaContainer, node), false);
                                }
                                if (currentContainer != null)
                                {
                                    // Находим конкурента в данной области
                                    var concurent = FindConcurent(currentContainer, node);
                                    var filtered_concurent = concurent as FilteredItemControl;
                                    if (filtered_concurent != null && filtered_concurent.FilteredWrapper != null &&
                                        (filtered_concurent is Hierarchy_AreaItemControl  || // Если конкурентом является иерархиия то это нормально
                                        (filtered_concurent is Level_AreaItemControl && ((Level_AreaItemControl)filtered_concurent).Level != null && ((Level_AreaItemControl)filtered_concurent).Level.UniqueName == memberNode.Info.LevelName)) // Если конкурентом является уровень, то это должен быть тот же уровень что и у элемента
                                    )
                                    {
                                        bool isDublicate = false;
                                        // Ищем такой же элемент в фильтре
                                        foreach (var item in filtered_concurent.FilteredWrapper.CompositeFilter.MembersFilter.SelectedInfo)
                                        {
                                            if (item.UniqueName == memberNode.Info.UniqueName && item.SelectState == SelectStates.Selected_Self)
                                                isDublicate = true;
                                        }
                                        if (!isDublicate)
                                        {
                                            // Добавляем сами руками в FilterSet. Он превильно сгенерируется только при закрытии диалога с фильтром
                                            if(String.IsNullOrEmpty(filtered_concurent.FilteredWrapper.CompositeFilter.MembersFilter.FilterSet))
                                            {
                                                filtered_concurent.FilteredWrapper.CompositeFilter.MembersFilter.FilterSet = "{" + memberNode.Info.UniqueName + "}";
                                            }
                                            else
                                            {
                                                String str = filtered_concurent.FilteredWrapper.CompositeFilter.MembersFilter.FilterSet.Trim();
                                                if(str.EndsWith("}"))
                                                {
                                                    str = str.Substring(0, str.Length - 1);
                                                }
                                                str += ", " + memberNode.Info.UniqueName + "}";
                                                filtered_concurent.FilteredWrapper.CompositeFilter.MembersFilter.FilterSet = str;
                                            }

                                            var member_settings = new MemberChoiceSettings(memberNode.Info, SelectStates.Selected_Self);
                                            filtered_concurent.FilteredWrapper.CompositeFilter.MembersFilter.SelectedInfo.Add(member_settings);
                                        }
                                        filtered_concurent.FilteredWrapper.CompositeFilter.MembersFilter.IsUsed = true;
                                        filtered_concurent.Refresh();
                                        if (m_FilterDialogs.ContainsKey(concurent))
                                        {
                                            ModalDialog dialog = m_FilterDialogs[concurent];
                                            if (dialog != null)
                                            {
                                                var filterControl = dialog.Content as FilterBuilderControl;
                                                if (filterControl != null)
                                                {
                                                    // Переинициализировать контрол выбора элементов измерения в фильтре при открытии
                                                    filterControl.MemberChoiceIsInitialized = false;
                                                }
                                            }
                                        }

                                        RefreshMdxQuery();
                                        return;
                                    }
                                    else
                                    {
                                        // Удаляем данного конкурента, т.к. он не поддерживает фильтр
                                        currentContainer.RemoveItem(concurent, false);
                                    }

                                    // Добавляем новый узел для иерархии
                                    // Ищем иерархию для данного элемента
                                    var hierarchyNode = m_ServerExplorer.CubeBrowser.FindHierarchyNode(memberNode.Info.HierarchyUniqueName);
                                    if (hierarchyNode != null)
                                    {
                                        custom_MemberFilter = new Members_FilterWrapper();
                                        var member_settings = new MemberChoiceSettings(memberNode.Info, SelectStates.Selected_Self);
                                        custom_MemberFilter.SelectedInfo.Add(member_settings);
                                        custom_MemberFilter.FilterSet = "{" + memberNode.Info.UniqueName + "}";
                                        node = hierarchyNode;
                                    }
                                }
                            }
                            else
                            {
                                AreaItemControl concurent = FindConcurent(m_RowsAreaContainer, node);
                                m_RowsAreaContainer.RemoveItem(concurent, false);

                                concurent = FindConcurent(m_ColumnsAreaContainer, node);
                                m_ColumnsAreaContainer.RemoveItem(concurent, false);

                                concurent = FindConcurent(m_FilterAreaContainer, node);
                                m_FilterAreaContainer.RemoveItem(concurent, false);

                                concurent = FindConcurent(m_DataAreaContainer, node);
                                m_DataAreaContainer.RemoveItem(concurent, false);
                            }
                        }

                        #region Узлы для вычисляемых элементов
                        CalculatedMemberTreeNode calcMemberNode = node as CalculatedMemberTreeNode;
                        if (calcMemberNode != null && calcMemberNode.Info != null)
                        {
                            // Вычисляемые элементы могут кидаться только в область данных
                            AreaItemControl ctrl = new CalculatedMember_AreaItemControl(new CalculatedMember_AreaItemWrapper(calcMemberNode.Info), calcMemberNode.Icon);
                            ctrl.ContextMenuCreated += new EventHandler(ctrl_ContextMenuCreated);
                            ctrl.UserData = node;


                            if (m_DataAreaContainer.IsReadyToDrop)
                            {
                                int count = m_DataAreaContainer.Items.Count;

                                // В случае, если в области данных стало более одного объекта, то добавляем специальный узел Values в область колонок 
                                if (count == 1)
                                {
                                    AreaItemControl value_ctrl = new Values_AreaItemControl();
                                    value_ctrl.ContextMenuCreated += new EventHandler(ctrl_ContextMenuCreated);
                                    m_ColumnsAreaContainer.ItemsListChanged -= new EventHandler(AreaContainer_ItemsListChanged);
                                    m_ColumnsAreaContainer.AddItem(value_ctrl);
                                    m_ColumnsAreaContainer.ItemsListChanged += new EventHandler(AreaContainer_ItemsListChanged);
                                }

                                m_DataAreaContainer.AddItem(ctrl);
                                calcMemberNode.UseBoldText = true;
                            }
                        }
                        #endregion Узлы для вычисляемых элементов

                        #region Узлы для именованных наборов
                        CalculatedNamedSetTreeNode calculatedSetNode = node as CalculatedNamedSetTreeNode;
                        if (calculatedSetNode != null && calculatedSetNode.Info != null)
                        {
                            // Set(ы) могут кидаться только в области строк и столбцов
                            AreaItemControl ctrl = new CalculateNamedSet_AreaItemControl(new CalculatedNamedSet_AreaItemWrapper(calculatedSetNode.Info), calculatedSetNode.Icon);
                            ctrl.ContextMenuCreated += new EventHandler(ctrl_ContextMenuCreated);
                            ctrl.UserData = node;

                            if (m_RowsAreaContainer.IsReadyToDrop)
                            {
                                m_RowsAreaContainer.AddItem(ctrl);
                                calculatedSetNode.UseBoldText = true;
                            }

                            if (m_ColumnsAreaContainer.IsReadyToDrop)
                            {
                                m_ColumnsAreaContainer.AddItem(ctrl);
                                calculatedSetNode.UseBoldText = true;
                            }
                        }

                        NamedSetTreeNode setNode = node as NamedSetTreeNode;
                        if (setNode != null)
                        {
                            NamedSetInfo setInfo = setNode.Info as NamedSetInfo;
                            if (setInfo != null)
                            {
                                // Set(ы) могут кидаться только в области строк и столбцов
                                AreaItemControl ctrl = new NamedSet_AreaItemControl(new NamedSet_AreaItemWrapper(setInfo), setNode.Icon);
                                ctrl.ContextMenuCreated += new EventHandler(ctrl_ContextMenuCreated);
                                ctrl.UserData = node;

                                if (m_RowsAreaContainer.IsReadyToDrop)
                                {
                                    m_RowsAreaContainer.AddItem(ctrl);
                                    setNode.UseBoldText = true;
                                }

                                if (m_ColumnsAreaContainer.IsReadyToDrop)
                                {
                                    m_ColumnsAreaContainer.AddItem(ctrl);
                                    setNode.UseBoldText = true;
                                }
                            }
                        }
                        #endregion Узлы для именованных наборов

                        #region Узлы метаданных (InfoBaseTreeNode)
                        InfoBaseTreeNode info_node = node as InfoBaseTreeNode;
                        if (info_node != null)
                        {
                            HierarchyInfo hierarchyInfo = info_node.Info as HierarchyInfo;
                            LevelInfo levelInfo = info_node.Info as LevelInfo;
                            MeasureInfo measureInfo = info_node.Info as MeasureInfo;
                            KpiInfo kpiInfo = info_node.Info as KpiInfo;

                            // Иерархии и уровни можно кидать только в области: строк, столбцов, фильтров
                            if (hierarchyInfo != null || levelInfo != null)
                            {
                                FilteredItemControl ctrl = null;
                                if (hierarchyInfo != null)
                                    ctrl = new Hierarchy_AreaItemControl(new Hierarchy_AreaItemWrapper(hierarchyInfo), info_node.Icon);
                                if (levelInfo != null)
                                    ctrl = new Level_AreaItemControl(new Level_AreaItemWrapper(levelInfo), info_node.Icon);

                                ctrl.ShowFilter += new EventHandler(FilteredItem_ShowFilter);
                                ctrl.CancelFilter += new EventHandler(FilteredItem_CancelFilter);
                                ctrl.ContextMenuCreated += new EventHandler(ctrl_ContextMenuCreated);
                                ctrl.UserData = node;
                                if(custom_MemberFilter != null)
                                {
                                    ctrl.FilteredWrapper.CompositeFilter.MembersFilter = custom_MemberFilter;
                                    ctrl.FilteredWrapper.CompositeFilter.MembersFilter.IsUsed = true;
                                    ctrl.Refresh();
                                }

                                if (m_RowsAreaContainer.IsReadyToDrop)
                                {
                                    m_RowsAreaContainer.AddItem(ctrl);
                                    info_node.UseBoldText = true;
                                }

                                if (m_ColumnsAreaContainer.IsReadyToDrop)
                                {
                                    m_ColumnsAreaContainer.AddItem(ctrl);
                                    info_node.UseBoldText = true;
                                }

                                if (m_FilterAreaContainer.IsReadyToDrop)
                                {
                                    m_FilterAreaContainer.AddItem(ctrl);
                                    info_node.UseBoldText = true;
                                }
                            }

                            // меры и Kpi могут кидаться только в область данных
                            if (measureInfo != null ||
                                kpiInfo != null)
                            {
                                AreaItemControl ctrl = null;
                                if (measureInfo != null)
                                    ctrl = new Measure_AreaItemControl(new Measure_AreaItemWrapper(measureInfo), info_node.Icon);
                                if (kpiInfo != null)
                                {
                                    KpiControlType type = KpiControlType.Value;
                                    if (node is KpiStatusTreeNode)
                                        type = KpiControlType.Status;
                                    if (node is KpiTrendTreeNode)
                                        type = KpiControlType.Trend;
                                    if (node is KpiGoalTreeNode)
                                        type = KpiControlType.Goal;

                                    ctrl = new Kpi_AreaItemControl(new Kpi_AreaItemWrapper(kpiInfo, type), info_node.Icon);
                                }

                                if (ctrl != null)
                                {
                                    ctrl.ContextMenuCreated += new EventHandler(ctrl_ContextMenuCreated);
                                    ctrl.UserData = node;

                                    if (m_DataAreaContainer.IsReadyToDrop)
                                    {
                                        int count = m_DataAreaContainer.Items.Count;

                                        // В случае, если в области данных стало более одного объекта, то добавляем специальный узел Values в область колонок 
                                        if (count == 1)
                                        {
                                            AreaItemControl value_ctrl = new Values_AreaItemControl();
                                            value_ctrl.ContextMenuCreated += new EventHandler(ctrl_ContextMenuCreated);
                                            m_ColumnsAreaContainer.ItemsListChanged -= new EventHandler(AreaContainer_ItemsListChanged);
                                            m_ColumnsAreaContainer.AddItem(value_ctrl);
                                            m_ColumnsAreaContainer.ItemsListChanged += new EventHandler(AreaContainer_ItemsListChanged);
                                        }

                                        m_DataAreaContainer.AddItem(ctrl);
                                        info_node.UseBoldText = true;
                                    }
                                }
                            }
                        }
                        #endregion Узлы метаданных (InfoBaseTreeNode)
                    }

                }
            }
            finally
            {
                m_RowsAreaContainer.IsReadyToDrop = false;
                m_ColumnsAreaContainer.IsReadyToDrop = false;
                m_FilterAreaContainer.IsReadyToDrop = false;
                m_DataAreaContainer.IsReadyToDrop = false;
            }
        }
		void m_CubeBrowser_DragCompleted(object sender, DragNodeArgs<DragCompletedEventArgs> e)
		{
			try
			{
				if (e.Args.Canceled == false)
				{
					TreeViewItem node = e.Node;

					// Если кидаем в область MDX запроса
					if (MDXQueryIsReadyToDrop)
					{
						String str = m_ServerExplorer.CubeBrowser.GetNodeString(node as CustomTreeNode);
						if (!String.IsNullOrEmpty(str))
						{
							m_MdxQuery.Text += " " + str;
						}
						MDXQueryIsReadyToDrop = false;
					}
					else
					{
						// Если тягается измерение, то подменяем этот узел на первый из узлов иерархий
						DimensionTreeNode dimNode = node as DimensionTreeNode;
						if (dimNode != null)
						{
							HierarchyTreeNode hierarchyNode = null;

							// Для начала ищем иерархию среди дочерних
							foreach (TreeViewItem child in dimNode.Items)
							{
								hierarchyNode = child as HierarchyTreeNode;
								if (hierarchyNode != null)
								{
									node = hierarchyNode;
									break;
								}
							}
							if (hierarchyNode == null)
							{
								// раз иерархии не нашли среди дочерних, то возможно средидочерних есть папки, в которые иерархия может быть вложена
								// Значит пытаемся найти рекурсивно
								hierarchyNode = FindHierarchy(dimNode);
								if (hierarchyNode == null)
									return;
								else
									node = hierarchyNode;
							}
						}

						PivotAreaContainer currentContainer = null;
						if (m_RowsAreaContainer.IsReadyToDrop)
						{
							currentContainer = m_RowsAreaContainer;
						}
						if (m_ColumnsAreaContainer.IsReadyToDrop)
						{
							currentContainer = m_ColumnsAreaContainer;
						}
						if (m_FilterAreaContainer.IsReadyToDrop)
						{
							currentContainer = m_FilterAreaContainer;
						}
						if (m_DataAreaContainer.IsReadyToDrop)
						{
							currentContainer = m_DataAreaContainer;
						}

						DropToArea(currentContainer, node as CustomTreeNode);
					}

				}
			}
			finally
			{
				m_RowsAreaContainer.IsReadyToDrop = false;
				m_ColumnsAreaContainer.IsReadyToDrop = false;
				m_FilterAreaContainer.IsReadyToDrop = false;
				m_DataAreaContainer.IsReadyToDrop = false;
			}
		}