Exemplo n.º 1
0
        /***************************************************************************/
        public void TransferPersistentDetailedListViewColumnLayout(string strNamePrefix, PersistentDetailedListView.ColumnLayout ThisLayout)
        {
            /// Transfer the descriptor dictionary.
            List <string> astrColumnAttributeSets = new List <string>();

            if (m_eTransferMode == TransferMode.Write)
            {
                foreach (KeyValuePair <string, PersistentDetailedListView.ColumnLayout.ColumnDesc> ThisPair in ThisLayout.m_ColumnDescDictionary)
                {
                    string strSet = string.Format("{0} {1}", ThisPair.Key, ThisPair.Value.m_fWidth);
                    astrColumnAttributeSets.Add(strSet);
                }
            }
            TransferStringList(strNamePrefix + "ColumnDescriptor", ref astrColumnAttributeSets);
            if (m_eTransferMode == TransferMode.Read)
            {
                ThisLayout.m_ColumnDescDictionary.Clear();
                foreach (string strThisSet in astrColumnAttributeSets)
                {
                    string[] astrAttributes = strThisSet.Split(new string[] { " " }, StringSplitOptions.None);

                    PersistentDetailedListView.ColumnLayout.ColumnDesc NewDesc = new PersistentDetailedListView.ColumnLayout.ColumnDesc();
                    if (double.TryParse(astrAttributes[1], out NewDesc.m_fWidth))
                    {
                        ThisLayout.m_ColumnDescDictionary.Add(astrAttributes[0], NewDesc);
                    }
                }
            }

            /// Transfer the sort order list.
            List <string> astrColumnSortTokenList = new List <string>();

            if (m_eTransferMode == TransferMode.Write)
            {
                foreach (PersistentDetailedListView.ColumnLayout.SortDesc ThisDesc in ThisLayout.m_aColumnSortOrderList)
                {
                    astrColumnSortTokenList.Add(ThisDesc.m_strTag);
                    astrColumnSortTokenList.Add(ThisDesc.m_bSortAscending ? "asc" : "desc");
                }
            }
            TransferStringListAsSingleString(strNamePrefix + "ColumnSortOrder", " ", ref astrColumnSortTokenList);
            if (m_eTransferMode == TransferMode.Read)
            {
                ThisLayout.m_aColumnSortOrderList.Clear();
                for (int iIndex = 0; iIndex < astrColumnSortTokenList.Count; iIndex += 2)
                {
                    PersistentDetailedListView.ColumnLayout.SortDesc NewDesc = new PersistentDetailedListView.ColumnLayout.SortDesc();
                    NewDesc.m_strTag         = astrColumnSortTokenList[iIndex];
                    NewDesc.m_bSortAscending = (astrColumnSortTokenList[iIndex + 1] == "asc");
                    ThisLayout.m_aColumnSortOrderList.Add(NewDesc);
                }
            }

            TransferStringListAsSingleString(strNamePrefix + "ColumnDisplayOrder", " ", ref ThisLayout.m_astrColumnDisplayOrderList);
            TransferWindowLocation(strNamePrefix + "ColumnConfigWindow", ThisLayout.m_ConfigWindowLocation);

            return;
        }
Exemplo n.º 2
0
        /***************************************************************************/
        public PersistentDetailedListView_ColumnSelectionWindow(
            SavedWindowLocation ThisSavedLocation,
            PersistentDetailedListView.ColumnLayout ThisSavedLayout,
            Dictionary <string, TaggedGridViewColumn> ColumnDictionary)
            : base(ThisSavedLocation)
        {
            InitializeComponent();

            m_SavedLayout      = ThisSavedLayout;
            m_ColumnDictionary = ColumnDictionary;

            /// Tally the visible columns.
            foreach (string strThisTag in m_SavedLayout.m_astrColumnDisplayOrderList)
            {
                object objContent = (m_ColumnDictionary[strThisTag].Header as GridViewColumnHeader).Content;
                objContent = UIHelper.DeepCopyXamlObject(objContent);
                m_aShowColumnDestinationList.Add(new SimpleColumnDesc(strThisTag, objContent));
            }

            /// Tally the hidden columns.
            foreach (KeyValuePair <string, TaggedGridViewColumn> ThisPair in m_ColumnDictionary)
            {
                bool bIsDisplayed = m_SavedLayout.m_astrColumnDisplayOrderList.Contains(ThisPair.Key);
                if (!bIsDisplayed)
                {
                    object objContent = (ThisPair.Value.Header as GridViewColumnHeader).Content;
                    objContent = UIHelper.DeepCopyXamlObject(objContent);
                    m_aShowColumnSourceList.Add(new SimpleColumnDesc(ThisPair.Key, objContent));
                }
            }

            /// Tally all columns.
            foreach (KeyValuePair <string, TaggedGridViewColumn> ThisPair in m_ColumnDictionary)
            {
                PersistentDetailedListView.ColumnLayout.SortDesc ThisDesc = null;

                foreach (PersistentDetailedListView.ColumnLayout.SortDesc ThisDesc2 in m_SavedLayout.m_aColumnSortOrderList)
                {
                    if (ThisDesc2.m_strTag == ThisPair.Key)
                    {
                        ThisDesc = ThisDesc2;
                        break;
                    }
                }

                object objContent = (ThisPair.Value.Header as GridViewColumnHeader).Content;
                objContent = UIHelper.DeepCopyXamlObject(objContent);

                if (ThisDesc == null)
                {
                    m_aSortColumnSourceList.Add(new SimpleColumnDesc(ThisPair.Key, objContent));
                }
                else
                {
                    m_aSortColumnDestinationList.Add(new SortedColumnDesc(ThisDesc.m_strTag, objContent, ThisDesc.m_bSortAscending));
                }
            }

            /// Finalize the bindings.
            m_wndViewOrderSourceList.ItemsSource      = m_aShowColumnSourceList;
            m_wndViewOrderDestinationList.ItemsSource = m_aShowColumnDestinationList;
            m_wndSortSourceList.ItemsSource           = m_aSortColumnSourceList;
            m_wndSortDestinationList.ItemsSource      = m_aSortColumnDestinationList;
            return;
        }