コード例 #1
0
        void m_StorageManager_ActionCompleted(object sender, DataLoaderEventArgs e)
        {
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            StorageActionArgs args = e.UserState as StorageActionArgs;

            if (args != null)
            {
                if (args.ActionType == StorageActionTypes.GetList ||
                    args.ActionType == StorageActionTypes.Clear ||
                    args.ActionType == StorageActionTypes.Delete)
                {
                    List <ObjectStorageFileDescription> list = XmlSerializationUtility.XmlStr2Obj <List <ObjectStorageFileDescription> >(e.Result.Content);
                    m_List.Initialize(list);
                    m_List.IsWaiting = false;
                }
            }
        }
コード例 #2
0
        void Raise_InvokeCompleted(DataLoaderEventArgs args)
        {
            EventHandler <DataLoaderEventArgs> handler = this.InvokeCompleted;

            if (handler != null)
            {
                handler(this, args);
            }
        }
        void Raise_DataLoaded(DataLoaderEventArgs args)
        {
            EventHandler <DataLoaderEventArgs> handler = this.DataLoaded;

            if (handler != null)
            {
                handler(this, args);
            }
        }
        void GetMember_InvokeCommandCompleted(DataLoaderEventArgs e)
        {
            List<MemberData> members = new List<MemberData>();
            if (!String.IsNullOrEmpty(e.Result.Content))
            {
                CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
                members = QueryProvider.GetMembers(cellSet);
            }

            MemberData member = null;
            if (members.Count > 0)
                member = members[0];

            if (member != null)
            {
                m_CurrentMemberControl.Initialize(member);
            }
            else
            {
                m_CurrentMemberControl.Clear();
            }
        }
		void Raise_InvokeCompleted(DataLoaderEventArgs args)
		{
			EventHandler<DataLoaderEventArgs> handler = this.InvokeCompleted;
			if (handler != null)
			{
				handler(this, args);
			}
		}
        void Loader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            //IsBusy = false;

            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            //CellSetData cs_descr = XmlSerializationUtility.XmlStr2Obj<CellSetData>(e.Result);
            CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
            this.AddKpiRowToStorage(cs_descr);
            if (this.RowIndex < 0)
            {
                Raise_KpisLoadCompleted();
            }
        }
		protected virtual void MemberActionCompleted(DataLoaderEventArgs e)
		{
			if (!String.IsNullOrEmpty(e.Result.Content))
			{
				//CellSetData cs_descr = XmlSerializationUtility.XmlStr2Obj<CellSetData>(e.Result);
				CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
				Initialize(cs_descr);
			}
			//this.Focus();
			UpdateButtons();
		}
        void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            // Exception
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            // Exception or Message from Olap-Service
            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            if (e.Result != null)
            {
                String connectionId = String.Empty;
                if (e.Result.Headers.Contains(InvokeResultDescriptor.CONNECTION_ID))
                {
                    Header connection_header = e.Result.Headers[InvokeResultDescriptor.CONNECTION_ID];
                    if (connection_header != null)
                    {
                        connectionId = connection_header.Value;
                    }
                }

                if (connectionId == Connection)
                {
                    // Commit or Rollback Transaction
                    MdxQueryArgs query_args = e.UserState as MdxQueryArgs;
                    if (query_args != null)
                    {
                        if (query_args.Type == QueryTypes.CommitTransaction ||
                            query_args.Type == QueryTypes.RollbackTransaction)
                        {
                            if (e.Result.ContentType == InvokeContentType.UpdateResult)
                            {
                                List<String> results = XmlSerializationUtility.XmlStr2Obj<List<String>>(e.Result.Content);
                                if (results != null)
                                {
                                    var errors = results.Where(res => !String.IsNullOrEmpty(res));
                                    StringBuilder sb = new StringBuilder();
                                    //if (errors.Count() == 0)
                                    //    AnalysisTransactionManager.CloseTransaction(Connection);
                                    //else
                                    //{
                                        foreach (var error in errors)
                                        {
                                            sb.AppendLine(error);
                                        }
                                        if (!String.IsNullOrEmpty(sb.ToString()))
                                        {
                                            LogManager.LogError(this, sb.ToString());
                                        }
                                    //}

                                    // В случае ошибки считаем что транзакция закрыта. И кэш чистим.
                                    OlapTransactionManager.CloseTransaction(Connection);
                                }
                            }
                        }
                    }
                }
            }
        }
        void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            bool stopWaiting = true;
            try
            {
                if (e.Error != null)
                {
                    LogManager.LogError(this, e.Error.ToString());
                    return;
                }

                if (e.Result.ContentType == InvokeContentType.Error)
                {
                    LogManager.LogError(this, e.Result.Content);
                    return;
                }

                MdxQueryArgs mdx_args = e.UserState as MdxQueryArgs;
                if(mdx_args != null)
                {
                    CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
                    InitializeTuple(cs_descr);

                    // Зачитываем метаданные куба в целом
                    stopWaiting = false;
                    LogManager.LogInformation(this, this.Name + " - Loading cube metadata.");
                    MetadataQuery args = CommandHelper.CreateGetCubeMetadataArgs(Connection, CubeName, MetadataQueryType.GetCubeMetadata_AllMembers);
                    OlapDataLoader.LoadData(args, args);
                }

                MetadataQuery metadata_args = e.UserState as MetadataQuery;
                if (metadata_args != null)
                {
                    CubeDefInfo cs_descr = XmlSerializationUtility.XmlStr2Obj<CubeDefInfo>(e.Result.Content);
                    m_CopyControl.InitializeMetadata(cs_descr);
                }
            }
            finally
            {
                if (stopWaiting)
                    IsWaiting = false;
            }
        }
        void service_GetRootMembersCompleted(DataLoaderEventArgs e, MemberTreeNode parentNode)
        {
            membersTree.IsWaiting = false;
            membersTree.IsFullLoaded = true;

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                ClearTree();
                membersTree.IsError = true;

                SetFilterBuilderToError();
                return;
            }

            List<MemberData> members = new List<MemberData>();
            if (!String.IsNullOrEmpty(e.Result.Content))
            {
                CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
                members = QueryProvider.GetMembers(cellSet);
            }

            CreateChildNodes(null, members);

            //            ClearCustomSelection();

            if (membersTree.Items.Count > 0)
            {
                MemberTreeNode node = membersTree.Items[0] as MemberTreeNode;
                SelectNode(node);
            }

            if (!m_LevelPropertiesIsLoaded)
                LoadLevelProperties();
        }
        void m_StorageManager_ActionCompleted(object sender, DataLoaderEventArgs e)
        {
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            StorageActionArgs args = e.UserState as StorageActionArgs;
            if (args != null)
            {
                if (args.ActionType == StorageActionTypes.GetList ||
                    args.ActionType == StorageActionTypes.Clear ||
                    args.ActionType == StorageActionTypes.Delete)
                {
                    List<ObjectStorageFileDescription> list = XmlSerializationUtility.XmlStr2Obj<List<ObjectStorageFileDescription>>(e.Result.Content);
                    m_List.Initialize(list);
                    m_List.IsWaiting = false;
                }
            }
        }
コード例 #12
0
        void StorageManager_ActionCompleted(object sender, DataLoaderEventArgs e)
        {
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            StorageActionArgs args = e.UserState as StorageActionArgs;
            if (args != null)
            {
                if (args.ActionType == StorageActionTypes.Load)
                {
                    ImportMdxLayoutInfo(e.Result.Content);
                }
            }
        }
        void Loader_DataLoaded(object sender, DataLoaderEventArgs e)
        {            

            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                this.m_Clear.Visibility = System.Windows.Visibility.Collapsed;
                this.viewer.Content = e.Error.ToString();
                this.IsWaiting = false;
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                this.m_Clear.Visibility = System.Windows.Visibility.Collapsed;
                this.viewer.Content = e.Result.Content;
                this.IsWaiting = false;
                return;
            }

            try
            {
                CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
                OnDatesLoaded(cs_descr);
                UpdateGridCells();
                this.IsWaiting = false;
            }
            catch (Exception exc)
            {
                this.IsWaiting = false;
                this.m_Clear.Visibility = System.Windows.Visibility.Collapsed;
                LogManager.LogError(this, exc.Message);
                throw new Exception(exc.Message);
                //this.viewer.Content = exc.Message;
                //throw exc;
            }
            //CellSetData cs_descr = XmlSerializationUtility.XmlStr2Obj<CellSetData>(e.Result);
                        
        }
 void GetCubes_InvokeCommandCompleted(DataLoaderEventArgs e, CustomTreeNode parentNode)
 {
     OlapDataLoader.DataLoaded -= new EventHandler<DataLoaderEventArgs>(OlapDataLoader_DataLoaded);
     List<CubeDefInfo> cubes = XmlSerializationUtility.XmlStr2Obj<List<CubeDefInfo>>(e.Result.Content);
     InitCubesList(cubes);
 }
        void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            CustomTreeNode parentNode = null;

            // Метаданные
            UserSchemaWrapper<MetadataQuery, CustomTreeNode> metadata_wrapper = e.UserState as UserSchemaWrapper<MetadataQuery, CustomTreeNode>;
            if (metadata_wrapper != null && metadata_wrapper.Schema.QueryType == MetadataQueryType.GetCubes)
            {
                Cubes_ComboBox.Clear();
            }

            if (e.Error != null)
            {
                m_CubeBrowser.ShowErrorInTree(parentNode);
                if (metadata_wrapper != null && metadata_wrapper.Schema.QueryType == MetadataQueryType.GetCubes)
                {
                    Cubes_ComboBox.IsEnabled = false;
                    Cubes_ComboBox.Clear();
                }
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                if (metadata_wrapper != null && metadata_wrapper.Schema.QueryType == MetadataQueryType.GetCubes)
                {
                    Cubes_ComboBox.IsEnabled = false;
                    Cubes_ComboBox.Clear();
                }
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            if (metadata_wrapper != null)
            {
                switch (metadata_wrapper.Schema.QueryType)
                {
                    case MetadataQueryType.GetCubes:
                        GetCubes_InvokeCommandCompleted(e, parentNode);
                        break;
                }
            }
        }
 void Raise_DataLoaded(DataLoaderEventArgs args)
 {
     EventHandler<DataLoaderEventArgs> handler = this.DataLoaded;
     if (handler != null)
     {
         handler(this, args);
     }
 }
        void LoadSetWithAscendants_InvokeCommandCompleted(DataLoaderEventArgs e)
        {
            if (e.Result.ContentType == InvokeContentType.Error)
            {
                ClearTree();
                membersTree.IsError = true;

                SetFilterBuilderToError();
                return;
            }

            List<MemberData> members = new List<MemberData>();
            if (!String.IsNullOrEmpty(e.Result.Content))
            {
                CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
                members = QueryProvider.GetMembers(cellSet);
            }

            if (members != null)
            {
                #region Строим иерархию c предками
                foreach (MemberData info in members)
                {
                    OlapMemberInfo memberInfo = OlapMemberInfoHierarchy.AddMemberToHierarchy(info);
                }
                #endregion Строим иерархию c предками

                if (SelectedInfo.Count == 0 && !String.IsNullOrEmpty(m_SelectedSet))
                {
                    //Читаем данные о выбранных элементах
                    String query = DataManager.GetMembers(m_SelectedSet);
                    LogManager.LogInformation(this, this.Name + " - Loading selected members.");
                    MdxQueryArgs query_args = CommandHelper.CreateMdxQueryArgs(Connection, query);
                    OlapDataLoader.LoadData(query_args, new UserSchemaWrapper<MemberChoiceQueryType, MemberTreeNode>(MemberChoiceQueryType.GetMembers, null));
                }
                else
                {
                    #region Устанавливаем нужные состояния для элементов
                    SetMembersInfoToNewState(OlapMemberInfoHierarchy, SelectedInfo.ToList<MemberChoiceSettings>(), SelectStates.Selected_With_Children_Has_Excluded, SelectStates.Selected_With_Children);
                    SetMembersInfoToNewState(OlapMemberInfoHierarchy, SelectedInfo.ToList<MemberChoiceSettings>(), SelectStates.Not_Selected, SelectStates.Not_Selected);
                    //SetMembersInfoToNewState(OlapMemberInfoHierarchy, SelectedInfo.ToList<MemberChoiceSettings>(), SelectStates.Selected_Self, SelectStates.Not_Selected);
                    SetMembersInfoToNewState(OlapMemberInfoHierarchy, SelectedInfo.ToList<MemberChoiceSettings>(), SelectStates.Labeled_As_Parent, SelectStates.Not_Selected);
                    SetMembersInfoToNewState(OlapMemberInfoHierarchy, SelectedInfo.ToList<MemberChoiceSettings>(), SelectStates.Selected_Self, SelectStates.Selected_Self);
                    #endregion Устанавливаем нужные состояния для элементов
                }
            }
            //GetRootMembersCount();
            Load();
        }
        void StorageManager_ActionCompleted(object sender, DataLoaderEventArgs e)
        {
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            StorageActionArgs args = e.UserState as StorageActionArgs;
            if (args != null)
            {
                if (args.ActionType == StorageActionTypes.Load)
                {
                    ValueCopySettingsWrapper wrapper = XmlSerializationUtility.XmlStr2Obj<ValueCopySettingsWrapper>(e.Result.Content);
                    m_CopyControl.Initialize(wrapper);
                }
            }
        }
        void GetMembers_InvokeCommandCompleted(DataLoaderEventArgs e)
        {
            if (e.Result.ContentType == InvokeContentType.Error)
            {
                ClearTree();
                membersTree.IsError = true;
                return;
            }

            List<MemberData> members = new List<MemberData>();
            if (!String.IsNullOrEmpty(e.Result.Content))
            {
                CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
                members = QueryProvider.GetMembers(cellSet);
            }

            if (members != null)
            {
                foreach (MemberData wrapper in members)
                {
                    OlapMemberInfo memberInfo = OlapMemberInfoHierarchy.FindMember(wrapper.UniqueName);

                    //Если элемент найден, то переводим в новое состояние
                    if (memberInfo != null)
                    {
                        memberInfo.SetNewState(SelectStates.Selected_Self);
                    }
                }
            }
        }
        void Loader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            IsBusy = false;

            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            //CellSetData cs_descr = XmlSerializationUtility.XmlStr2Obj<CellSetData>(e.Result);
            CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
            OnDatesLoaded(cs_descr);

            UpdateDates();
        }
        void Service_GetChildrenMembersCompleted(DataLoaderEventArgs e, MemberTreeNode parentNode)
        {
            if (e.Result.ContentType == InvokeContentType.Error)
            {
                ClearTree();
                membersTree.IsError = true;
                return;
            }

            List<MemberData> members = new List<MemberData>();
            if (!String.IsNullOrEmpty(e.Result.Content))
            {
                CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
                members = QueryProvider.GetMembers(cellSet);
            }

            CreateChildNodes(parentNode, members);
        }
		void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
		{
			bool stopWaiting = true;

			try
			{
				// Exception
				if (e.Error != null)
				{
					LogManager.LogError(this, e.Error.ToString());
					return;
				}

				// Exception or Message from Olap-Service
				if (e.Result.ContentType == InvokeContentType.Error)
				{
					LogManager.LogError(this, e.Result.Content);
					return;
				}

				PivotGrid.Focus();

				if (e.UserState != null && e.UserState.ToString() == "ValueCopyDialog_OkButton")
				//ValueCopyControl copy = e.UserState as ValueCopyControl;
				//if (copy != null)
				{
					stopWaiting = false;
					RunServiceCommand(ServiceCommandType.Refresh);
					return;
				}


				ValueDeliveryControl dilivery = e.UserState as ValueDeliveryControl;
				if (dilivery != null)
				{
					if (!string.IsNullOrEmpty(e.Result.Content))
					{
						CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
						dilivery.InitializeMembersList(new CellSetDataProvider(cs_descr));
					}
					return;
				}

				PivotInitializeArgs args = e.UserState as PivotInitializeArgs;
				if (args != null)
				{
					if (!string.IsNullOrEmpty(e.Result.Content))
					{
						CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
						Initialize(cs_descr);
					}
					else
					{
						Initialize(null);
					}
					return;
				}

				PerformMemberActionArgs action_args = e.UserState as PerformMemberActionArgs;
				if (action_args != null)
				{
					MemberActionCompleted(e);
					return;
				}

				if (e.UserState != null && e.UserState is ServiceCommandType)
				{
					ServiceCommandType actionType = (ServiceCommandType)(ServiceCommandType.Parse(typeof(ServiceCommandType), e.UserState.ToString(), true));
					// Save to File
					if (actionType == ServiceCommandType.ExportToExcel)
					{
						if (ExportToExcelFile)
						{
							SaveToFile(e.Result.Content);
							return;
						}
					}
					else
					{
						if (!string.IsNullOrEmpty(e.Result.Content))
						{
							CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
							Initialize(cs_descr);
						}
					}

					UpdateButtons();
					ServiceCommandCompleted(actionType);
					return;
				}

				//PivotGridToolBarInfo toolbar_args = e.UserState as PivotGridToolBarInfo;
				//if (toolbar_args != null)
				//{
				//    if (!string.IsNullOrEmpty(e.Result.Content))
				//    {
				//        toolbar_args = XmlSerializationUtility.XmlStr2Obj<PivotGridToolBarInfo>(e.Result.Content);
				//        UpdateToolbarButtons(toolbar_args);
				//    }
				//    //this.Focus();
				//    return;
				//}

				//UpdateCubeArgs update_Args = e.UserState as UpdateCubeArgs;
				//if (update_Args != null)
				List<UpdateEntry> entries = e.UserState as List<UpdateEntry>;
				if (entries != null)
				{
					// Результат - коллекция строк. Если на какой-то ячейке произошла ошибка, то в соотв. строке будет ее текст
					List<String> results = XmlSerializationUtility.XmlStr2Obj<List<String>>(e.Result.Content);
					if (results != null && results.Count == entries.Count)
					{
						StringBuilder sb = new StringBuilder();
						var successful = new List<UpdateEntry>();
						for (int i = 0; i < results.Count; i++)
						{
							if (String.IsNullOrEmpty(results[i]))
							{
								// No error
								entries[i].Error = String.Empty;
								// Update is successful. 
								successful.Add(entries[i]);
								// Update is successful. Remove this change from local cache
								PivotGrid.LocalChanges.RemoveChange(entries[i]);
							}
							else
							{
								// Error message
								entries[i].Error = results[i];
								sb.AppendLine(results[i]);
								PivotGrid.LocalChanges.Add(entries[i]);
							}
						}
						// Add cell changes to Transaction cache
						if (successful.Count > 0)
						{
							OlapTransactionManager.AddPendingChanges(Connection, successful);
						}

						if (!String.IsNullOrEmpty(sb.ToString()))
						{
							LogManager.LogError(this, sb.ToString());
						}
					}

					UpdateEditToolBarButtons();
					UpdateCubeCompleted();
					//this.Focus();
					return;
				}

				ValueCopyControl copyControl = e.UserState as ValueCopyControl;
				if (copyControl != null)
				{
					CubeDefInfo cs_descr = XmlSerializationUtility.XmlStr2Obj<CubeDefInfo>(e.Result.Content);
					m_CubeMetaData = cs_descr;
					copyControl.IsBusy = false;
					copyControl.InitializeMetadata(cs_descr);
				}

				MemberInfoWrapper<MetadataQuery> metadata_args = e.UserState as MemberInfoWrapper<MetadataQuery>;
				if (metadata_args != null)
				{
					switch (metadata_args.UserData.QueryType)
					{
						case MetadataQueryType.GetLevelProperties:
							List<LevelPropertyInfo> properties = XmlSerializationUtility.XmlStr2Obj<List<LevelPropertyInfo>>(e.Result.Content);
							m_LevelProperties[metadata_args.Member.HierarchyUniqueName] = properties;
							LoadMemberAttributes(metadata_args.Member, properties);
							break;
					}
				}

				UserSchemaWrapper<String, CellInfo> user_wrapper = e.UserState as UserSchemaWrapper<String, CellInfo>;
				if (user_wrapper != null && user_wrapper.Schema == "DRILLTHROUGH_CELL")
				{
					if (!String.IsNullOrEmpty(e.Result.Content))
					{
						DataTableWrapper tableWrapper = XmlSerializationUtility.XmlStr2Obj<DataTableWrapper>(e.Result.Content);
						ShowDrillthroughResult(user_wrapper.UserData, tableWrapper);
					}
				}

				SortPropertiesControl sortControl = e.UserState as SortPropertiesControl;
				if (sortControl != null)
				{
					List<MeasureInfo> list = XmlSerializationUtility.XmlStr2Obj<List<MeasureInfo>>(e.Result.Content);
					sortControl.InitializeMeasuresList(list);
				}

				//MemberInfoWrapper<MemberChoiceQuery> member_args = e.UserState as MemberInfoWrapper<MemberChoiceQuery>;
				//if (member_args != null)
				if (e.UserState != null && e.UserState.ToString() == "CUSTOM_MEMBER_PROPERTIES")
				{
					//switch (member_args.UserData.QueryType)
					{
						//case MemberChoiceQueryType.GetMember:

						MemberData member = null;
						if (!String.IsNullOrEmpty(e.Result.Content))
						{
							CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
							if (cellSet != null && cellSet.Axes.Count > 0 && cellSet.Axes[0].Members.Count > 0)
								member = cellSet.Axes[0].Members[0];
						}

						if (member != null)
						{
							ShowMemberAttributes(member);
						}
						else
						{
							MessageBox.Show(Localization.PivotGrid_CustomProperties_NotFound, Localization.Warning, MessageBoxButton.OK);
						}
						//break;
					}
				}
			}
			finally
			{
				if (stopWaiting)
					IsWaiting = false;
			}
		}
        void FindMembers_InvokeCommandCompleted(DataLoaderEventArgs e, MemberTreeNode node_)
        {
            findResultTree.Items.Clear();
            m_Find_Count.Text = "0";

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                findResultTree.IsError = true;
                return;
            }

            List<MemberData> members = new List<MemberData>();
            if (!String.IsNullOrEmpty(e.Result.Content))
            {
                CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
                members = QueryProvider.GetMembers(cellSet);
            }

            //ClearTree();
            // CreateChildNodes(null, members);

            List<OlapMemberInfo> infos = new List<OlapMemberInfo>();

            foreach (MemberData wrapper in members)
            {
                // Каждый из элементов помещаем в иерархию
                OlapMemberInfo info = OlapMemberInfoHierarchy.AddMemberToHierarchy(wrapper);
                if (info != null)
                {
                    infos.Add(info);
                }
            }

            foreach (OlapMemberInfo info in infos)
            {
                MemberTreeNode node = null;

                node = new MemberTreeNode(info, MultiSelect);
                node.MemberVisualizationType = MemberVisualizationType;
                node.Expanded += new RoutedEventHandler(findedNode_DblClick);
                node.Collapsed += new RoutedEventHandler(findedNode_DblClick);

                findResultTree.Items.Add(node);
            }

            m_Find_Count.Text = infos.Count.ToString();
        }
		void StorageManager_ActionCompleted(object sender, DataLoaderEventArgs e)
		{
			if (e.Error != null)
			{
				LogManager.LogError(this, e.Error.ToString());
				return;
			}

			if (e.Result.ContentType == InvokeContentType.Error)
			{
				LogManager.LogError(this, e.Result.Content);
				return;
			}

			StorageActionArgs args = e.UserState as StorageActionArgs;
			if (args != null)
			{
				if (args.ActionType == StorageActionTypes.Load)
				{
					List<String> list = XmlSerializationUtility.XmlStr2Obj<List<String>>(e.Result.Content);
					List<CellConditionsDescriptor> conditions = new List<CellConditionsDescriptor>();
					if (list != null)
					{
						foreach (var item in list)
						{
							CellConditionsDescriptor descr = CellConditionsDescriptor.Deserialize(item);
							if (descr != null)
								conditions.Add(descr);
						}
						m_CustomCellConditionsEditor.Initialize(conditions);
					}
				}
			}
		}
        void GetAscendants_InvokeCommandCompleted(DataLoaderEventArgs e)
        {
            if (e.Result.ContentType == InvokeContentType.Error)
            {
                ClearTree();
                membersTree.IsError = true;
                return;
            }

            List<MemberData> members = new List<MemberData>();
            if (!String.IsNullOrEmpty(e.Result.Content))
            {
                CellSetData cellSet = CellSetData.Deserialize(e.Result.Content);
                members = QueryProvider.GetMembers(cellSet);
            }

            List<OlapMemberInfo> infos = new List<OlapMemberInfo>();

            foreach (MemberData member in members)
            {
                // Каждый из элементов помещаем в иерархию
                OlapMemberInfo info = OlapMemberInfoHierarchy.AddMemberToHierarchy(member);
                if (info != null)
                {
                    infos.Add(info);
                }
            }

            foreach (OlapMemberInfo info in infos)
            {
                MemberTreeNode node = null;

                //Если родительский узел не задан, то узел добавится в корень
                if (m_TreeNodes.ContainsKey(info.UniqueName))
                {
                    node = m_TreeNodes[info.UniqueName];
                }

                if (node == null)
                {
                    node = new MemberTreeNode(info, MultiSelect);
                    node.MemberVisualizationType = MemberVisualizationType;
                    node.IsPreloaded = true;
                    node.Special_MouseDoubleClick += new EventHandler<CustomEventArgs<CustomTreeNode>>(node_SpecialNodeExpanded);
                    node.Expanded += new RoutedEventHandler(MemberNode_Expanded);

                    //Если есть дочерние, то добавляем фиктивный узел для отображения [+] напротив данного узла
                    if (!node.IsExpanded /*&& !node.IsReloadAll*/ && info.HasChildren)
                    {
                        if (node.Items.Count == 0)
                            node.IsWaiting = true;
                    }

                    //node.Expanded += new RoutedEventHandler(FindMemberNode_Expanded);
                    m_TreeNodes[info.UniqueName] = node;

                    MemberTreeNode parent = null;
                    String parentUniqueName = String.Empty;
                    if (info.Info != null)
                    {
                        PropertyData prop = info.Info.GetMemberProperty(MemberData.PARENT_UNIQUE_NAME_PROPERTY);
                        if (prop != null && prop.Value != null)
                        {
                            parentUniqueName = prop.Value.ToString();
                        }
                    }

                    if (!String.IsNullOrEmpty(parentUniqueName))
                    {
                        //Если родительский узел не задан, то узел добавится в корень
                        if (m_TreeNodes.ContainsKey(parentUniqueName))
                        {
                            parent = m_TreeNodes[parentUniqueName];
                        }
                    }

                    if (parent == null)
                    {
                        membersTree.IsFullLoaded = false;
                        membersTree.Items.Add(node);
                        membersTree.IsWaiting = false;
                        //membersTree.IsReloadAll = true;
                    }
                    else
                    {
                        if (parent.Items.Count < parent.MemberInfo.CubeChildrenCount)
                            parent.IsFullLoaded = false;

                        parent.Items.Add(node);
                        parent.IsWaiting = false;
                        parent.IsExpanded = true;
                        //parent.IsReloadAll = true;
                    }
                }
            }

            MemberTreeNode memberNode = null;
            if (infos.Count > 0 && m_TreeNodes.ContainsKey(infos[infos.Count -1].UniqueName))
            {
                memberNode = m_TreeNodes[infos[infos.Count - 1].UniqueName];
            }

            if (memberNode != null)
            {
                // Если узел в дереве найден, то нужно просто переключиться на него
                SelectNode(memberNode);

                tabControl.TabCtrl.SelectedItem = membersTab;
            }

            //membersList.Initialize(infos);
            ////Получаем все родительские элементы для указанного
            //List<MemberDataWrapper> dict = GetAscendants(uniqueName);
            //if (dict != null && dict.Count > 0)
            //{
            //    bool allParentIsLoaded = true;
            //    TreeListNode parentNode = null;
            //    //Каждый из предков и сам узел в дерево
            //    foreach (MemberDataWrapper de in dict)
            //    {
            //        TreeListNode node = PreloadChildrenNodes(parentNode, de);
            //        if (node == null)
            //        {
            //            allParentIsLoaded = false;
            //            break;
            //        }

            //        parentNode = node;
            //    }

            //    //Если процесс дозагрузки дочерних для всех родителей прошел успешно
            //    if (allParentIsLoaded && parentNode != null)
            //    {
            //        Tree.SetFocusedNode(parentNode);
            //        TabControl.SelectedTabPageIndex = 0;
            //        //Устанавливаем фокус на дерево
            //        Tree.Focus();
            //    }
            //}
        }
        void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            MemberTreeNode parentNode = null;

            UserSchemaWrapper<MemberChoiceQueryType, MemberTreeNode> wrapper = e.UserState as UserSchemaWrapper<MemberChoiceQueryType, MemberTreeNode>;
            if (wrapper != null)
            {
                if (wrapper.Schema != MemberChoiceQueryType.GetAscendants &&
                    wrapper.Schema != MemberChoiceQueryType.GetMember &&
                    wrapper.Schema != MemberChoiceQueryType.GetMembers &&
                    wrapper.Schema != MemberChoiceQueryType.LoadSetWithAscendants &&
                    wrapper.Schema != MemberChoiceQueryType.FindMembers)
                {
                    parentNode = wrapper.UserData;
                    if (parentNode != null)
                    {
                        parentNode.IsWaiting = false;
                    }
                    else
                    {
                        membersTree.IsWaiting = false;
                    }
                }
            }


            MetadataQuery args = e.UserState as MetadataQuery;

            if (e.Error != null)
            {
                if (args != null)
                {
                    if (args.QueryType == MetadataQueryType.GetLevels)
                        Levels_ComboBox.IsError = true;
                }

                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                if (args != null)
                {
                    if (args.QueryType == MetadataQueryType.GetLevels)
                        Levels_ComboBox.IsError = true;
                }

                LogManager.LogError(this, e.Result.Content);
                return;
            }

            if (args != null)
            {
                switch (args.QueryType)
                {
                    case MetadataQueryType.GetLevels:
                        List<LevelInfo> levels = XmlSerializationUtility.XmlStr2Obj<List<LevelInfo>>(e.Result.Content);
                        InitLevelsList(levels);
                        break;
                    case MetadataQueryType.GetLevelProperties:
                        filterBuilder.Tree.IsWaiting = false;
                        List<LevelPropertyInfo> properties = XmlSerializationUtility.XmlStr2Obj<List<LevelPropertyInfo>>(e.Result.Content);
                        m_Properties = properties;

                        MemberTreeNode treeNode = membersTree.SelectedItem as MemberTreeNode;
                        if (treeNode != null)
                        {
                            m_CurrentMember = treeNode.MemberInfo.Info;
                        }
                        else
                        {
                            m_CurrentMember = null;
                        }
                        ShowMemberProperties();
                        filterBuilder.Initialize(properties);
                        m_LevelPropertiesIsLoaded = true;

                        break;
                }
            }

            if (wrapper != null)
            {
                switch (wrapper.Schema)
                {
                    //case MemberChoiceQueryType.GetRootMembersCount:
                    //    Service_GetRootMembersCountCompleted(e, parentNode);
                    //    break;
                    case MemberChoiceQueryType.GetRootMembers:
                        service_GetRootMembersCompleted(e, parentNode);
                        break;
                    case MemberChoiceQueryType.GetChildrenMembers:
                        Service_GetChildrenMembersCompleted(e, parentNode);
                        break;
                    case MemberChoiceQueryType.FindMembers:
                        FindMembers_InvokeCommandCompleted(e, parentNode);
                        break;
                    case MemberChoiceQueryType.GetAscendants:
                        GetAscendants_InvokeCommandCompleted(e);
                        break;
                    case MemberChoiceQueryType.GetMember:
                        GetMember_InvokeCommandCompleted(e);
                        break;
                    case MemberChoiceQueryType.LoadSetWithAscendants:
                        LoadSetWithAscendants_InvokeCommandCompleted(e);
                        break;
                    case MemberChoiceQueryType.GetMembers:
                        GetMembers_InvokeCommandCompleted(e);
                        break;
                }
            }
        }
        void Loader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            CustomTreeNode parentNode = e.UserState as CustomTreeNode;
            if (parentNode != null)
            {
                parentNode.IsWaiting = false;
            }
            else
            {
                Tree.IsWaiting = false;
            }

            if (e.Error != null)
            {
                ShowErrorInTree(parentNode);
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                ShowErrorInTree(parentNode);
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            List<CubeDefInfo> cubes = XmlSerializationUtility.XmlStr2Obj<List<CubeDefInfo>>(e.Result.Content);
            if (cubes != null)
            {
                foreach (CubeDefInfo info in cubes)
                {
                    if (ShowAllCubes || info.Type == CubeInfoType.Cube)
                    {
                        CubeTreeNode node = new CubeTreeNode(info);
                        // Кубы будут конечными узлами. Двойной клик на них будет равнозначен выбору
                        node.Expanded += new RoutedEventHandler(node_Expanded);
                        node.Collapsed += new RoutedEventHandler(node_Collapsed);

                        if (parentNode == null)
                            Tree.Items.Add(node);
                        else
                            parentNode.Items.Add(node);
                    }
                }
            }
        }