예제 #1
0
        private void ListViewBehaviors_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            var source = (ObservableCollection <object>)ConnectionListView.ItemsSource;

            if (source != null)
            {
                ConnectionListView.ScrollTo(source.First(), ScrollToPosition.Start, true);
            }
        }
예제 #2
0
        /// <summary>
        /// Display the server information in the listview.
        /// </summary>
        private void ShowServerInformation()
        {
            ListViewItem ServerListViewItem;

            try
            {
                ServerListView.BeginUpdate();

                // Clear control
                ServerListView.Items.Clear();

                // Initialize the server settings
                SqlServerSelection.Settings.Initialize(true);

                // Initialize the server information settings
                SqlServerSelection.Information.Initialize(true);

                // Initialize the server
                SqlServerSelection.Initialize(true);

                // Iterate through all the properties and add each one to the list
                foreach (Property prop in SqlServerSelection.Settings.
                         Properties)
                {
                    ServerListViewItem = ServerListView.Items.Add(prop.
                                                                  Name);
                    ServerListViewItem.SubItems.Add(prop.Value == null ?
                                                    string.Empty : prop.Value.ToString());
                }

                // Iterate through all the properties and add each one to the list
                foreach (Property prop in SqlServerSelection.Properties)
                {
                    ServerListViewItem = ServerListView.Items.Add(prop.Name);
                    ServerListViewItem.SubItems.Add(prop.Value == null ?
                                                    string.Empty : prop.Value.ToString());
                }

                ServerListView.EndUpdate();

                ConnectionListView.BeginUpdate();

                // Clear control
                ConnectionListView.Items.Clear();

                // Iterate through all the properties and add each one to the list
                foreach (Property prop in SqlServerSelection.Information.Properties)
                {
                    ServerListViewItem = ConnectionListView.Items.Add(
                        prop.Name);
                    ServerListViewItem.SubItems.Add(prop.Value == null ?
                                                    string.Empty : prop.Value.ToString());
                }

                ConnectionListView.EndUpdate();
            }
            catch (SmoException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
        }