Exemplo n.º 1
0
 public AddUpdateDialog(GymLeader lead)
 {
     InitializeComponent();
     txtName.Text             = lead.Name;
     cbogymType.SelectedIndex = (lead.gymType == GymType.Elite4) ? 0 : 1;
     txtGymUp.Text            = lead.gymUpMessage;
     txtGymDown.Text          = lead.gymDownMessage;
     txtName.IsEnabled        = false;
 }
Exemplo n.º 2
0
 private void btnDialogOk_Click(object sender, RoutedEventArgs e)
 {
     leader = new GymLeader
     {
         Name             = txtName.Text.ToLower(),
         Online           = "Offline",
         gymType          = (cbogymType.SelectedIndex == 0)? GymType.Elite4 : GymType.Gym,
         offlineCountdown = 0,
         gymUpMessage     = txtGymUp.Text,
         gymDownMessage   = txtGymDown.Text
     };
     this.DialogResult = true;
 }
Exemplo n.º 3
0
        public void AddOrUpdateLeader(GymLeader leader)
        {
            var item = gymLeaders.FirstOrDefault(i => i.Name.ToLower() == leader.Name.ToLower());

            if (item != null)
            {
                int i = gymLeaders.IndexOf(item);
                gymLeaders[i] = leader;
            }
            else
            {
                gymLeaders.Add(leader);
            }
            UpdateGymFile();
        }