Ejemplo n.º 1
0
        void RestoreLastSearchTextFromUserProfile()
        {
            var lastSearch = _userPref.GetByName(UserPref_LastSearchText);

            if (String.IsNullOrEmpty(lastSearch))
            {
                txtSearch.Text = String.Empty;
            }
            else
            {
                // if search text contained same criteria TextChanged event will not be fired therefore search will not occur.
                // we need to force a search if search text is the same
                var prevText = txtSearch.Text;
                txtSearch.Text = lastSearch;

                if (prevText == txtSearch.Text)
                {
                    DoSearch(true);
                }
            }
        }
Ejemplo n.º 2
0
        private void UserControl_Loaded(Object sender, RoutedEventArgs e)
        {
            try
            {
                log.Info("XAML Loaded...");

                var scroll = itemsControl.FindChild <ScrollContentPresenter>();

                _userPref = UserPreferencesStorage.Load();
                _cfg      = _persistor.Restore <Config.DogConfig>(_userPref);

                UpdateDetector = new UpdateDetector(_userPref);
                UpdateDetector.NewVersionFound += UpdateDetector_NewVersionFound;

                _processor.RequestFailed += new Action <Request, Exception>(_processor_RequestFailed);
                StudioController.Initialise();
                StudioController.SetConfiguration(_cfg);
                StudioController.OnServersAdded    += StudioController_OnServersAdded;
                StudioController.OnServersRemoved  += StudioController_OnServersRemoved;
                StudioController.OnDatabaseChanged += StudioController_OnDatabaseChanged;
                StudioController.ShowYourself      += new System.Action(StudioController_ShowYourself);
                ReloadServers();

                ResultsFontSize = _cfg.FontSize;

                var lastSrvName = _userPref.GetByName(UserPref_LastSelectedServer);
                RestoreLastSearchTextFromUserProfile();

                // select first server
                if ((cbServer.SelectedIndex == -1) && (cbServer.Items.Count > 1))
                {
                    cbServer.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                log.Error("Fatal error loading main control:" + ex.Message, ex);
            }
        }