/***************************************************************************/ public void TransferWindowLocation(string strNamePrefix, SavedWindowLocation ThisLocation) { string strTemp = string.Empty; if (m_eTransferMode == TransferMode.Write) { strTemp = string.Format("{0} {1} {2} {3} {4}", ThisLocation.m_rcBounds.X, ThisLocation.m_rcBounds.Y, ThisLocation.m_rcBounds.Width, ThisLocation.m_rcBounds.Height, ThisLocation.m_fScale); } TransferString(strNamePrefix + "Dimensions", ref strTemp); if (m_eTransferMode == TransferMode.Read) { string[] astrComponents = strTemp.Split(' '); ThisLocation.m_rcBounds.X = float.Parse(astrComponents[0]); ThisLocation.m_rcBounds.Y = float.Parse(astrComponents[1]); ThisLocation.m_rcBounds.Width = float.Parse(astrComponents[2]); ThisLocation.m_rcBounds.Height = float.Parse(astrComponents[3]); ThisLocation.m_fScale = double.Parse(astrComponents[4]); } /// Separate values. TransferBool(strNamePrefix + "Maximized", ref ThisLocation.m_bMaximized); return; }
/************************************************************************************/ public SavedWindowLocation Copy() { SavedWindowLocation NewCopy = new SavedWindowLocation(); NewCopy.m_rcBounds = m_rcBounds; NewCopy.m_bMaximized = m_bMaximized; NewCopy.m_fScale = m_fScale; return(NewCopy); }
/************************************************************************************/ protected override void OnLocationChanged(EventArgs e) { base.OnLocationChanged(e); if (WindowState != WindowState.Maximized) /// If the location changes because of maximize, this lies. { if (m_SavedWindowLocation != null) { m_LastSavedWindowLocation = m_SavedWindowLocation.Copy(); m_SavedWindowLocation.m_rcBounds.X = (float)Left; m_SavedWindowLocation.m_rcBounds.Y = (float)Top; } } return; }
/************************************************************************************/ public CustomBaseWindow(SavedWindowLocation ThisSavedLocation) { m_SavedWindowLocation = ThisSavedLocation; SharedConstructor(); return; }
/***************************************************************************/ 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; }