Example #1
0
        public List <Court> ImportCourts(string filename)
        {
            List <Court> _courts = new List <Court>();
            Court        court;

            try
            {
                using (StreamReader fs = new StreamReader(filename))
                {
                    string temp;
                    while (true)
                    {
                        temp = fs.ReadLine();
                        if (temp == null)
                        {
                            break;
                        }
                        var strparams = temp.Split('\t');
                        court = new Court(strparams[0], int.Parse(strparams[1]), int.Parse(strparams[2]), int.Parse(strparams[3]), int.Parse(strparams[4]));
                        _courts.Add(court);
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show("Не удалось прочитать файл импорта!\n" + err.Message);
            }

            return(_courts);
        }
 private void bAdd_Click(object sender, RoutedEventArgs e)
 {
     if (lvAllCause.SelectedIndex != -1 && lvAllCause.SelectedItems?.Count > 0)
     {
         SelectedCourt = (Court)lvAllCause.SelectedItem;
         this.Close();
     }
     else
     {
         MessageBox.Show("Не оберано жодного суду!", "Помилка", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
Example #3
0
        private void btnMore_Click(object sender, RoutedEventArgs e)
        {
            var   wndAdd = new WndCourts();
            Court result = wndAdd.ShowDialog();

            if (result != null && result?.Name.Length > 0)
            {
                Settings.Instance.NearCourts.Add(result);
                cbCourts.ItemsSource = null;
                cbCourts.ItemsSource = Settings.Instance.NearCourts;
            }
        }