Esempio n. 1
0
 private void countSoundbttn_Click(object sender, EventArgs e)
 {
     try
     {
         List <Composition> compositions = CompositionsDGVConvert.DGVToCompositionsList(InputCompositionsDGV);
         disk.Compositions  = compositions;
         countSoundlbl.Text = Convert.ToString(disk.Duration);
     }
     catch (Exception ex)
     {
         MessagesUtils.ShowError("Произошла ошибка!");
     }
 }
Esempio n. 2
0
 private void SortCompositionsbttn_Click(object sender, EventArgs e)
 {
     try
     {
         List <Composition> compositions = CompositionsDGVConvert.DGVToCompositionsList(InputCompositionsDGV);
         disk.Compositions = compositions;
         disk.Sort();
         CompositionsDGVConvert.CompositionsListToDGV(InputCompositionsDGV, disk.Compositions);
     }
     catch (Exception ex)
     {
         MessagesUtils.ShowError("Произошла ошибка!");
     }
 }
Esempio n. 3
0
        private void MainMenuFileSave_Click(object sender, EventArgs e)
        {
            if (SaveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string path = SaveFileDialog.FileName;

                    List <Composition> compositionsList = CompositionsDGVConvert.DGVToCompositionsList(InputCompositionsDGV);
                    CompositionsFilesUtils.SaveCompositionsToFile(path, compositionsList);

                    MessagesUtils.ShowMessage("Данные сохранены в файл");
                }
                catch (Exception ex)
                {
                    MessagesUtils.ShowError("Ошибка сохранения в файл");
                }
            }
        }
Esempio n. 4
0
        private void MainMenuFileOpen_Click(object sender, EventArgs e)
        {
            if (OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string path = OpenFileDialog.FileName;

                    List <Composition> compositionsList = CompositionsFilesUtils.ReadCompositionFromFile(path);
                    disk = new Disk(compositionsList);
                    CompositionsDGVConvert.CompositionsListToDGV(InputCompositionsDGV, disk.Compositions);

                    MessagesUtils.ShowMessage("Данные загружены из файла");
                }
                catch (Exception ex)
                {
                    MessagesUtils.ShowError("Ошибка чтения из файла");
                }
            }
        }
Esempio n. 5
0
        private void Searchbttn_Click(object sender, EventArgs e)
        {
            try
            {
                List <Composition> compositions = CompositionsDGVConvert.DGVToCompositionsList(InputCompositionsDGV);
                disk.Compositions = compositions;
                List <Composition> foundedCompositions = disk.Search((double)Fromnum.Value, (double)Tonum.Value);

                string result = "";

                foreach (Composition composition in foundedCompositions)
                {
                    result += composition.Name + Environment.NewLine;
                }

                searchlbl.Text = result;
            }
            catch (Exception ex)
            {
                MessagesUtils.ShowError("Произошла ошибка!");
            }
        }