Exemple #1
0
		/// <summary>
		/// Handles the LearningModuleClosing event of the LearnLogic control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="MLifter.BusinessLayer.LearningModuleClosingEventArgs"/> instance containing the event data.</param>
		/// <remarks>Documented by Dev02, 2008-05-06</remarks>
		void learnLogic_LearningModuleClosing(object sender, LearningModuleClosingEventArgs e)
		{
			if (!ShowLearningStatistics())
				e.Cancel = true;
		}
Exemple #2
0
 /// <summary>
 /// Raises the <see cref="E:LearningModuleClosing"/> event.
 /// </summary>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 /// <remarks>Documented by Dev02, 2008-05-05</remarks>
 private void OnLearningModuleClosing(LearningModuleClosingEventArgs e)
 {
     if (LearningModuleClosing != null)
         LearningModuleClosing(this, e);
 }
Exemple #3
0
        /// <summary>
        /// Closes the learning module.
        /// </summary>
        /// <returns>True, if successful, else false.</returns>
        /// <remarks>Documented by Dev02, 2008-05-05</remarks>
        /// <remarks>Documented by Dev08, 2008-08-08</remarks>
        public bool CloseLearningModule()
        {
            try
            {
                if (this.LearningModuleLoaded)
                {
                    LearningModuleClosingEventArgs e = new LearningModuleClosingEventArgs();
                    OnLearningModuleClosing(e);
                    if (e.Cancel)
                        return false;

                    Log.CloseUserSession(Dictionary.DictionaryDAL.Parent);

                    while (!user.Dictionary.Save())
                    {
                        UserModuleNotSavedDialogEventArgs args = new UserModuleNotSavedDialogEventArgs(user.Dictionary, -1);
                        OnUserDialog(args);
                        if (args.cancelClosing)
                            return false;
                        if (!args.tryagain)
                            break;
                    }

                    StopCountdownTimer();
                    user.Dictionary.Close();
                    user.Dictionary = null;
                    OnLearningModuleClosed(EventArgs.Empty);
                }
            }
            catch (NpgsqlException exp)
            {
                if (exp.TargetSite.Name == "Open")
                    OnLearningModuleConnectionLost(EventArgs.Empty);
                else
                    throw;

                StopCountdownTimer();
                user.Dictionary.Close();
                user.Dictionary = null;
                OnLearningModuleClosed(EventArgs.Empty);
                audioPlayer.StopThread(false);
            }

            return !this.LearningModuleLoaded; //success when the module is not open anymore
        }
 /// <summary>
 /// Override LearningModuleClosing event to force it to fail.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="MLifter.BusinessLayer.LearningModuleClosingEventArgs"/> instance containing the event data.</param>
 /// <remarks>Documented by Dev09, 2009-03-05</remarks>
 void llogic_LearningModuleClosing(object sender, LearningModuleClosingEventArgs e)
 {
     e.Cancel = true;
 }