Exemplo n.º 1
0
        /// <summary>
        /// Connects to the LM database.
        /// </summary>
        /// <returns>True if success</returns>
        /// <remarks>Documented by Dev03, 2008-11-18</remarks>
        private bool Connect()
        {
            if (connected)
            {
                return(true);
            }

            try
            {
                if (m_learnLogic != null)
                {
                    m_learnLogic.CloseLearningModule();
                }
                ConnectionStringStruct connectionTarget = new ConnectionStringStruct(DatabaseType.PostgreSQL, textBoxConnectionString.Text, -1);
                m_learnLogic.User.Authenticate(GetUser, connectionTarget, DataAccessError);
                dictionaries = m_learnLogic.User.GetLearningModuleList();
                File.WriteAllText(connectionstringfile, textBoxConnectionString.Text);
                textBoxCurrentUser.Text = m_learnLogic.User.ToString();
                connected = true;
            }
            catch (Exception exp)
            {
                System.Diagnostics.Trace.Write(exp.ToString());
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Refreshes the specified dictionaries.
 /// </summary>
 /// <param name="dictionaries">The dictionaries.</param>
 /// <remarks>Documented by Dev02, 2008-07-31</remarks>
 public void SetIDictionaries(IDictionaries dictionaries)
 {
     this.dictionaries = dictionaries;
     UpdateList();
     if (listViewLMs.Items.Count > 0)
     {
         listViewLMs.SelectedIndices.Clear();
         listViewLMs.SelectedIndices.Add(0);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the learning module.
        /// </summary>
        /// <param name="catergoryId">The catergory id.</param>
        /// <param name="title">The title.</param>
        /// <returns></returns>
        /// <remarks>Documented by Dev03, 2008-12-22</remarks>
        public IDictionary CreateLearningModule(int catergoryId, string title)
        {
            IDictionaries dictionaries = GetLearningModuleList();

            if (dictionaries == null)
            {
                return(null);
            }
            else
            {
                return(dictionaries.AddNew(catergoryId, title));
            }
        }
Exemplo n.º 4
0
 public HomePageViewModel(IDictionaries dictionaries)
 {
     _dictionaries = dictionaries.GetDictionaries();
     if (Settings.TestScoreOutOf == 0)
     {
         IsNotTakenATest    = true;
         IsTestAlreadyTaken = false;
     }
     else
     {
         IsNotTakenATest    = false;
         IsTestAlreadyTaken = true;
         DictionaryTaken    = Settings.LastAttemtedDictionary;
         LatetTestScore     = Settings.TestScore + "/" + Settings.TestScoreOutOf;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new LM.
        /// </summary>
        /// <param name="dictionaries">The dictionaries.</param>
        /// <remarks>Documented by Dev02, 2008-07-31</remarks>
        private void CreateNewLM(IDictionaries dictionaries)
        {
            if (dictionaries != null)
            {
                Wizard dicWizard = new Wizard();
                dicWizard.Text = MLifter.Controls.Properties.Resources.NEWDIC_CAPTION;
                dicWizard.Pages.Add(new Controls.Wizards.DictionaryCreator.WelcomePage());
                dicWizard.Pages.Add(new Controls.Wizards.DictionaryCreator.SideSettingsPage());

                if (dicWizard.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        string dicName = (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryName;

                        IDictionary newDic = dictionaries.AddNew(
                            (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryCategory.Id,
                            (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryName);

                        newDic.Author      = (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryAuthor;
                        newDic.Description = (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryDescription;

                        newDic.DefaultSettings.AnswerCaption   = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).AnswerTitle;
                        newDic.DefaultSettings.QuestionCaption = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).QuestionTitle;
                        newDic.DefaultSettings.AnswerCulture   = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).AnswerCulture;
                        newDic.DefaultSettings.QuestionCulture = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).QuestionCulture;

                        UpdateList();
                    }
                    catch (Exception exp)
                    {
                        MessageBox.Show(exp.ToString(), "Exception during attempt create LM.");
                    }
                }
            }
        }
Exemplo n.º 6
0
 internal UncDictionaries(IDictionaries xmlDics, IDictionaries dbDics)
 {
     xmlDictionaries = xmlDics;
     dbDictionaries = dbDics;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Refreshes the specified dictionaries.
 /// </summary>
 /// <param name="dictionaries">The dictionaries.</param>
 /// <remarks>Documented by Dev02, 2008-07-31</remarks>
 public void SetIDictionaries(IDictionaries dictionaries)
 {
     this.dictionaries = dictionaries;
     UpdateList();
     if (listViewLMs.Items.Count > 0)
     {
         listViewLMs.SelectedIndices.Clear();
         listViewLMs.SelectedIndices.Add(0);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Creates a new LM.
        /// </summary>
        /// <param name="dictionaries">The dictionaries.</param>
        /// <remarks>Documented by Dev02, 2008-07-31</remarks>
        private void CreateNewLM(IDictionaries dictionaries)
        {
            if (dictionaries != null)
            {
                Wizard dicWizard = new Wizard();
                dicWizard.Text = MLifter.Controls.Properties.Resources.NEWDIC_CAPTION;
                dicWizard.Pages.Add(new Controls.Wizards.DictionaryCreator.WelcomePage());
                dicWizard.Pages.Add(new Controls.Wizards.DictionaryCreator.SideSettingsPage());

                if (dicWizard.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        string dicName = (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryName;

                        IDictionary newDic = dictionaries.AddNew(
                            (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryCategory.Id,
                            (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryName);

                        newDic.Author = (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryAuthor;
                        newDic.Description = (dicWizard.Pages[0] as Controls.Wizards.DictionaryCreator.WelcomePage).DictionaryDescription;

                        newDic.DefaultSettings.AnswerCaption = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).AnswerTitle;
                        newDic.DefaultSettings.QuestionCaption = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).QuestionTitle;
                        newDic.DefaultSettings.AnswerCulture = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).AnswerCulture;
                        newDic.DefaultSettings.QuestionCulture = (dicWizard.Pages[1] as Controls.Wizards.DictionaryCreator.SideSettingsPage).QuestionCulture;

                        UpdateList();
                    }
                    catch (Exception exp)
                    {
                        MessageBox.Show(exp.ToString(), "Exception during attempt create LM.");
                    }
                }
            }
        }
Exemplo n.º 9
0
 public CommonAlgorithm(IDictionaries dictionary) :
     base(dictionary)
 {
 }
Exemplo n.º 10
0
        /// <summary>
        /// Connects to the LM database.
        /// </summary>
        /// <returns>True if success</returns>
        /// <remarks>Documented by Dev03, 2008-11-18</remarks>
        private bool Connect()
        {
            if (connected)
                return true;

            try
            {
                if (m_learnLogic != null) m_learnLogic.CloseLearningModule();
                ConnectionStringStruct connectionTarget = new ConnectionStringStruct(DatabaseType.PostgreSQL, textBoxConnectionString.Text, -1);
                m_learnLogic.User.Authenticate(GetUser, connectionTarget, DataAccessError);
                dictionaries = m_learnLogic.User.GetLearningModuleList();
                File.WriteAllText(connectionstringfile, textBoxConnectionString.Text);
                textBoxCurrentUser.Text = m_learnLogic.User.ToString();
                connected = true;
            }
            catch (Exception exp)
            {
                System.Diagnostics.Trace.Write(exp.ToString());
                return false;
            }
            return true;
        }
Exemplo n.º 11
0
 protected Algorithm(IDictionaries dictionary)
 {
     this.Dictionaries = dictionary;
 }
Exemplo n.º 12
0
 internal UncDictionaries(IDictionaries xmlDics, IDictionaries dbDics)
 {
     xmlDictionaries = xmlDics;
     dbDictionaries  = dbDics;
 }
Exemplo n.º 13
0
 public CurrencyAlgorithm(IDictionaries dictionary) :
     base(dictionary)
 {
 }