Пример #1
0
        private void header_VisibleChanged(object sender, EventArgs e)
        {
            ExchangeColumnHeader exchangeColumnHeader = (ExchangeColumnHeader)sender;

            ExTraceGlobals.ProgramFlowTracer.TraceDebug <ObjectPickerForm, string, bool>(0L, "-->ObjectPickerForm.header_VisibleChanged:{0}. Column name = {1}, Column visible = {2}).", this, exchangeColumnHeader.Name, exchangeColumnHeader.Visible);
            if (exchangeColumnHeader.Visible && !this.resultsDataTable.Columns.Contains(exchangeColumnHeader.Name) && this.dataColumnDictionary.ContainsKey(exchangeColumnHeader.Name))
            {
                this.resultsDataTable.Columns.Add(this.dataColumnDictionary[exchangeColumnHeader.Name]);
                ExTraceGlobals.DataFlowTracer.Information(0L, "*--ObjectPickerForm.header_VisibleChanged:{0}. Data column {1} is added, column type:{2}, column expression:{3}.", new object[]
                {
                    this,
                    this.dataColumnDictionary[exchangeColumnHeader.Name].ColumnName,
                    this.dataColumnDictionary[exchangeColumnHeader.Name].DataType,
                    this.dataColumnDictionary[exchangeColumnHeader.Name].Expression
                });
            }
            if (!exchangeColumnHeader.Visible && (string.IsNullOrEmpty(base.ResultListView.SortProperty) || base.ResultListView.SortProperty != exchangeColumnHeader.Name) && this.resultsDataTable.Columns.Contains(exchangeColumnHeader.Name))
            {
                DataColumn column = this.resultsDataTable.Columns[exchangeColumnHeader.Name];
                if (!ObjectPicker.GetIsRequiredDataColumnFlag(column))
                {
                    this.resultsDataTable.Columns.Remove(exchangeColumnHeader.Name);
                    ExTraceGlobals.DataFlowTracer.Information <ObjectPickerForm, string>(0L, "*--ObjectPickerForm.header_VisibleChanged:{0}. Data column {1} is removed.", this, exchangeColumnHeader.Name);
                }
            }
            ExTraceGlobals.ProgramFlowTracer.TraceDebug <ObjectPickerForm>(0L, "<--ObjectPickerForm.header_VisibleChanged:{0}.", this);
        }
Пример #2
0
 public void LoadDataListViewSettings(DataListView listView)
 {
     if (listView == null)
     {
         throw new ArgumentNullException();
     }
     listView.BeginUpdate();
     DataListViewSettings.SerializableDataListViewInfo serializableDataListViewInfo = this.FindSuitableSetting(listView);
     if (serializableDataListViewInfo == null)
     {
         listView.SortDirection = ListSortDirection.Ascending;
     }
     else
     {
         listView.SortDirection       = serializableDataListViewInfo.SortDirection;
         listView.SortProperty        = serializableDataListViewInfo.SortProperty;
         listView.IsColumnsWidthDirty = serializableDataListViewInfo.IsColumnsWidthDirty;
         int       length    = serializableDataListViewInfo.Columns.GetLength(0);
         ArrayList arrayList = new ArrayList(length);
         int       num       = 0;
         for (int i = 0; i < length; i++)
         {
             if (!string.IsNullOrEmpty(serializableDataListViewInfo.Columns[i].ColumnName))
             {
                 ExchangeColumnHeader exchangeColumnHeader = listView.AvailableColumns[serializableDataListViewInfo.Columns[i].ColumnName];
                 exchangeColumnHeader.Visible      = true;
                 exchangeColumnHeader.Width        = serializableDataListViewInfo.Columns[i].ColumnWidth;
                 exchangeColumnHeader.DisplayIndex = num++;
                 arrayList.Add(exchangeColumnHeader);
             }
         }
         if (arrayList.Count > 0)
         {
             foreach (ExchangeColumnHeader exchangeColumnHeader2 in listView.AvailableColumns)
             {
                 exchangeColumnHeader2.Visible = arrayList.Contains(exchangeColumnHeader2);
             }
         }
     }
     listView.EndUpdate();
 }
Пример #3
0
        private void UpdateButtonStates()
        {
            bool flag  = this.displayedColumnsListView.SelectedItems.Count == 1;
            bool flag2 = this.displayedColumnsListView.SelectedItems.Count != 0;
            bool flag3 = false;

            if (flag2)
            {
                foreach (object obj in this.displayedColumnsListView.SelectedItems)
                {
                    ListViewItem         item = (ListViewItem)obj;
                    ExchangeColumnHeader columnFromListItem = this.GetColumnFromListItem(item);
                    if (columnFromListItem.Name == this.list.SelectionNameProperty || (columnFromListItem.Name.Equals("Name") && columnFromListItem.Default))
                    {
                        flag3 = true;
                        break;
                    }
                }
            }
            bool flag4 = true;

            foreach (ExchangeColumnHeader exchangeColumnHeader in this.list.AvailableColumns)
            {
                if (exchangeColumnHeader.Default != this.displayedColumnsListView.Items.ContainsKey(exchangeColumnHeader.Name) || (exchangeColumnHeader.Default && exchangeColumnHeader.DefaultDisplayIndex != this.displayedColumnsListView.Items.IndexOfKey(exchangeColumnHeader.Name)))
                {
                    flag4 = false;
                    break;
                }
            }
            bool enabled  = flag && this.list.AllowColumnReorder && this.displayedColumnsListView.SelectedIndices[0] != 0 && this.GetColumnFromListItem(this.displayedColumnsListView.SelectedItems[0]).IsReorderable&& this.GetColumnFromListItem(this.displayedColumnsListView.Items[this.displayedColumnsListView.SelectedIndices[0] - 1]).IsReorderable;
            bool enabled2 = flag && this.list.AllowColumnReorder && this.displayedColumnsListView.SelectedIndices[0] != this.displayedColumnsListView.Items.Count - 1 && this.GetColumnFromListItem(this.displayedColumnsListView.SelectedItems[0]).IsReorderable&& this.GetColumnFromListItem(this.displayedColumnsListView.Items[this.displayedColumnsListView.SelectedIndices[0] + 1]).IsReorderable;

            this.restoreDefaultsButton.Enabled = !flag4;
            this.moveUpButton.Enabled          = enabled;
            this.moveDownButton.Enabled        = enabled2;
            this.removeButton.Enabled          = (flag2 && !flag3);
            this.addButton.Enabled             = (this.availableColumnsListView.SelectedItems.Count != 0);
            this.addAllButton.Enabled          = (this.availableColumnsListView.Items.Count != 0);
        }
Пример #4
0
 private static void SyncSortSupportDescriptions(DataListView dataListView, UIPresentationProfile uiPresentationProfile, DataTableLoaderView dataTableLoaderView)
 {
     if (uiPresentationProfile != null)
     {
         foreach (ResultsColumnProfile resultsColumnProfile in uiPresentationProfile.DisplayedColumnCollection)
         {
             dataTableLoaderView.SortSupportDescriptions.Add(new SortSupportDescription(resultsColumnProfile.Name, resultsColumnProfile.SortMode, resultsColumnProfile.CustomComparer, resultsColumnProfile.CustomFormatter, resultsColumnProfile.FormatProvider, resultsColumnProfile.FormatString, resultsColumnProfile.DefaultEmptyText));
         }
     }
     using (IEnumerator <ExchangeColumnHeader> enumerator = dataListView.AvailableColumns.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             ExchangeColumnHeader columnHeader = enumerator.Current;
             if (columnHeader.IsSortable)
             {
                 if (!dataTableLoaderView.SortSupportDescriptions.Any((SortSupportDescription obj) => string.Compare(obj.ColumnName, columnHeader.Name, StringComparison.OrdinalIgnoreCase) == 0))
                 {
                     dataTableLoaderView.SortSupportDescriptions.Add(new SortSupportDescription(columnHeader.Name, SortMode.NotSpecified, null, columnHeader.CustomFormatter, columnHeader.FormatProvider, columnHeader.FormatString, columnHeader.DefaultEmptyText));
                 }
             }
         }
     }
 }