private void Save(object obj) { if (AccountItem.Name == null || AccountItem.Name.TrimStart() == "") { // _form.titleRequiredImage.Visibility =Visibility.Visible; // AccountItem.Name = " "; return; } if (AccountItem.Url == null || AccountItem.Url.TrimStart() == "") { // _form. urlRequiredImage.Visibility = Visibility.Visible; // AccountItem.Url = " "; return; } if (AccountItem.Password == null || AccountItem.Password.TrimStart() == "") { // _form. passRequiredImage.Visibility = Visibility.Visible; return; } HIOStaticValues.CheckingData(AccountItem); HIOStaticValues.commandQ.Add(async() => { await UIService.Execute(async() => { Commands ic = new Commands(); if (ic.Insert(AccountItem.Url, AccountItem.Username, AccountItem.Name, AccountItem.Password) == 1) { Parent.LoadData(); Close(); } }); }); }
async Task QUpdateUserAsync() { try { await UIService.Execute(() => { Commands ic = new Commands(); HIOStaticValues.CheckingData(EditingObject); bool res = ic.UpdateUser(EditingObject.UserID, EditingObject.Url, EditingObject.AppID, EditingObject.Name, EditingObject.Username, EditingObject.Password, flagPass); if (res) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { IsSaving = true; EditingObject.EndEdit(); if (_Form?.Owner == null) /*from extension*/ { try { HIOStaticValues.tmain?.AccountManager?.LoadData(); HIOStaticValues.tmain?.AccountManager?.OnPropertyChanged(nameof(TAccountManagerViewModel.IsAllChecked)); } catch { /*TODO: remove try catch*/ } } if (_Form.IsVisible) { _Form.Close(); } })); } }); } finally { IsSaving = false; } }