示例#1
0
 public CollectionLib(CollectionForm collectionTab, int idCollection)
 {
     InitializeComponent();
     darkMode = ManageUserAction.GetDarkMode();
     //
     if (darkMode)
     {
         UpdateTheme();
     }
     //
     this.collectionTab = collectionTab;
     this.KeyPreview    = true;
     //
     index = 0;
     this.curCollection = ManageUserAction.GetItemOfAllCollection(idCollection);
     if (idCollection == 0)
     {
         btnRemoveFromCollection.Visible = false;
     }
     else
     {
         btnRemoveFromCollection.Visible = true;
     }
     lbCollectionName.Text = curCollection.NameCollection;
     curFlashCard          = curCollection.ListFL[index];
     ChangeFlashCard(curFlashCard.Eng, curFlashCard.IdCard);
     InitAutoCompleteTextBox();
 }
示例#2
0
 public void LoadComboBox()
 {
     cbCollection.Items.Clear();
     for (int i = 1; i < ManageUserAction.CollectionCount(); i++)
     {
         cbCollection.Items.Add(ManageUserAction.GetItemOfAllCollection(i).NameCollection);
     }
 }
示例#3
0
        private void Level()
        {
            int a = ManageUserAction.GetItemOfAllCollection(0).ListFL.Count();

            int Level, Percent;

            Level   = a / 50;
            Percent = a % 50;

            lbLevel.Text  = Level.ToString();
            pbLevel.Value = Percent * 2;

            if (Level <= 1)
            {
                lbCapBac.Text    = "Beginner";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Iron 1.png");
            }
            else if (Level == 2)
            {
                lbCapBac.Text    = "High Beginner";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Iron 3.png");
            }
            else if (Level == 3)
            {
                lbCapBac.Text    = "Low Intermediate";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Bronze 3.png");
            }
            else if (Level == 4)
            {
                lbCapBac.Text    = "Intermediate";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Silver 3.png");
            }
            else if (Level == 5)
            {
                lbCapBac.Text    = "High Intermediate";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Gold 3.png");
            }
            else if (Level == 6)
            {
                lbCapBac.Text    = "Low Advanced";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Platinum 3.png");
            }
            else if (Level == 7)
            {
                lbCapBac.Text    = "Advanced";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Diamond 3.png");
            }
            else if (Level == 8)
            {
                lbCapBac.Text    = "Master";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Immortal 3.png");
            }
            else if (Level > 8)
            {
                lbCapBac.Text    = "Challenge";
                imageLevel.Image = Image.FromFile(ConfigurationManager.AppSettings.Get("imgPath_database") + "Rankings/Master Vocab.png");
            }
        }
示例#4
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (lvCollection.SelectedItems.Count != 0)
            {
                if (lvCollection.SelectedItems[0].Text == ManageUserAction.GetItemOfAllCollection(0).NameCollection)
                {
                    int size = lvCollection.SelectedItems.Count;
                    for (int i = 1; i < size; i++)
                    {
                        int id;
                        id = ManageUserAction.GetCollectionId(lvCollection.SelectedItems[1].Text);

                        if (id != 0)
                        {
                            lvCollection.Items.Remove(lvCollection.SelectedItems[1]);

                            ManageUserAction.DeleteCollection(id);

                            for (int j = id + 1; j <= ManageUserAction.CollectionCount() + 1; j++)
                            {
                                ManageUserAction.AfterDelete(j);
                                ManageUserAction.InitAllCollections();
                            }
                        }
                    }
                }
                else
                {
                    int size = lvCollection.SelectedItems.Count;
                    for (int i = 0; i < size; i++)
                    {
                        int id;
                        id = ManageUserAction.GetCollectionId(lvCollection.SelectedItems[0].Text);

                        if (id != 0)
                        {
                            lvCollection.Items.Remove(lvCollection.SelectedItems[0]);

                            ManageUserAction.DeleteCollection(id);

                            for (int j = id + 1; j <= ManageUserAction.CollectionCount() + 1; j++)
                            {
                                ManageUserAction.AfterDelete(j);
                                ManageUserAction.InitAllCollections();
                            }
                        }
                    }
                }
            }
        }
示例#5
0
        public static void UpdateGameMainFlashCards()
        {
            mainFlashCard.Clear();
            Random rd = new Random();

            while (mainFlashCard.Count < 25)
            {
                int index = rd.Next(1, ManageUserAction.GetItemOfAllCollection(0).ListFL.Count);
                if (mainFlashCard.IndexOf(ManageUserAction.GetItemOfAllCollection(0).ListFL[index]) < 0)
                {
                    mainFlashCard.Add(ManageUserAction.GetItemOfAllCollection(0).ListFL[index]);
                }
            }
        }
示例#6
0
        //public void LoadImageListView()
        //{
        //    imageList1.Images.Add("Collection", Image.FromFile(@ConfigurationManager.AppSettings.Get("imgPath_icons") + "book_80px.png"));
        //}

        public void LoadListView()
        {
            lvCollection.Items.Clear();
            imageList1.Images.Add("Collection", Image.FromFile(@ConfigurationManager.AppSettings.Get("imgPath_icons") + "book_80px.png"));
            lvCollection.SmallImageList = imageList1;
            lvCollection.LargeImageList = imageList1;
            for (int i = 0; i < ManageUserAction.CollectionCount(); i++)
            {
                lvCollection.Items.Add(ManageUserAction.GetItemOfAllCollection(i).NameCollection);
            }

            for (int i = 0; i < lvCollection.Items.Count; i++)
            {
                lvCollection.Items[i].ImageIndex = 0;
            }
        }
示例#7
0
 private void btnChooseType_Click(object sender, EventArgs e)
 {
     if (ManageUserAction.GetItemOfAllCollection(0).ListFL.Count >= 20)
     {
         pnlType.Show();
         btnChooseType.Hide();
         btnStart.Show();
         lbNotification.Visible = false;
         btnBack.Show();
     }
     else
     {
         guna2Transition1.ShowSync(lbNotification);
         timer1.Start();
     }
 }
示例#8
0
        public void UpdateInfoResult()
        {
            string        TK = ManageSystem.TK();
            int           ID = ManageSystem.GetUserID(TK);
            List <string> a  = ManageSystem.UserInfoPersonal(ID);

            lbTotal.Text = a[5];

            //
            lbTotal.Text        = ManageUserAction.GetItemOfAllCollection(0).ListFL.Count().ToString();
            lbLearned.Text      = lbTotal.Text;
            lbToLearn.Text      = (ManageSystem.CountAllFlashCards() - ManageUserAction.GetItemOfAllCollection(0).ListFL.Count()).ToString();
            pbAnimals.Value     = ManageUserAction.CalculateProgress(1, ID);
            pbPlants.Value      = ManageUserAction.CalculateProgress(2, ID);
            pbFruits.Value      = ManageUserAction.CalculateProgress(3, ID);
            pbJob.Value         = ManageUserAction.CalculateProgress(4, ID);
            pbFoodaDrinks.Value = ManageUserAction.CalculateProgress(5, ID);
            pbSport.Value       = ManageUserAction.CalculateProgress(6, ID);
            pbClothing.Value    = ManageUserAction.CalculateProgress(7, ID);
            pbTechnology.Value  = ManageUserAction.CalculateProgress(8, ID);
        }
示例#9
0
        private void lvCollection_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            string newName = e.Label;
            string oldName = lvCollection.SelectedItems[0].Text;

            int index = ManageUserAction.GetCollectionId(newName);

            if (newName == ManageUserAction.GetItemOfAllCollection(0).NameCollection)
            {
                e.CancelEdit = true;
                return;
            }

            if (newName != null && newName.Length != 0)
            {
                if (index != -1)
                {
                    newName      = oldName;
                    e.CancelEdit = true;
                }
                ManageUserAction.RenameCollection(oldName, newName);
            }
            ManageUserAction.InitAllCollections();
        }
示例#10
0
 private void AddFlashCard(FlashCard fl)
 {
     ManageUserAction.AddFlashCardToCollection(0, fl);
     ManageUserAction.AddFlashCardToDatabase(0, ManageUserAction.GetItemOfAllCollection(0).NameCollection, fl);
 }
示例#11
0
 public void InitCollecion(int idCol)
 {
     choseCol = ManageUserAction.GetItemOfAllCollection(idCol);
 }