Exemple #1
0
            /// <summary>
            /// Static constructor that inserts the most recently used providers
            /// first.
            /// </summary>
            internal static ProviderList CreateProviderList(MruConnections history)
            {
                if (history == null)
                {
                    throw new ArgumentNullException("history");
                }

                ProviderList list = new ProviderList();

                // Add all providers in the order of their appearance in
                // the connection history.
                foreach (var mruItem in history.Datasources)
                {
                    var provider = mruItem.Provider;

                    if (provider == ProviderType.Undefined)
                    {
                        continue;
                    }

                    if (list.Contains(provider))
                    {
                        continue;
                    }

                    var listItem = new ProviderListItem(provider, provider.ToString());
                    list.items.Add(listItem);
                }

                var enumValues = System.Enum.GetValues(typeof(ProviderType));

                foreach (ProviderType e in enumValues)
                {
                    if (e == ProviderType.Undefined)
                    {
                        continue;
                    }

                    if (list.Contains(e))
                    {
                        continue;
                    }

                    var listItem = new ProviderListItem(e, e.ToString());
                    list.items.Add(listItem);
                }

                return(list);
            }