コード例 #1
0
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string surnameAndName = StewardName.Text;

            if (surnameAndName != "" && surnameAndName != null && surnameAndName.Contains(" "))
            {
                string[] split                   = surnameAndName.Split(' ');
                string   surname                 = split[0];
                string   name                    = split[1];
                bool     canBeTheManager         = manager.IsChecked ?? false;
                bool     canUseTheControlPanel   = panel.IsChecked ?? false;
                bool     canServeWithAMicrophone = microphone.IsChecked ?? false;
                Steward  steward                 =
                    new Steward(surname, name, canBeTheManager, canUseTheControlPanel, canServeWithAMicrophone);
                steward.saveToFile();
                StewardName.Text     = "";
                manager.IsChecked    = false;
                panel.IsChecked      = false;
                microphone.IsChecked = false;
            }
            else
            {
                MessageBox.Show("Неверный ввод фамилии и имени. Образец: Иванов Иван");
            }
        }
コード例 #2
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (StewardBox.SelectedIndex >= 0)
     {
         string   surnameAndName = StewardBox.Text;
         string[] split          = surnameAndName.Split(' ');
         string   surname        = split[0];
         string   name           = split[1];
         int      index          = StewardBox.SelectedIndex;
         bool     m   = manager.IsChecked ?? false;
         bool     p   = panel.IsChecked ?? false;
         bool     mic = microphone.IsChecked ?? false;
         properties[index, 0] = m;
         properties[index, 1] = p;
         properties[index, 2] = mic;
         Steward temp = new Steward(surname, name, m, p, mic);
         temp.saveToFile();
     }
     else
     {
         manager.IsChecked = panel.IsChecked = microphone.IsChecked = false;
     }
 }