private void Name_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (ReceiverForm.Visibility == Visibility.Visible) { if (EmailLabel.Visibility == Visibility.Visible) { EmailLabel.Focus(); } else if (Phone.Visibility == Visibility.Visible) { PCode.Focus(); PCode.Select(PCode.Text.Length, 0); } else { ViewModel.Validate(); } } else { ViewModel.Validate(); } } }
private void PhoneNumber_OnKeyDown(object sender, KeyEventArgs args) { if (args.Key == Key.D8 || //звёздочка args.Key == Key.Unknown || //плюс (долгий тап по 0), или чёрточка/точка args.Key == Key.D3 || //решётка args.Key == Key.A || args.Key == Key.Space) { args.Handled = true; } if (args.Key == Key.Back && PhoneNumber.Text.Length == 0) { args.Handled = true; PCode.Focus(); PCode.Select(PCode.Text.Length, 0); } }
private void PhoneNumber_OnKeyDown(object sender, KeyEventArgs args) { if (args.Key == Key.D8 || args.Key == Key.Unknown || args.Key == Key.D3 || args.Key == Key.A || args.Key == Key.Space) { args.Handled = true; } if (args.Key == Key.Back && PhoneNumber.Text.Length == 0) { args.Handled = true; PCode.Focus(); PCode.Select(PCode.Text.Length, 0); } }
private void PhoneNumber_OnKeyDown(object sender, KeyEventArgs args) { if (args.Key == Key.Enter) { ViewModel.Validate(); } if (args.Key == Key.D8 || // * args.Key == Key.Unknown || // +(long tap on 0) or -/. args.Key == Key.D3 || // # args.Key == Key.A || args.Key == Key.Space) { args.Handled = true; } if (args.Key == Key.Back && PhoneNumberLabel.Text.Length == 0) { args.Handled = true; PCode.Focus(); PCode.Select(PCode.Text.Length, 0); } }
private async void RunByStep(object sender, RoutedEventArgs e) { if (_firstStep) { var tmp = Path.GetTempFileName(); await File.WriteAllTextAsync(tmp, PCode.Text); Input.IsReadOnly = false; var buffer = new StringBuilder(); var stepOutput = ""; var curIns = ""; var pc = 0; _firstStep = false; await RunAsync( tmp, (_, e) => { // Console.Out.WriteLine(e.Data); if (e.Data?.StartsWith("**") ?? false) { var output = stepOutput; var ins = curIns; Dispatcher.Invoke(() => { Stack.Text = buffer.ToString(); Exec.Text += output; PCode.Focus(); //Console.Out.WriteLine(pc); if (pc == -99) { return; } var idx = PCode.GetCharacterIndexFromLineIndex(pc); PCode.Select(idx, ins.Length); }, DispatcherPriority.Render); buffer.Clear(); stepOutput = ""; curIns = ""; } else if (e.Data?.StartsWith("print") ?? false) { stepOutput = e.Data + "\n"; } else if (e.Data?.StartsWith("Press") ?? false) { // do nothing } else { if (e.Data?.StartsWith("-->") ?? false) { curIns = e.Data.Substring(9); // catch ins } if (e.Data?.StartsWith("PC =") ?? false) { Console.Out.WriteLine(e.Data.Substring(5)); pc = int.Parse(e.Data.Substring(5)); // catch PC } buffer.AppendLine(e.Data); } }, true ); } await(_inputWriter?.WriteLineAsync("c") ?? Task.FromResult(1)); }