Exemplo n.º 1
0
 /// <summary>
 /// Adds the new.
 /// </summary>
 private void AddNew()
 {
     var frmVersion = new frm_VersionName();
     frmVersion.ShowDialog();
     if (frmVersion.NewVersion != string.Empty) {
         if (CurrentCollection == null) {
             CurrentCollection = new AddressDTOCollection();
         }
         var res = (from addr in CurrentCollection where addr.ClientVersion == frmVersion.NewVersion select addr);
         if (res.Count() == 0) {
             CurrentAddress = new AddressDTO() { ClientVersion = frmVersion.NewVersion };
             CurrentCollection.Add(CurrentAddress);
             Save(false);
             LoadCollection(false);
             AllowChangeAddress = true;
             ddlVersion.SelectComboItem(CurrentAddress.ClientVersion);
         }
         else {
             MessageBox.Show("This version already exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             AllowChangeAddress = true;
             ddlVersion.SelectComboItem(res.First().ClientVersion);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Saves the address.
 /// </summary>
 /// <param name="address">The address.</param>
 public static void SaveAddress(AddressDTOCollection address)
 {
     var fi = new FileInfo(AddressFilePath);
     if (fi.Exists) { fi.Delete(); }
     fi.Write(address.Serialize());
 }