Esempio n. 1
0
 public TestForm(List<Word> words, Language? lang, bool revise, User user)
 {
     rand = new Random();
     InitializeComponent();
     CurrentUser = user;
     WordsToDo = words;
     PresetLanguage = lang;
     PresetRevise = revise;
 }
Esempio n. 2
0
 internal Result()
 {
     _DateTime = DateTime.Now;
     _Correct = false;
     _User = null;
     Parent = null;
     Language_Assignment = Language.German;
     Text_Assignment = "";
     _Text_Answer = "";
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
 public DataForm(IconsFolder FolderIcons, List<Folder> Folders, User CurrentUser)
 {
     InitializeComponent();
     this.FolderIcons = FolderIcons;
     this.Folders = Folders;
     this.CurrentUser = CurrentUser;
     ControlFolders.Folders = Folders;
     ControlFolders.FolderIcons = FolderIcons;
     ControlWords.User = CurrentUser;
     ControlWords.Edit = true;
 }
Esempio n. 5
0
 public TestSettings(IconsFolder FolderIcons, List<Folder> Folders, User CurrentUser, IconsUser UserIcons)
 {
     InitializeComponent();
     this.FolderIcons = FolderIcons;
     this.Folders = Folders;
     this.CurrentUser = CurrentUser;
     this.UserIcons = UserIcons;
     folderControl1.Folders = Folders;
     folderControl1.FolderIcons = FolderIcons;
     lblUserName.Text = CurrentUser.Name;
     pbUserIcon.Image = UserIcons.GetIcon(CurrentUser.PictureID);
 }
Esempio n. 6
0
 private void button2_Click(object sender, EventArgs e)
 {
     User u = new User();
     u.Name = "Neuer Benutzer";
     u.PictureID = 0;
     Users.Add(u);
     Hide();
     new UserSettingsForm(Users, u, UserIcons).ShowDialog();
     if (Users.Contains(u))
     {
         DialogResult = DialogResult.OK;
         CurrentUser = u;
         Close();
     }
 }
Esempio n. 7
0
        public UserSettingsForm(List<User> Users, User User, IconsUser UserIcons)
        {
            InitializeComponent();
            u = User;
            iu = UserIcons;
            lu = Users;
            ImageList imgL = new ImageList();
            imgL.ColorDepth = ColorDepth.Depth32Bit;
            imgL.ImageSize = new System.Drawing.Size(32, 32);
            foreach (var kvp in iu.IconDictionary)
            {
                imgL.Images.Add(kvp.Key.ToString(), kvp.Value);

                ListViewItem lvi = new ListViewItem();
                lvi.ImageKey = kvp.Key.ToString();
                lvi.Tag = kvp.Key;
                listView1.Items.Add(lvi);
                if (u.PictureID == kvp.Key)
                    lvi.Selected = true;
            }
            listView1.SmallImageList = imgL;
            listView1.LargeImageList = imgL;
            textBox1.Text = u.Name;
        }
Esempio n. 8
0
 /// <summary>
 /// Löscht die Ergebnisse des angegebenen Benutzers für dieses Wort
 /// </summary>
 public void ResetResults(User User)
 {
     foreach (Result r in GetResults(User))
         r.Parent = null;
 }
Esempio n. 9
0
 private void UserSelectionForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (CurrentUser == null)
     {
         if (listView1.SelectedItems.Count == 0)
         {
             CurrentUser = null;
             DialogResult = DialogResult.Cancel;
         }
         else
             if (listView1.SelectedItems[0].Tag is User)
             {
                 CurrentUser = listView1.SelectedItems[0].Tag as User;
                 DialogResult = DialogResult.OK;
             }
             else
             {
                 CurrentUser = null;
                 DialogResult = DialogResult.Cancel;
             }
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Gibt die Ergebnisse des angegebenen Benutzers zurück
 /// </summary>
 public List<Result> GetResults(User user)
 {
     List<Result> temp = new List<Result>();
     foreach (Result res in _Results)
         if (res.User == user)
             temp.Add(res);
     return temp;
 }
Esempio n. 11
0
        /// <summary>
        /// Gibt den aktuellen Status (1-5) des angegebenen Benutzers für das aktuelle Wort zurück
        /// </summary>
        public int GetState(User User)
        {
            List<Result> lr = GetResults(User);
            int _Status = 1;
            lr.Sort(
                (Comparison<Result>)((Result a, Result b) =>
                {
                    if (a.DateTime < b.DateTime)
                        return -1;
                    if (a.DateTime > b.DateTime)
                        return +1;
                    return 0;

                })
            );
            foreach (Result r in lr)
                if (r.Correct)
                {
                    if (_Status < 5)
                        _Status++;
                }
                else
                {
                    _Status = 1;
                }
            return _Status;
        }
Esempio n. 12
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;
 }
Esempio n. 13
0
 public int CountResults(User u)
 {
     int r = 0;
     foreach (Result res in _Results)
         if (res.User == u)
             r++;
     return r;
 }
Esempio n. 14
0
 public double GetState(User u, bool subfolders)
 {
     return (subfolders ? _Folders.Sum((f) =>
     {
         return f.GetState(u, true) * f.CountWords(true);
     })
     : 0) + CountWords(subfolders);
 }
Esempio n. 15
0
 public void ResetResults(User u)
 {
     foreach (Word w in _Words)
         w.ResetResults(u);
 }
Esempio n. 16
0
 public int CountResults(User u)
 {
     int res = 0;
     foreach (Word w in _Words)
         res += w.CountResults(u);
     foreach (Folder f in _Folders)
         res += f.CountResults(u);
     return res;
 }
Esempio n. 17
0
 private void SelectUser()
 {
     UserSelectionForm usf = new UserSelectionForm(UserIcons, Users);
     //Hide();
     var dr = usf.ShowDialog();
     if (dr == DialogResult.OK)
     {
         CurrentUser = usf.User;
         lblUserName.Text = CurrentUser.Name;
         pbUserIcon.Image = UserIcons.GetIcon(CurrentUser.PictureID);
         Show();
     }
     if (CurrentUser == null)
         Close();
     //else
     //    Show();
 }
Esempio n. 18
0
 private void lblSettings_Click(object sender, EventArgs e)
 {
     //Hide();
     new UserSettingsForm(Users, CurrentUser, UserIcons).ShowDialog();
     if (Users.Contains(CurrentUser))
     {
         lblUserName.Text = CurrentUser.Name;
         pbUserIcon.Image = UserIcons.GetIcon(CurrentUser.PictureID);
         //Show();
     }
     else
     {
         CurrentUser = null;
         SelectUser();
     }
 }