private void checkPsw() { stop = false; TH.addOnceData(checkAnimation); Thread.Sleep(2000); StringBuilder psw = new StringBuilder(); foreach (string s in ps) { psw.Append(s); } if (psw.ToString() == testPassword) { TH.addOnceUI(new Action(() => { Visibility = Visibility.Hidden; if (nextStep != null) { nextStep(); } tip.Text = ""; foreach (Label l in p) { l.Content = ""; } ps.Clear(); index = 0; })); } else { stop = true; } }
private void TXButton_Click(object sender, RoutedEventArgs e) { if (canBeChange == false) { return; } TXButton tx = sender as TXButton; if (tx.Content != null) { string txt = tx.Content as string; if (txt.Length == 1) { if (index >= p.Length) { return; } if (tip.Text != "") { tip.Text = ""; } ps.Add(txt); p[index].Content = "●"; index++; if (index >= p.Length) { canBeChange = false; TH.addOnceData(checkPsw); } } else { foreach (Label l in p) { l.Content = ""; } ps.Clear(); index = 0; Hide(); } } else { if (index == 0) { return; } ps.RemoveAt(ps.Count - 1); index--; p[index].Content = ""; } }
private void input(string val) { if (index >= p.Length) { return; } ps.Add(val); p[index].Content = "●"; index++; if (index >= p.Length) { canBeChange = false; TH.addOnceData(checkPsw); } }