示例#1
0
        public static DataTableLoaderView SetDataSource(ObjectList objectList, UIPresentationProfile uiPresentationProfile, DataTableLoader dataTableLoader)
        {
            DataTableLoaderView dataTableLoaderView = (dataTableLoader == null) ? null : DataTableLoaderView.Create(dataTableLoader);

            WinformsHelper.SetDataSource(objectList, uiPresentationProfile, dataTableLoaderView);
            return(dataTableLoaderView);
        }
示例#2
0
 public static void SetDataSource(ObjectList objectList, UIPresentationProfile uiPresentationProfile, DataTableLoaderView dataTableLoaderView)
 {
     if (objectList == null)
     {
         throw new ArgumentNullException("objectList");
     }
     if (!WinformsHelper.CheckDataSource(objectList.DataSource))
     {
         throw new ArgumentException("objectList");
     }
     if (objectList.DataSource != null)
     {
         DataTableLoaderView dataTableLoaderView2 = (objectList.DataSource as AdvancedBindingSource).DataSource as DataTableLoaderView;
         objectList.DataSource = null;
         if (dataTableLoaderView2 != null)
         {
             dataTableLoaderView2.Dispose();
         }
     }
     if (dataTableLoaderView != null)
     {
         WinformsHelper.SyncSortSupportDescriptions(objectList.ListView, uiPresentationProfile, dataTableLoaderView);
         objectList.DataSource = new AdvancedBindingSource
         {
             DataSource = dataTableLoaderView
         };
     }
 }
        private UIPresentationProfile CreateUIPresentationProfile(XElement po, XElement configuration)
        {
            UIPresentationProfile result;

            if (configuration == null)
            {
                result = new UIPresentationProfile();
            }
            else
            {
                IEnumerable <XElement> query = configuration.Elements("DisplayedColumns").Elements("RefColumns").SelectMany((XElement r) => (from c in po.Element("RefColumnsSection").Elements("RefColumns")
                                                                                                                                             where c.Attribute("Name").Value == r.Attribute("Name").Value
                                                                                                                                             select c).Elements("Column")).Union(configuration.Elements("DisplayedColumns").Elements("Column"));
                FilterColumnProfile[] filterColumnCollection = new FilterColumnProfile[0];
                ObjectSchema          filterObjectSchema     = null;
                FilterLanguage        filterLanguage         = FilterLanguage.Ado;
                XElement xelement = configuration.Element("FilterColumns");
                if (this.HasValue(xelement))
                {
                    string text = (string)xelement.Attribute("ObjectSchema");
                    filterColumnCollection = this.GetFilterProfile(xelement.Elements("Column"), text);
                    filterObjectSchema     = ObjectSchema.GetInstance(ObjectSchemaLoader.GetTypeByString(text));
                    filterLanguage         = (this.HasValue(xelement.Attribute("FilterLanguage")) ? ((FilterLanguage)Enum.Parse(typeof(FilterLanguage), (string)xelement.Attribute("FilterLanguage"))) : FilterLanguage.Ado);
                }
                result = new UIPresentationProfile(this.GetColumnProfile(query), filterColumnCollection)
                {
                    DisplayName          = this.GetLocalizedString(configuration.Element("Caption").Value),
                    HideIcon             = (this.HasValue(configuration.Element("HideIcon")) && string.Equals("true", (string)configuration.Element("HideIcon"), StringComparison.InvariantCultureIgnoreCase)),
                    ImageProperty        = (this.HasValue(configuration.Element("ImageColumn")) ? configuration.Element("ImageColumn").Value : string.Empty),
                    UseTreeViewForm      = (this.HasValue(configuration.Element("UseTreeView")) && bool.Parse((string)configuration.Element("UseTreeView"))),
                    SortProperty         = (this.HasValue(configuration.Element("SortProperty")) ? configuration.Element("SortProperty").Value : string.Empty),
                    HelpTopic            = (this.HasValue(configuration.Element("HelpTopic")) ? configuration.Element("HelpTopic").Value : string.Empty),
                    ScopeSupportingLevel = (this.HasValue(configuration.Element("ScopeSupportingLevel")) ? ((ScopeSupportingLevel)Enum.Parse(typeof(ScopeSupportingLevel), (string)configuration.Element("ScopeSupportingLevel"))) : ScopeSupportingLevel.NoScoping),
                    FilterObjectSchema   = filterObjectSchema,
                    FilterLanguage       = filterLanguage,
                    SerializationLevel   = (this.HasValue(configuration.Element("SerializationLevel")) ? ((ExchangeRunspaceConfigurationSettings.SerializationLevel)Enum.Parse(typeof(ExchangeRunspaceConfigurationSettings.SerializationLevel), (string)configuration.Element("SerializationLevel"))) : ExchangeRunspaceConfigurationSettings.SerializationLevel.Partial),
                    MultiSelect          = (!this.HasValue(configuration.Element("MultiSelect")) || bool.Parse((string)configuration.Element("MultiSelect")))
                };
            }
            return(result);
        }
示例#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));
                 }
             }
         }
     }
 }
示例#5
0
        public static FilteredDataTableLoaderView SetFilteredDataSource(DataListView dataListView, UIPresentationProfile uiPresentationProfile, DataTableLoader dataTableLoader)
        {
            FilteredDataTableLoaderView filteredDataTableLoaderView = (dataTableLoader == null) ? null : FilteredDataTableLoaderView.Create(dataTableLoader);

            WinformsHelper.SetDataSource(dataListView, uiPresentationProfile, filteredDataTableLoaderView);
            return(filteredDataTableLoaderView);
        }