コード例 #1
0
ファイル: MainForm.cs プロジェクト: Stoner19/Memory-Lifter
		/// <summary>
		/// Loads main Form (loads INI settings from registry, plays startup sound, hides and disposes splashscreen,
		/// checks registration, loads files in the command line, shows news window)
		/// </summary>
		/// <param name="sender">Sender of object</param>
		/// <param name="e">Contains event data</param>
		/// <returns>No return value</returns>
		/// <exception cref="ex"></exceptions>
		/// <remarks>Documented by Dev00, 2007-07-26</remarks>
		private void MainForm_Load(object sender, System.EventArgs e)
		{
			//[ML-551] Main window not in foreground
			//It is important to focus MainForm once - otherwise, the SplashScreen has focus (because it was here first). 
			//SplashScreen closed => Windows focused the last used program
			Activate();

			//refresh show in taskbar state to ensure that the window gets shown
			if (ShowInTaskbar)
			{
				SuspendLayout();
				ShowInTaskbar = false;
				ShowInTaskbar = true;
				ResumeLayout();
			}

			PlayStartupEndSound(false, false); //moved to the top to avoid DirectX audio freeze

			LearnLogic.CountDownTimerMinimum = Properties.Settings.Default.TIMER_MinSeconds;
			LearnLogic.SlideShow = Properties.Settings.Default.Slideshow;
			LearnLogic.IgnoreOldLearningModuleVersion = Properties.Settings.Default.IgnoreOldDics;
			LearnLogic.SynonymInfoMessage = Properties.Settings.Default.SynonymPromt;

			//load stylehandler
			styleHandler = new MLifter.Components.StyleHandler(
				Path.Combine(Application.StartupPath, Properties.Settings.Default.AppDataFolderDesigns),
				Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
				Path.Combine(Properties.Settings.Default.AppDataFolder, Properties.Settings.Default.AppDataFolderDesigns)),
				Properties.Resources.ResourceManager,
				OnStickMode);

			//load extensions stuff
			Extensions.Restore(Setup.InstalledExtensionsFilePath);
			Extensions.SkinPath = styleHandler.StylesPath;
			Extensions.ExecuteExtension += new Extensions.ExtensionEventHandler(Extensions_ExecuteExtension);
			Extensions.InformUser += new Extensions.ExtensionEventHandler(Extensions_InformUser);

			LoadStyle();
			RefreshStyleMenu();

			RefreshLanguageMenu();
			NoDictionaryLoaded();
			LoadWindowSettings();
			
			BringToFront();
			TopMost = true;
			TopMost = false;

			bool firstUse = false;
			if (Settings.Default.FirstUse)
			{
				Wizard startupWizard = new Wizard(MLifter.Classes.Help.HelpPath);
				startupWizard.StartPosition = FormStartPosition.CenterParent;
				startupWizard.Text = Resources.FIRSTSTART_CAPTION;
				startupWizard.Pages.Add(new Controls.Wizards.Startup.DictionaryPathPage(Setup.DictionaryParentPath, 
					Properties.Resources.DICPATH_DEFAULTNAME, Properties.Resources.DICPATH_DEFAULTNAME_OLD));
				startupWizard.ShowDialog();
				
				Controls.Wizards.Startup.DictionaryPathPage dictionaryPathPage = startupWizard.Pages[0] as Controls.Wizards.Startup.DictionaryPathPage;
				Setup.InitializeProfile(dictionaryPathPage.CopyDemoDictionary, dictionaryPathPage.DictionaryPath);

				Properties.Settings.Default.DicDir = dictionaryPathPage.DictionaryPath;

				ConnectionStringHandler.CreateUncConnection(Resources.DEFAULT_CONNECTION_NAME, Settings.Default.DicDir, 
					Setup.UserConfigPath, Resources.DEFAULT_CONNECTION_FILE, true, OnStickMode);
				
				Settings.Default.FirstUse = false;
				Settings.Default.Save();

				firstUse = true;
			}
			
			Setup.CheckDicDir();

			toolStripMenuItemCheckForBetaUpdates.Checked = Settings.Default.CheckForBetaUpdates;
			while (!Program.UpdateChecked) Thread.Sleep(10);

			Program.SuspendIPC = false; //re-enable remote services / signal ready

			//check for unsent error reports
			Classes.ErrorReportGenerator.ProcessPendingReports();

			if (MainformLoadedEvent != null)
			{
				LearningModulesIndex index = new LearningModulesIndex(Setup.GlobalConfigPath, Setup.UserConfigPath, LoginForm.OpenLoginForm, delegate { return; }, Setup.SyncedModulesPath);
				OnMainformLoaded();
			}
			else if (Settings.Default.ShowStartPage && CommandLineParam == string.Empty)
			{
				ShowLearningModulesPage(firstUse);
			}
			else
			{
				LearningModulesIndex index = new LearningModulesIndex(Setup.GlobalConfigPath, Setup.UserConfigPath, LoginForm.OpenLoginForm, delegate { return; }, Setup.SyncedModulesPath);

				//check for news
				MLifter.Controls.News news = new MLifter.Controls.News();
				news.Prepare(true);

				//open most recent LM
				CheckAndLoadStartUpDic();
			}
		}
コード例 #2
0
 /// <summary>
 /// Sets the stack card back colors.
 /// </summary>
 /// <param name="styleHandler">The style handler.</param>
 /// <remarks>Documented by Dev02, 2008-05-09</remarks>
 public void SetStackCardBackColors(MLifter.Components.StyleHandler styleHandler)
 {
     stackFlow.SetStackCardBackColors(styleHandler);
 }