Пример #1
0
        private void SetUIControlsContent()
        {
            mLibraryVarsList   = LoadLibraryVarsList();
            mLibraryVarsHelper = new VariablesListViewHelper(mLibraryVarsList, mVariablesParentObj, mVariablesLevel, mContext, General.eRIPageViewMode.Add);
            mLibraryVarsHelper.AllowExpandItems = false;
            xLibraryTabHeaderText.Text          = string.Format("{0} Library ({1})", GingerDicser.GetTermResValue(eTermResKey.Variables), mLibraryVarsList.Count);
            xLibraryTabListView.SetDefaultListDataTemplate(mLibraryVarsHelper);
            xLibraryTabListView.DataSourceList    = mLibraryVarsList;
            xLibraryTabListView.MouseDoubleClick += XLibraryTabListView_MouseDoubleClick;

            mSharedRepoVarsList           = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>();
            mSharedRepoVarsHelper         = new VariablesListViewHelper(mLibraryVarsList, mVariablesParentObj, mVariablesLevel, mContext, General.eRIPageViewMode.AddFromShardRepository);
            xSharedRepoTabHeaderText.Text = string.Format("Shared Repository {0} ({1})", GingerDicser.GetTermResValue(eTermResKey.Variables), mSharedRepoVarsList.Count);
            xSharedRepoTabListView.SetDefaultListDataTemplate(mSharedRepoVarsHelper);
            xSharedRepoTabListView.DataSourceList    = mSharedRepoVarsList;
            xSharedRepoTabListView.MouseDoubleClick += XSharedRepoTabListView_MouseDoubleClick;
        }
        //private void ClearListViewBindings()
        //{
        //    if (mVariabelListHelper != null)
        //    {
        //        mVariabelListHelper.VariabelListItemEvent -= MVariabelListItemInfo_VariabelListItemEvent;
        //        mVariabelListHelper = null;
        //    }

        //    if (mVariabelsListView != null)
        //    {
        //        mVariabelsListView.PreviewDragItem -= ListVars_PreviewDragItem;
        //        mVariabelsListView.ItemDropped -= ListVars_ItemDropped;
        //        mVariabelsListView.List.MouseDoubleClick -= VariabelsListView_MouseDoubleClick;
        //        mVariabelsListView.ClearBindings();
        //        mVariabelsListView.DataSourceList = null;
        //        mVariabelsListView = null;
        //    }
        //}

        //public void ClearBindings()
        //{
        //    xMainFrame.Content = null;
        //    xMainFrame.NavigationService.RemoveBackEntry();

        //    ClearListViewBindings();

        //    BindingOperations.ClearAllBindings(xSelectedItemTitleText);
        //    BindingOperations.ClearAllBindings(xResetValueBtn);
        //    BindingOperations.ClearAllBindings(xAutoValueBtn);
        //    this.ClearControlsBindings();
        //}

        private void SetListView()
        {
            if (mVariabelsListView == null)
            {
                mVariabelsListView               = new UcListView();
                mVariabelsListView.Title         = GingerDicser.GetTermResValue(eTermResKey.Variables);
                mVariabelsListView.ListImageType = Amdocs.Ginger.Common.Enums.eImageType.Variable;

                mVariabelListHelper = new VariablesListViewHelper(GetVariablesList(), mVariabelsParent, mVariablesLevel, mContext, mPageViewMode);
                mVariabelListHelper.VariabelListItemEvent += MVariabelListItemInfo_VariabelListItemEvent;
                mVariabelsListView.SetDefaultListDataTemplate(mVariabelListHelper);

                mVariabelsListView.ListSelectionMode = SelectionMode.Extended;

                mVariabelsListView.PreviewDragItem += ListVars_PreviewDragItem;
                mVariabelsListView.ItemDropped     += ListVars_ItemDropped;

                mVariabelsListView.List.MouseDoubleClick += VariabelsListView_MouseDoubleClick;

                mVariabelsListView.List.SetValue(ScrollViewer.CanContentScrollProperty, true);

                if (mPageViewMode == Ginger.General.eRIPageViewMode.View)
                {
                    mVariabelsListView.IsDragDropCompatible = false;
                }
            }

            if (mVariabelsParent != null)
            {
                mVariabelListHelper.VariablesParent = mVariabelsParent;
                mVariabelListHelper.VariablesLevel  = mVariablesLevel;
                mVariabelListHelper.Variables       = GetVariablesList();
                mVariabelsListView.DataSourceList   = GetVariablesList();
                if (mVariablesLevel != eVariablesLevel.Solution)
                {
                    SharedRepositoryOperations.MarkSharedRepositoryItems(GetVariablesList(), WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>());
                }
            }
            else
            {
                mVariabelListHelper.VariablesParent = null;
                mVariabelListHelper.Variables       = null;
                mVariabelsListView.DataSourceList   = null;
            }
        }