示例#1
0
    private void OnStartup()
    {
      // start the splashscreen      
      string version = ConfigurationManager.AppSettings["version"];
      splashScreen.Version = version;
      splashScreen.Run();
      Log.Info("SettingsForm constructor");
      // Required for Windows Form Designer support
      InitializeComponent();
      this.linkLabel1.Links.Add(0, linkLabel1.Text.Length, "http://www.team-mediaportal.com/donate.html");
      // Build options tree
      if (splashScreen != null)
      {
        splashScreen.SetInformation("Loading language...");
      }
      string strLanguage;
      using (Settings xmlreader = new MPSettings())
      {
        strLanguage = xmlreader.GetValueAsString("gui", "language", "English");
        hintShowCount = xmlreader.GetValueAsInt("general", "ConfigModeHintCount", 0);

        if (splashScreen != null)
        {
          splashScreen.SetInformation("Loading config options...");
        }
        CheckModeHintDisplay(hintShowCount);
        // The initial hint allows to choose a mode so we need to ask before loading that setting
        advancedMode = xmlreader.GetValueAsBool("general", "AdvancedConfigMode", false);
      }
      toolStripButtonSwitchAdvanced.Text = AdvancedMode ? "Switch to standard mode" : "Switch to expert mode";
      toolStripButtonSwitchAdvanced.Checked = AdvancedMode;
      GUILocalizeStrings.Load(strLanguage);
      // Register Bass.Net
      BassRegistration.BassRegistration.Register();
      Log.Info("add project section");
      if (splashScreen != null)
      {
        splashScreen.SetInformation("Adding project section...");
      }
      Project project = new Project();
      AddSection(new ConfigPage(null, project, false));

      AddTabGeneral();
      AddTabGui();
      AddTabMovies();
      AddTabDvd();
      AddTabTelevision();
      AddTabMusic();
      AddTabPictures();
      AddTabRemote();
      AddTabFilters();
      AddTabWeather();
      AddTabPlugins();
      AddTabThirdPartyChecks();

      // reset the last used state
      ToggleSectionVisibility(advancedMode);

      // Select first item in the section tree
      if (sectionTree.Nodes.Count > 0)
      {
        sectionTree.SelectedNode = sectionTree.Nodes[0];
      }

      if (splashScreen != null)
      {
        splashScreen.Stop(1000);
        splashScreen = null;
        BackgroundWorker FrontWorker = new BackgroundWorker();
        FrontWorker.DoWork += new DoWorkEventHandler(Worker_BringConfigToForeground);
        FrontWorker.RunWorkerAsync();
      }

      Log.Info("settingsform constructor done");
      GUIGraphicsContext.Skin = Config.GetFile(Config.Dir.Skin, "Default", string.Empty);
      Log.Info("SKIN : " + GUIGraphicsContext.Skin);
    }
示例#2
0
        private void OnStartup()
        {
            // start the splashscreen
            string version = ConfigurationManager.AppSettings["version"];

            splashScreen.Version = version;
            splashScreen.Run();
            Log.Info("SettingsForm constructor");
            // Required for Windows Form Designer support
            InitializeComponent();
            this.linkLabel1.Links.Add(0, linkLabel1.Text.Length, "http://www.team-mediaportal.com/donate.html");
            // Build options tree
            if (splashScreen != null)
            {
                splashScreen.SetInformation("Loading language...");
            }
            string strLanguage;

            using (Settings xmlreader = new MPSettings())
            {
                strLanguage   = xmlreader.GetValueAsString("gui", "language", "English");
                hintShowCount = xmlreader.GetValueAsInt("general", "ConfigModeHintCount", 0);

                if (splashScreen != null)
                {
                    splashScreen.SetInformation("Loading config options...");
                }
                CheckModeHintDisplay(hintShowCount);
                // The initial hint allows to choose a mode so we need to ask before loading that setting
                advancedMode = xmlreader.GetValueAsBool("general", "AdvancedConfigMode", false);
            }
            toolStripButtonSwitchAdvanced.Text    = AdvancedMode ? "Switch to standard mode" : "Switch to expert mode";
            toolStripButtonSwitchAdvanced.Checked = AdvancedMode;
            GUILocalizeStrings.Load(strLanguage);
            // Register Bass.Net
            BassRegistration.BassRegistration.Register();
            Log.Info("add project section");
            if (splashScreen != null)
            {
                splashScreen.SetInformation("Adding project section...");
            }
            Project project = new Project();

            AddSection(new ConfigPage(null, project, false));

            AddTabGeneral();
            AddTabGui();
            AddTabMovies();
            AddTabBD();
            AddTabDvd();
            AddTabTelevision();
            AddTabMusic();
            AddTabPictures();
            AddTabRemote();
            AddTabFilters();
            //Mantis 3772 - Weather.com API is not free any more
            //temporarily disable plugin
            //AddTabWeather();
            AddTabPlugins();
            AddTabThirdPartyChecks();

            // reset the last used state
            ToggleSectionVisibility(advancedMode);

            // Select first item in the section tree
            if (sectionTree.Nodes.Count > 0)
            {
                sectionTree.SelectedNode = sectionTree.Nodes[0];
            }

            if (splashScreen != null)
            {
                splashScreen.Stop(1000);
                splashScreen = null;
                BackgroundWorker FrontWorker = new BackgroundWorker();
                FrontWorker.DoWork += new DoWorkEventHandler(Worker_BringConfigToForeground);
                FrontWorker.RunWorkerAsync();
            }

            Log.Info("settingsform constructor done");
            GUIGraphicsContext.Skin = Config.GetFile(Config.Dir.Skin, "Default", string.Empty);
            Log.Info("SKIN : " + GUIGraphicsContext.Skin);
        }