public string CalculatePin() { GPinGenerator pg = new GPinGenerator(6, 30); string mPIN = pg.computePin(SecretKey); return(mPIN); }
private void UpdateStackPanel() { //clear current data in stack panel SPAccounts.Children.Clear(); //for every account int i = 0; foreach (Account acct in a.WorkingDB.Accounts) { //retrieve account information string tempName = acct.AccountName; //generate new stack panel StackPanel tempSP = new StackPanel(); StackPanel tempSP2 = new StackPanel(); tempSP.Orientation = System.Windows.Controls.Orientation.Vertical; tempSP.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; tempSP.VerticalAlignment = System.Windows.VerticalAlignment.Center; tempSP.Margin = new Thickness(0, 0, 0, 20); TextBlock tempTBName = new TextBlock(); tempTBName.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; tempTBName.VerticalAlignment = System.Windows.VerticalAlignment.Center; tempTBName.FontSize = 24; tempTBName.Text = tempName; TextBlock tempTBPin = new TextBlock(); tempTBPin.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; tempTBPin.VerticalAlignment = System.Windows.VerticalAlignment.Center; tempTBPin.FontSize = 32; tempTBPin.Text = acct.CalculatePin(); if (GPinGenerator.numberSecondsLeft() <= 5) { tempTBPin.Foreground = new SolidColorBrush(Colors.Red); } else { tempTBPin.Foreground = new SolidColorBrush(Color.FromArgb(255, 55, 145, 200)); } tempSP.Children.Add(tempTBName); tempSP.Children.Add(tempTBPin); //put new stackpanel in master stackpanel SPAccounts.Children.Add(tempSP); i++; } }
private void UpdateProgressBar() { if (a.WorkingDB.Accounts.Count > 0) { pbTimeLeft.Visibility = System.Windows.Visibility.Visible; } else { pbTimeLeft.Visibility = System.Windows.Visibility.Collapsed; } pbTimeLeft.Value = GPinGenerator.numberSecondsLeft(); if (GPinGenerator.numberSecondsLeft() <= 5) { pbTimeLeft.Foreground = new SolidColorBrush(Colors.Red); } else { pbTimeLeft.Foreground = new SolidColorBrush(Color.FromArgb(255, 55, 145, 200)); } }
public string CalculatePin() { GPinGenerator pg = new GPinGenerator(6, 30); string mPIN = pg.computePin(SecretKey); return mPIN; }