Beispiel #1
0
 public Result(Boolean correct, Word parent, User user,Language lang,string Assignment,string Answer)
 {
     _DateTime = DateTime.Now;
     _Correct = correct;
     _User = user;
     Parent = parent;
     Language_Assignment = lang;
     Text_Assignment = Assignment;
     _Text_Answer = Answer;
 }
Beispiel #2
0
 private void BtnBack_Click(object sender, EventArgs e)
 {
     SaveData();
     try
     {
         _Vokabel = _Vokabel.Parent.Words[_Vokabel.Parent.Words.IndexOf(_Vokabel) - 1];
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     LoadData();
     UpdateButtons();
 }
Beispiel #3
0
        private void BtnNew_Click(object sender, EventArgs e)
        {
            SaveData();
            if (_Vokabel != null)
            {
                try
                {
                    var Parent = _Vokabel.Parent;
                    _Vokabel = new Word();
                    _Vokabel.Parent = Parent;
                    LoadData();
                    UpdateButtons();
                    TBFremdsprache.Focus();

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Beispiel #4
0
 private string GetInfo(Language lang, Word w, bool invert)
 {
     if (invert)
         return (lang == Language.OtherLanguage) ? w.InfoGerman : w.InfoOtherLanguage;
     else
         return (lang == Language.German) ? w.InfoGerman : w.InfoOtherLanguage;
 }
Beispiel #5
0
        private void NextQuestion()
        {
            btnOK.ForeColor = SystemColors.ControlText;

            btnOK.Text = "OK";
            tbBWord.Focus();
            State = ProgramState.Question;
            CurrentWord = WordsToDo[rand.Next(WordsToDo.Count)];

            CurrentLanguage = PresetLanguage ?? ((rand.Next(2) == 0) ? Language.German : Language.OtherLanguage);

            lblALanguage.BackColor = lblAWord.BackColor = GetColor(CurrentLanguage, CurrentWord.Parent.ColorRecursive, false);
            lblBLanguage.BackColor = tbBWord.BackColor = GetColor(CurrentLanguage, CurrentWord.Parent.ColorRecursive, true);
            if (lblALanguage.BackColor.R + lblALanguage.BackColor.G + lblALanguage.BackColor.B < 3 * 255 / 2) lblALanguage.ForeColor = Color.White; else lblALanguage.ForeColor = Color.Black;
            if (lblBLanguage.BackColor.R + lblBLanguage.BackColor.G + lblBLanguage.BackColor.B < 3 * 255 / 2) lblBLanguage.ForeColor = Color.White; else lblBLanguage.ForeColor = Color.Black;
            if (lblAWord.BackColor.R + lblAWord.BackColor.G + lblAWord.BackColor.B < 3 * 255 / 2) lblAWord.ForeColor = Color.White; else lblAWord.ForeColor = Color.Black;
            if (tbBWord.BackColor.R + tbBWord.BackColor.G + tbBWord.BackColor.B < 3 * 255 / 2) tbBWord.ForeColor = Color.White; else tbBWord.ForeColor = Color.Black;

            lblALanguage.Text = GetLanguage(CurrentLanguage, CurrentWord.Parent.LanguageRecursive, false);
            lblBLanguage.Text = GetLanguage(CurrentLanguage, CurrentWord.Parent.LanguageRecursive, true);

            lblAWord.Text = SyntaxProcessor.GetWord(GetText(CurrentLanguage, CurrentWord, false));

            lblAComment.Text = GetInfo(CurrentLanguage, CurrentWord, false);

            tbBWord.Text = "";
            tbBWord.ReadOnly = false;

            lbAList.Items.Clear();
            lbBList.Items.Clear();

            lblComment.Text = "";
            lblBComment.Text = "";

            diffBox1.Text = "";
            diffBox1.Solution = "";
        }
Beispiel #6
0
 private string GetText(Language lang, Word w, bool invert)
 {
     if (invert)
         return (lang == Language.OtherLanguage) ? w.TextGerman : w.TextOtherLanguage;
     else
         return (lang == Language.German) ? w.TextGerman : w.TextOtherLanguage;
 }
Beispiel #7
0
        //#region Anzeige
        //public ListViewItem GetListViewItem(string User)
        //{
        //    ListViewItem LVI = new ListViewItem(TextOwnLanguage);
        //    LVI.ImageIndex = GetState(User) - 1;
        //    LVI.SubItems.Add(new ListViewItem.ListViewSubItem().Text = TextForeignLanguage);
        //    LVI.SubItems.Add(new ListViewItem.ListViewSubItem().Text = HintOwnLanguage);
        //    LVI.SubItems.Add(new ListViewItem.ListViewSubItem().Text = HintFoeignLanguage);
        //    LVI.SubItems.Add(new ListViewItem.ListViewSubItem().Text = Hint);
        //    LVI.Tag = this;
        //    return (LVI);
        //}
        //#endregion
        //#region Save & Load
        //#region Save
        //public XElement SaveToXElement()
        //{
        //    return SaveToXElement(this);
        //}
        //public static XElement SaveToXElement(Word data)
        //{
        //    var XE = new XElement(XMLNameMain,
        //        new XAttribute(XMLNameChanging, data._Changing),
        //        new XAttribute(XMLNameCreation, data._Creation),
        //        new XAttribute(XMLNameForeignLanguage, data._TextForeignLanguage),
        //        new XAttribute(XMLNameGerman, data._TextOwnLanguage),
        //        new XAttribute(XMLNameInformation, data._Hint),
        //        new XAttribute(XMLNameInformationForeignLanguage, data._HintFoeignLanguage),
        //        new XAttribute(XMLNameInformationGerman, data._HintOwnLanguage)
        //        );
        //    foreach (Result wr in data._Results)
        //        XE.Add(wr.SaveToXElement());
        //    return XE;
        //}
        //#endregion
        //#region Load
        //public static Word LoadFromXElement(XElement data, Folder parent)
        //{
        //    try
        //    {
        //        Word w = new Word(
        //            ((string)data.Attribute(XMLNameGerman))??"",
        //            ((string)data.Attribute(XMLNameForeignLanguage)) ?? "",
        //            ((string)data.Attribute(XMLNameInformation)) ?? "",
        //            ((string)data.Attribute(XMLNameInformationGerman)) ?? "",
        //            ((string)data.Attribute(XMLNameInformationForeignLanguage)) ?? "",
        //            parent
        //            );
        //        foreach (XElement XE in data.Elements(Result.XMLNameMain))
        //        {
        //            Result.LoadFromXElement(XE, w);
        //        }
        //        return w;
        //    }
        //    catch (ApplicationExitException AEE)
        //    {
        //        throw AEE;
        //    }
        //    catch
        //    {
        //        return null;
        //    }
        //}
        //public static Word LoadFromXElement(XElement data)
        //{
        //    return LoadFromXElement(data, null);
        //}
        //#endregion
        //#endregion
        /// <summary>
        /// Kopiert das Wort
        /// </summary>
        /// <param name="cloneResults">Gibt an, ob die Ergebnisse mitkopiert werden sollen<para/>Werden die Ergebnisse mitkopiert, wird auch das Änderungs- und Erstellungsdatum übernommen.</param>
        public Word Clone(bool cloneResults)
        {
            Word w = new Word();

            w._Text_German = _Text_German;
            w._Text_OtherLanguage = _Text_OtherLanguage;
            w._Info = _Info;
            w._Info_German = _Info_German;
            w._Info_OtherLanguage = _Info_OtherLanguage;

            if (cloneResults)
            {
                w._DateCreated = _DateCreated;
                w._DateChanged = _DateChanged;
                foreach (Result wr in _Results)
                    wr.Clone(w);
            }
            return w;
        }
Beispiel #8
0
 private void neuToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var w = new Word();
     w.Parent = _Folder;
     var dlg = new PhillipKuhrt.VoTra.Forms.Editor.WordSettingsDialog();
     dlg.Vokabel = w;
     dlg.ShowDialog();
     //LvWords.Items.Add(GetListViewItem(w, CurrentUser));
     //LvWords.Sort();
     UpdateView();
 }
Beispiel #9
0
 private string GetStringFromColumn(Word w, ColumnHeader ch)
 {
     if (w == null || ch == null)
         return " ";
     if (ch == chTextGerman)
         if (_ShowText)
             return SyntaxProcessor.DoSyntax(w.TextGerman).Aggregate((a, b) => { return a + " # " + b; });
         else
             return w.TextGerman;
     if (ch == chTextOtherLanguage)
         if (_ShowText)
             return SyntaxProcessor.DoSyntax(w.TextOtherLanguage).Aggregate((a, b) => { return a + " # " + b; });
         else
             return w.TextOtherLanguage;
     if (ch == chInfo)
         return w.Info;
     if (ch == chInfoGerman)
         return w.InfoGerman;
     if (ch == chInfoOtherLanguage)
         return w.InfoOtherLanguage;
     return " ";
 }
Beispiel #10
0
 private ListViewItem GetListViewItem(Word w, User CurrentUser)
 {
     if (LvWords.Columns.Count > 0)
     {
         ListViewItem lvi = new ListViewItem();
         lvi.Text = GetStringFromColumn(w, LvWords.Columns[0]);
         for (int i = 1; i < LvWords.Columns.Count; i++)
         {
             lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, GetStringFromColumn(w, LvWords.Columns[i])));
         }
         lvi.Tag = w;
         lvi.ImageIndex = w.GetState(CurrentUser) - 1;
         return lvi;
     }
     else return null;
 }
Beispiel #11
0
 internal Result Clone(Word Parent)
 {
     return new Result(_Correct, Parent, _User,_Language_Assignment,_Text_Assignment,_Text_Answer) { _DateTime = _DateTime };
 }
Beispiel #12
0
 /// <summary>
 /// Überprüft, ob w in diesem Ordner enthalten ist.<para/>
 /// Ergebnisse:<para/>
 /// w == null -&gt; false
 /// </summary>
 public bool Contains(Word w)
 {
     return Contains(this, w);
 }
Beispiel #13
0
 /// <summary>
 /// Überprüft, ob w in f enthalten ist.
 /// </summary>
 public static bool Contains(Folder f, Word w)
 {
     if (f == null || w == null)
         return false;
     if (w.Parent == null)
         return false;
     return Contains(f, w.Parent);
 }