Exemplo n.º 1
0
        private void English_Data_ListChanged(object sender, ListChangedEventArgs e)
        {
            if (e.ListChangedType == ListChangedType.ItemAdded ||
                e.ListChangedType == ListChangedType.ItemDeleted ||
                e.ListChangedType == ListChangedType.ItemChanged)
            {
                try
                {
                    fileIOService.SaveDataWords(sender);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    Close();
                }
            }



            UnitsData.Clear();
            int a = 0;

            foreach (Word i in EnglishData)
            {
                int var = Convert.ToInt32(EnglishData[a].unit);
                if (UnitsData.IndexOf(var) == -1 && var > 0)
                {
                    UnitsData.Add(var);
                }
                a++;
            }

            try
            {
                fileIOService.SaveDataUnits(UnitsData);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Close();
            }
            UpdateComboBox();
        }