Example #1
0
        private MainWindowValues LoadMainWindowValues(bool ForceRefresh)
        {
            MainWindowValues mwv = new MainWindowValues();

            mwv.CurrentPrimaryInstanceName   = txtPrimaryInstance.Text;
            mwv.CurrentPrimaryDatabaseName   = cmbPrimaryDatabase.SelectedValue.ToString();
            mwv.CurrentSecondaryInstanceName = txtSecondaryInstance.Text;
            mwv.CurrentSecondaryDatabaseName = cmbSecondaryDatabase.SelectedValue.ToString();
            mwv.DisplayGroups          = chkDisplayGroups.IsChecked.Value;
            mwv.ForceRefresh           = ForceRefresh;
            mwv.ShowOnlyDifferences    = chkShowOnlyDifferences.IsChecked.Value;
            mwv.IgnoreMissingTables    = chkIgnoreMissingTables.IsChecked.Value;
            mwv.DatabaseListingChanged = DatabaseListingChanged;

            return(mwv);
        }
Example #2
0
        private void RefreshDataGrid(MainWindowValues mwv, IEnumerable <IndexGroup> groups)
        {
            try
            {
                DataContext = new MainWindowViewModel
                              (
                    Groups,
                    mwv.ShowOnlyDifferences,
                    mwv.DisplayGroups,
                    mwv.IgnoreMissingTables
                              );
                SetColumnVisibility(!mwv.DisplayGroups);

                //Hide the wait screen & show the display screen.
                SetVisibility(PageToShow.Results);
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }
Example #3
0
        private void PopulateGrid(bool ForceRefresh)
        {
            //Show the waiting page.
            SetVisibility(PageToShow.Waiting);

            //Set the async values
            MainWindowValues mwvSetup = LoadMainWindowValues(ForceRefresh);

            System.Windows.Threading.Dispatcher d = this.Dispatcher;

            //Set up a worker
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                try
                {
                    MainWindowValues mwv = e.Argument as MainWindowValues;

                    if (mwv.ForceRefresh || mwv.DatabaseListingChanged || PrimaryGroup == null || SecondaryGroup == null)
                    {
                        PrimaryGroup   = IndexSet.RetrieveIndexData(mwv.CurrentPrimaryInstanceName, mwv.CurrentPrimaryDatabaseName);
                        SecondaryGroup = IndexSet.RetrieveIndexData(mwv.CurrentSecondaryInstanceName, mwv.CurrentSecondaryDatabaseName);
                        Groups         = IndexGroup.PopulateIndexGroups(PrimaryGroup, SecondaryGroup, mwv.IgnoreMissingTables);
                    }

                    //Now update the display
                    RefreshGridDelegate refresh = new RefreshGridDelegate(RefreshDataGrid);
                    d.BeginInvoke(refresh, mwv, Groups);
                }
                catch (Exception ex)
                {
                    ShowErrorDelegate error = new ShowErrorDelegate(ShowErrorMessage);
                    d.BeginInvoke(error, ex.Message);
                }
            };
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            worker.RunWorkerAsync(mwvSetup);
        }