Ejemplo n.º 1
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);
            }
        }