Exemplo n.º 1
0
 private void EditLocation_Click(object sender, EventArgs e)
 {
     if (LocationList.SelectedIndex != -1 && LocationList.Items.Count > 0)
     {
         CommonData.FromEdit = true;
         LocationForm form = new LocationForm();
         form.ShowDialog();
         LocationList.Items.Clear();
         foreach (var item in CommonData.LocationList)
         {
             LocationList.Items.Add(item.Name);
             if (item.Name == CommonData.LocationName)
             {
                 try
                 {
                     LocationList.SelectedItem = item.Name;
                 }
                 catch (Exception)
                 {
                 }
             }
         }
         ReadWrite.WriteLocationFile(CommonData.LocationFilePath);
     }
 }
Exemplo n.º 2
0
        private void CreateLocation_Click(object sender, EventArgs e)
        {
            CommonData.FromEdit = false;
            LocationForm form = new LocationForm();

            form.ShowDialog();
            LocationList.Items.Clear();
            foreach (var item in CommonData.LocationList)
            {
                LocationList.Items.Add(item.Name);
            }
            try
            {
                LocationList.SelectedIndex = LocationList.Items.Count - 1;
            }
            catch (Exception)
            {
            }
            ReadWrite.WriteLocationFile(CommonData.LocationFilePath);
        }