Inheritance: ObservableClass
Esempio n. 1
0
 public SettingsAccount(Account account)
 {
     enabled = account.enabled;
     is_default_account = account.is_default_account;
     fields = (from fv in account.values select new SettingsField(fv)).ToArray();
 }
Esempio n. 2
0
 public Account GetAccount()
 {
     Account act = new Account { enabled = enabled, is_default_account = is_default_account };
     foreach (SettingsField field in fields) {
         FieldValue val = FieldValue.GetByName(act.values, field.name);
         if (val != null)
             val.value = field.value;
     }
     return act;
 }
Esempio n. 3
0
 private static bool guid_ok(Account acct, String guid)
 {
     var other = (from a in accounts where a.guid == guid && a != acct select a).SingleOrDefault();
     return (other == null);
 }
Esempio n. 4
0
 private void Account_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "is_default_account") {
         if (!is_default_account) {
             DelayedFunction.DelayedCall("Account_ensure_default", ensure_default_account, 500);
             return;
         }
         foreach (Account account in accounts)
             if (account != this)
                 account.is_default_account = false;
         default_account = this;
     }
 }
Esempio n. 5
0
 private static void ensure_default_account()
 {
     if (default_account != null && default_account.enabled)
         return;
     var res = (from a in accounts where a.enabled orderby a.gateway_id select a).FirstOrDefault();
     if (res != null)
         res.is_default_account = true;
     else
         default_account = null;
 }
Esempio n. 6
0
 public bool edit()
 {
     current_editing_account = this;
     GenericEditor editor = new GenericEditor();
     List<FieldValue> vals = new List<FieldValue>(values);
     var enabled_field = new Field(Field.FIELD_TYPE.Bool, "Account Enabled","enabled","",enabled ? "true" : "false","");
     var enabled_val = enabled_field.GetDefaultValue();
     vals.Insert(0, enabled_val);
     editor.Init("Editing Account", vals);
     editor.ShowDialog();
     if (editor.DialogResult == true){
         if (enabled_val.value == "true")
             enabled = true;
         else
             enabled = false;
         ReloadAccount();
     }
     else
         return false;
     return true;
 }
Esempio n. 7
0
 public static void RemoveAccount(Account account)
 {
     account.KillGateway();
     account.is_default_account = false;
     accounts.Remove(account);
     ReloadSofia();
 }
Esempio n. 8
0
 public static void AddAccount(Account account)
 {
     accounts.Add(account);
     bool was_default = account.is_default_account;
     account.is_default_account = false;
     account.is_default_account = was_default;
     String old_guid = account.guid;
     account.guid = "";
     account.guid = old_guid;
 }
Esempio n. 9
0
		public void DialString(Account account, String str){
			account.CreateCall(str);
		}