private void LoadData(List <LoginFieldS> lf) { SourceItems.Clear(); if (lf != null && lf.Count > 0) { Converts conv = new Converts(); foreach (LoginFieldS fields in lf) { DrawingImage tmpDraw = new DrawingImage(); if (fields.imageData == null || fields.imageData.Length == 0) { tmpDraw = HIOStaticValues.PutTextInImage(fields.url.Substring(0, 1)); } else { tmpDraw = conv.BitmapImageToDrawingImage(conv.byteArrayToImage(fields.imageData)); } SourceItems.Add(new TLinkItem(fields.title, fields.userName, tmpDraw, Int32.Parse(fields.rowid), fields.url)); } } OnPropertyChanged(() => Items); }
public void Initialize(LoginFieldS lf) { Commands.AddCommand("NotNow", NotNow); Commands.AddCommand("Add", Add); DrawingImage tmpDraw = new DrawingImage(); try { Username = lf.userName; Password = lf.password; Title = lf.title; _lf = lf; tmpDraw = HIOStaticValues.PutTextInImage(lf.url.Substring(0, 1)); IconUrl = tmpDraw; Task.Run(() => { Favicon fv = new Favicon(); fv.GetFromUrlAsync("http://" + lf.url); fv.GetFromUrlAsyncCompleted += Fv_GetFromUrlAsyncCompleted; }); } catch (Exception ex) { } }
private void Apply() { //TODO:Validate data //TODO:Save Changes var isInvalid = false; if (HIOStaticValues.TPinStatus()) { if (EditingObject.Name.TrimStart() == "") { _Form.titleRequiredImage.Visibility = Visibility.Visible; EditingObject.Name = " "; isInvalid = true; } if (EditingObject.Url != null && EditingObject.Url.TrimStart() == "") { _Form.urlRequiredImage.Visibility = Visibility.Visible; EditingObject.Url = " "; isInvalid = true; } if (EditingObject.Password == null) { EditingObject.Password = ""; } if (isInvalid) { return; } HIOStaticValues.commandQ.Add(() => QUpdateUserAsync()); } }
private void _Form_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (IsImporting == true) { e.Cancel = true; HIOStaticValues.popUp("You can not close window while importing data"); } }
private void LoadData(List <LoginFieldS> listlp) { SourceItems.Clear(); SourceAllItems.Clear(); DataBase db = new DataBase(); List <LoginFieldS> llp = db.getInfoFromDB("*", "", ""); Converts conv = new Converts(); if (listlp != null && listlp.Any()) { foreach (LoginFieldS lf in listlp) { DrawingImage tmpDraw = new DrawingImage(); if (lf.imageData == null || lf.imageData.Length == 0) { tmpDraw = HIOStaticValues.PutTextInImage(lf.url.Substring(0, 1)); } else { tmpDraw = conv.BitmapImageToDrawingImage(conv.byteArrayToImage(lf.imageData)); } SourceItems.Add(new TLinkItem { Title = lf.title, Description = lf.userName, ImageData = tmpDraw, Id = Int32.Parse(lf.rowid), Url = url }); } } if (llp != null && llp.Any()) { foreach (LoginFieldS lf in llp) { DrawingImage tmpDraw = new DrawingImage(); if (lf.imageData == null || lf.imageData.Length == 0) { tmpDraw = HIOStaticValues.PutTextInImage(lf.url.Substring(0, 1)); } else { tmpDraw = conv.BitmapImageToDrawingImage(conv.byteArrayToImage(lf.imageData)); } SourceAllItems.Add(new TLinkItem { Title = lf.title, Description = lf.userName, ImageData = tmpDraw, Id = Int32.Parse(lf.rowid), Url = lf.url }); } } OnPropertyChanged(() => Items); }
private void Add() { if (HIOStaticValues.TPinStatus()) { Commands cmd = new Backend.Commands(); cmd.Insert(_lf.url, Username, Title, Password); try { HIOStaticValues.tmain?.AccountManager?.LoadData(); HIOStaticValues.tmain?.AccountManager?.OnPropertyChanged(nameof(TAccountManagerViewModel.IsAllChecked)); } catch { /*TODO: remove try catch*/ } Close(); } }
private void ResetPersonalPinOK() { ShowResetPersonalPin = false; Commands cmd = new Backend.Commands(); if (!cmd.EraseAll()) { HIOStaticValues.popUp("Something went wrong!"); return; } if (SetupWizard != null) { SetupWizard.ActivePage = SetupWizard.Pages.First(t => t is TNewDeviceAddingPage1); } }
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; } }