/// <summary> /// Handles the Load event of the MainForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev02, 2008-03-10</remarks> private void MainForm_Load(object sender, EventArgs e) { //load codecs codecs.XMLString = Settings.Default.CodecSettings; //load recent LearningModule from settings if (!string.IsNullOrEmpty(Settings.Default.RecentLearningModule) && File.Exists(Settings.Default.RecentLearningModule)) { textBoxLearningModule.Text = Settings.Default.RecentLearningModule; } //load recent AudioBook Path from settings if (!string.IsNullOrEmpty(Settings.Default.RecentAudioBook)) { FileInfo recentaudiobook = new FileInfo(Settings.Default.RecentAudioBook); textBoxAudiobook.Text = recentaudiobook.FullName; } GenerateAvailableFields(); //use the events to reset to "default" state BusinessLayer_WorkingThreadFinished(null, EventArgs.Empty); ProgressChangedEventArgs args = new ProgressChangedEventArgs(); args.enableProgressReporting = false; BusinessLayer_ProgressChanged(null, args); //the following line is required for the login form to work MLifter.BusinessLayer.LearningModulesIndex learningModules = new MLifter.BusinessLayer.LearningModulesIndex( Path.Combine(Application.StartupPath, Settings.Default.ConfigPath), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Settings.Default.ConfigurationFolder), (MLifter.DAL.GetLoginInformation)MLifter.Controls.LoginForm.OpenLoginForm, (MLifter.DAL.DataAccessErrorDelegate) delegate { return; }, String.Empty); }
/// <summary> /// Opens the learning module. /// </summary> /// <param name="filename">The filename.</param> /// <remarks>Documented by Dev08, 2009-07-18</remarks> public void OpenLearningModule(string filename) { string globalConfig = System.IO.Path.Combine(Application.Current.StartupUri.AbsolutePath, Settings.Default.ConfigPath); string userConfig = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Settings.Default.ConfigurationFolder); string syncedModulesPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), System.IO.Path.Combine(Settings.Default.AppDataFolder, Settings.Default.SyncedLMFolder)); ThreadStart threadStart = new ThreadStart(delegate() { try { CloseLearningModule(); MLifter.BusinessLayer.LearningModulesIndex index = new MLifter.BusinessLayer.LearningModulesIndex(globalConfig, userConfig, LoginForm.OpenLoginForm, delegate { return; }, string.Empty); learningModuleUser = null; learningModuleUser = UserFactory.Create(LoginForm.OpenLoginForm, new ConnectionStringStruct(DatabaseType.MsSqlCe, filename, -1), delegate { return; }, this); ConnectionStringStruct css = learningModuleUser.ConnectionString; css.LmId = MLifter.DAL.User.GetIdOfLearningModule(filename, learningModuleUser); learningModuleUser.ConnectionString = css; LearningModule = learningModuleUser.Open(); } catch (Exception e) { context.Post(new SendOrPostCallback(delegate(object state) { OnLearningModuleException(this, new ExceptionEventArgs(e, filename)); }), null); return; } context.Post(new SendOrPostCallback(delegate(object state) { OnLearningModuleOpened(this, EventArgs.Empty); }), null); }); new Thread(threadStart) { Name = "Open LearningModule Thread" }.Start(); }
/// <summary> /// Handles the Load event of the MainForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev02, 2008-03-10</remarks> private void MainForm_Load(object sender, EventArgs e) { //load codecs codecs.XMLString = Settings.Default.CodecSettings; //load recent LearningModule from settings if (!string.IsNullOrEmpty(Settings.Default.RecentLearningModule) && File.Exists(Settings.Default.RecentLearningModule)) textBoxLearningModule.Text = Settings.Default.RecentLearningModule; //load recent AudioBook Path from settings if (!string.IsNullOrEmpty(Settings.Default.RecentAudioBook)) { FileInfo recentaudiobook = new FileInfo(Settings.Default.RecentAudioBook); textBoxAudiobook.Text = recentaudiobook.FullName; } GenerateAvailableFields(); //use the events to reset to "default" state BusinessLayer_WorkingThreadFinished(null, EventArgs.Empty); ProgressChangedEventArgs args = new ProgressChangedEventArgs(); args.enableProgressReporting = false; BusinessLayer_ProgressChanged(null, args); //the following line is required for the login form to work MLifter.BusinessLayer.LearningModulesIndex learningModules = new MLifter.BusinessLayer.LearningModulesIndex( Path.Combine(Application.StartupPath, Settings.Default.ConfigPath), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Settings.Default.ConfigurationFolder), (MLifter.DAL.GetLoginInformation)MLifter.Controls.LoginForm.OpenLoginForm, (MLifter.DAL.DataAccessErrorDelegate)delegate { return; }, String.Empty); }
/// <summary> /// Handles the Load event of the MainForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev05, 2007-08-03</remarks> private void MainForm_Load(object sender, EventArgs e) { //the following line is required for the login form to work MLifter.BusinessLayer.LearningModulesIndex learningModules = new MLifter.BusinessLayer.LearningModulesIndex( Path.Combine(Application.StartupPath, MLifter.Recorder.Properties.Settings.Default.ConfigPath), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), MLifter.Recorder.Properties.Settings.Default.ConfigurationFolder), (MLifter.DAL.GetLoginInformation)MLifter.Controls.LoginForm.OpenLoginForm, (MLifter.DAL.DataAccessErrorDelegate)delegate { return; }, String.Empty); groupBoxSelect.Visible = numPadControl.AdvancedView; # region Load settings settings = new Settings(); settings.KeyFunctions = numPadControl.KeyFunctions; settings.KeyboardFunctions = numPadControl.KeyboardFunctions; settings.PresenterKeyFunctions = numPadControl.PresenterKeyFunctions; if (File.Exists(CONSTANTS.SETTINGS_FILENAME)) { LoadSettings(); if (File.Exists(settings.Dictionary) && TaskDialog.ShowCommandBox(MLifter.Recorder.Properties.Resources.RELOAD_LAST_DIC_CAPTION, MLifter.Recorder.Properties.Resources.RELOAD_LAST_DIC_TEXT, settings.Dictionary, MLifter.Recorder.Properties.Resources.RELOAD_LAST_DIC_COMMANDS, false) == 0) { try { dictionaryManager.LoadDictionary(settings.Dictionary); } catch { if (!OpenDictionary()) Environment.Exit(-1); } } else { if (!OpenDictionary()) Environment.Exit(-1); } } else { if (!OpenDictionary()) Environment.Exit(-1); } Stop(); updatingThread = new Thread(new ThreadStart(UpdateListView)); updatingThread.Start(); SelectAllCards(); # endregion Stop(); UpdateSettings(); treeViewCards.Focus(); numPadControl.InstallHook(); ToolTip toolTip = new ToolTip(); toolTip.SetToolTip(buttonAllCards, "Select all cards"); toolTip.SetToolTip(buttonNoCards, "Deselect all cards"); toolTip.SetToolTip(buttonSelectIncomplete, "Select all cards, where at least one part is missing"); toolTip.SetToolTip(buttonSelectInverse, "Inverse the selection"); }