private void CreateBoxes() { if (NumberBox.Text != "") { int max = int.Parse(NumberBox.Text); App.yale.Boxes.Box = new List <Box>(); App.PhoneDict.Clear(); for (int i = 0; i < max; i++) { App.yale.Boxes.Box.Add(new Box { id = (i + 1) + "", state = "on", pin = "", timeOn = DateTimeOffset.MinValue, owner = new Owner { name = "", phone = "", icon = "ms-appx:///Assets/Images/Flat-Icons/default-account.png" } }); } App.SetJsonFile(); this.Frame.GoBack(); } else { NumberBox.Focus(FocusState.Keyboard); } }
private void btnClear_Click(object sender, EventArgs e) { NumberBox.Text = ""; //ResultBox.Text = ""; ResultLog.Text = ""; NumberBox.Focus(); NumberBox.SelectionStart = NumberBox.TextLength; NumberBox.SelectionLength = 0; }
public void DelChar() { if (NumberBox.SelectionLength == 0 && NumberBox.SelectionStart != 0) { NumberBox.SelectionStart -= 1; NumberBox.SelectionLength = 1; } var selStart = NumberBox.SelectionStart; NumberBox.Text = NumberBox.Text.Substring(0, NumberBox.SelectionStart) + NumberBox.Text.Substring(NumberBox.SelectionStart + NumberBox.SelectionLength, NumberBox.TextLength - (NumberBox.SelectionStart + NumberBox.SelectionLength)); NumberBox.Focus(); NumberBox.SelectionStart = selStart; NumberBox.SelectionLength = 0; }
private void Reset1Box() { if (Number1Box.Text != "") { int num = int.Parse(Number1Box.Text); if (App.PhoneDict.ContainsKey(Number1Box.Text)) { App.yale.Boxes.Box[num - 1].state = "on"; App.yale.Boxes.Box[num - 1].pin = ""; App.yale.Boxes.Box[num - 1].timeOn = DateTimeOffset.MinValue; App.yale.Boxes.Box[num - 1].owner.name = ""; App.yale.Boxes.Box[num - 1].owner.phone = ""; App.yale.Boxes.Box[num - 1].owner.icon = "ms-appx:///Assets/Images/Flat-Icons/default-account.png"; App.SetJsonFile(); this.Frame.GoBack(); } } else { NumberBox.Focus(FocusState.Keyboard); } }
private void FocusNumBox() { NumberBox.Focus(); NumberBox.Select(0, NumberBox.Text.Length); }