コード例 #1
0
        /// <summary>
        /// Initializes the dictionary form for the currently loaded dictionary
        /// </summary>
        /// <returns>True if OK</returns>
        /// <remarks>Documented by Dev03, 2007-07-19</remarks>
        public static bool LoadDictionary(Dictionary dict, string helpfile)
        {
            dictionary = dict;
            PropertiesForm propertiesForm = new PropertiesForm(helpfile);

            //learning modules cultures and captions
            propertiesForm.tabControlProperties.SelectedIndex = 0;
            propertiesForm.dictionaryCaptions.QuestionTitle = dictionary.DefaultSettings.QuestionCaption;
            propertiesForm.dictionaryCaptions.AnswerTitle = dictionary.DefaultSettings.AnswerCaption;
            propertiesForm.dictionaryCaptions.QuestionCulture = dictionary.DefaultSettings.QuestionCulture;
            propertiesForm.dictionaryCaptions.AnswerCulture = dictionary.DefaultSettings.AnswerCulture;

            propertiesForm.groupBoxQuestion.Text = dictionary.QuestionCaption;
            propertiesForm.groupBoxAnswer.Text = dictionary.AnswerCaption;

            //commentary sounds
            propertiesForm.commentarySounds.Clear();
            foreach (KeyValuePair<CommentarySoundIdentifier, IMedia> commentarySound in dictionary.DefaultSettings.CommentarySounds)
                propertiesForm.commentarySounds.Add(commentarySound.Key, commentarySound.Value);

            //Learning Module LearnModes
            propertiesForm.learnModes.MultipleDirections = true;
            propertiesForm.learnModes.QuestionCaption = dictionary.DefaultSettings.QuestionCaption;
            propertiesForm.learnModes.AnswerCaption = dictionary.DefaultSettings.AnswerCaption;
            propertiesForm.learnModes.SetQueryDirections(dictionary.AllowedQueryDirections);
            propertiesForm.learnModes.SetQueryTypes(dictionary.AllowedQueryTypes);

            //Learning Module Properties
            propertiesForm.dictionaryProperties.Title = dictionary.DictionaryTitle;
            propertiesForm.dictionaryProperties.DictionaryName = dictionary.DictionaryTitle;
            propertiesForm.dictionaryProperties.DictionaryAuthor = dictionary.Author;
            propertiesForm.dictionaryProperties.DictionaryCategory = dictionary.Category;
            propertiesForm.dictionaryProperties.DictionaryDescription = dictionary.Description;

            propertiesForm.dictionaryInfos.SetInfo(dictionary);

            //Load dictionary logos
            if (dictionary.Logo != null && dictionary.Logo is Stream)
            {
                Image logo = Bitmap.FromStream(dictionary.Logo);
                propertiesForm.dictionaryProperties.LeftImageSizeMode = propertiesForm.dictionaryInfos.LeftImageSizeMode = PictureBoxSizeMode.Zoom;
                propertiesForm.dictionaryProperties.LeftImage = propertiesForm.dictionaryInfos.LeftImage = logo;
            }

            propertiesForm.buttonCancel.Enabled = true;
            propertiesForm.listboxCommentaryAnswer.SelectedIndex = 0;

            //[ML-2317]  Properties / Add/edit styles crashes
            propertiesForm.buttonAddEditStyle.Visible = dictionary.CurrentLearnLogic != null;

            //[ML-1837] - disable the allowed learning options for protected content
            if (dictionary.DictionaryContentProtected)
            {
                propertiesForm.learnModes.EditableControlsEnabled = false;
            }

            //Enable/Disable controls depending on current permission-role:
            if (!dictionary.CanModify)
            {
                propertiesForm.dictionaryProperties.EditableControlsEnabled = false;
                propertiesForm.dictionaryCaptions.EditableControlsEnabled = false;
                propertiesForm.learnModes.EditableControlsEnabled = false;
                propertiesForm.buttonChange.Enabled = false;
                propertiesForm.buttonAddEditStyle.Enabled = false;
            }

            return propertiesForm.ShowDialog() == DialogResult.OK ? true : false;
        }
コード例 #2
0
        /// <summary>
        /// Initializes the dictionary form for the currently loaded dictionary
        /// </summary>
        /// <returns>True if OK</returns>
        /// <remarks>Documented by Dev03, 2007-07-19</remarks>
        public static bool LoadDictionary(Dictionary dict, string helpfile)
        {
            dictionary = dict;
            PropertiesForm propertiesForm = new PropertiesForm(helpfile);

            //learning modules cultures and captions
            propertiesForm.tabControlProperties.SelectedIndex = 0;
            propertiesForm.dictionaryCaptions.QuestionTitle   = dictionary.DefaultSettings.QuestionCaption;
            propertiesForm.dictionaryCaptions.AnswerTitle     = dictionary.DefaultSettings.AnswerCaption;
            propertiesForm.dictionaryCaptions.QuestionCulture = dictionary.DefaultSettings.QuestionCulture;
            propertiesForm.dictionaryCaptions.AnswerCulture   = dictionary.DefaultSettings.AnswerCulture;

            propertiesForm.groupBoxQuestion.Text = dictionary.QuestionCaption;
            propertiesForm.groupBoxAnswer.Text   = dictionary.AnswerCaption;

            //commentary sounds
            propertiesForm.commentarySounds.Clear();
            foreach (KeyValuePair <CommentarySoundIdentifier, IMedia> commentarySound in dictionary.DefaultSettings.CommentarySounds)
            {
                propertiesForm.commentarySounds.Add(commentarySound.Key, commentarySound.Value);
            }

            //Learning Module LearnModes
            propertiesForm.learnModes.MultipleDirections = true;
            propertiesForm.learnModes.QuestionCaption    = dictionary.DefaultSettings.QuestionCaption;
            propertiesForm.learnModes.AnswerCaption      = dictionary.DefaultSettings.AnswerCaption;
            propertiesForm.learnModes.SetQueryDirections(dictionary.AllowedQueryDirections);
            propertiesForm.learnModes.SetQueryTypes(dictionary.AllowedQueryTypes);

            //Learning Module Properties
            propertiesForm.dictionaryProperties.Title                 = dictionary.DictionaryTitle;
            propertiesForm.dictionaryProperties.DictionaryName        = dictionary.DictionaryTitle;
            propertiesForm.dictionaryProperties.DictionaryAuthor      = dictionary.Author;
            propertiesForm.dictionaryProperties.DictionaryCategory    = dictionary.Category;
            propertiesForm.dictionaryProperties.DictionaryDescription = dictionary.Description;

            propertiesForm.dictionaryInfos.SetInfo(dictionary);

            //Load dictionary logos
            if (dictionary.Logo != null && dictionary.Logo is Stream)
            {
                Image logo = Bitmap.FromStream(dictionary.Logo);
                propertiesForm.dictionaryProperties.LeftImageSizeMode = propertiesForm.dictionaryInfos.LeftImageSizeMode = PictureBoxSizeMode.Zoom;
                propertiesForm.dictionaryProperties.LeftImage         = propertiesForm.dictionaryInfos.LeftImage = logo;
            }

            propertiesForm.buttonCancel.Enabled = true;
            propertiesForm.listboxCommentaryAnswer.SelectedIndex = 0;

            //[ML-2317]  Properties / Add/edit styles crashes
            propertiesForm.buttonAddEditStyle.Visible = dictionary.CurrentLearnLogic != null;

            //[ML-1837] - disable the allowed learning options for protected content
            if (dictionary.DictionaryContentProtected)
            {
                propertiesForm.learnModes.EditableControlsEnabled = false;
            }

            //Enable/Disable controls depending on current permission-role:
            if (!dictionary.CanModify)
            {
                propertiesForm.dictionaryProperties.EditableControlsEnabled = false;
                propertiesForm.dictionaryCaptions.EditableControlsEnabled   = false;
                propertiesForm.learnModes.EditableControlsEnabled           = false;
                propertiesForm.buttonChange.Enabled       = false;
                propertiesForm.buttonAddEditStyle.Enabled = false;
            }

            return(propertiesForm.ShowDialog() == DialogResult.OK ? true : false);
        }