private void ButtonClear_Click(object sender, EventArgs e) { _firstValue = true; TextboxInput.Clear(); TextboxFormule.Clear(); LoseFocus(); }
private void CheckIfFirstValue() { if (_firstValue) { TextboxInput.Clear(); TextboxFormule.Clear(); _firstValue = false; } }
private void ButtonLeftBracket_Click(object sender, EventArgs e) { if (CheckIfSign(TextboxInput.Text, 0)) { TextboxFormule.Text += TextboxInput.Text; TextboxInput.Clear(); TextboxFormule.Text += "("; _aantalHaakjes++; } else { MessageBox.Show("Je kan geen haakjes plaatsen op deze plaats"); } LoseFocus(); }
private void ButtonDivide_Click(object sender, EventArgs e) { _firstValue = false; if (!CheckIfSign(TextboxInput.Text, TextboxInput.Text.Length - 1)) { TextboxFormule.Text += TextboxInput.Text; TextboxInput.Clear(); TextboxInput.Text += "/"; LoseFocus(); } else { MessageBox.Show("Hier kan geen / staan"); } }
private void ButtonSubtract_Click(object sender, EventArgs e) { _firstValue = false; if (TextboxInput.Text.Length == 0 || (TextboxInput.Text.Length == 1 && CheckIfSign(TextboxInput.Text, 0) && !CheckIfSign(TextboxFormule.Text, TextboxFormule.Text.Length - 1))) { TextboxInput.Text += "-"; } else if (TextboxInput.Text.Length < 2 || !CheckIfSign(TextboxInput.Text, 1)) { TextboxFormule.Text += TextboxInput.Text; TextboxInput.Clear(); TextboxInput.Text += "-"; } else { MessageBox.Show("Hier kan geen - staan"); } LoseFocus(); }
private void ButtonRightBracket_Click(object sender, EventArgs e) { bool sign = CheckIfSign(TextboxInput.Text, 0); if (_aantalHaakjes > 0 && !sign) { TextboxFormule.Text += TextboxInput.Text; TextboxInput.Clear(); TextboxFormule.Text += ")"; _aantalHaakjes--; } else if (sign) { MessageBox.Show("Je kan geen haakjes plaatsen op deze plaats"); } else { MessageBox.Show("Er zijn geen haakjes om te sluiten"); } LoseFocus(); }
private void LoseFocus() { TextboxInput.Focus(); TextboxInput.SelectionStart = TextboxInput.Text.Length; TextboxInput.SelectionLength = 0; }
void LoadCanvas(int can) { if (CurrentPage >= 0) { SaveCanvas(); } DesignCanvas.Children.Clear(); ControlInputPanel.Children.Clear(); DesignCanvas.Strokes.Clear(); CurrentPage = can; if (output.Pages[can].strokeCollection != null) { using (Stream stream = new MemoryStream(output.Pages[can].strokeCollection)) { StrokeCollection strokes = new StrokeCollection(stream); DesignCanvas.Strokes.Add(strokes); } } DesignCanvas.Background = new ImageBrush(ImageLoader.GetImage(output.Pages[can].Image)); TextBlock pageb = new TextBlock(); pageb.VerticalAlignment = VerticalAlignment.Center; pageb.TextWrapping = TextWrapping.Wrap; pageb.HorizontalAlignment = HorizontalAlignment.Center; pageb.Margin = new Thickness(0, 10, 0, 15); pageb.FontWeight = FontWeights.Bold; pageb.Text = Good_Teacher.Strings.ResStrings.Page + ": " + (output.Pages[can].Page + 1); ControlInputPanel.Children.Add(pageb); foreach (Good_Teacher.Class.Save.Output.InputType intype in output.Pages[can].InputList) { switch (intype.Type()) { case 0: { TextboxInput textboxInput = (TextboxInput)intype; Image image = new Image(); image.Width = 24; image.Height = 24; image.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Good Teacher;Component/Resources/Controls/Checkbox.png")); TextBlock textBlock = new TextBlock(); textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.TextWrapping = TextWrapping.Wrap; textBlock.Margin = new Thickness(5, 0, 0, 0); textBlock.Text = Input.ID; StackPanel idPanel = new StackPanel(); idPanel.Orientation = Orientation.Horizontal; idPanel.Children.Add(image); idPanel.Children.Add(textBlock); idPanel.Margin = new Thickness(0, 0, 0, 5); CheckBox checkBox = new CheckBox(); checkBox.Content = Good_Teacher.Strings.ResStrings.IsChecked; checkBox.IsChecked = Input.Check; checkBox.IsEnabled = false; StackPanel stackPanel = new StackPanel(); stackPanel.Margin = new Thickness(0, 5, 0, 10); stackPanel.Children.Add(idPanel); stackPanel.Children.Add(checkBox); ControlInputPanel.Children.Add(stackPanel); ControlInputPanel.Children.Add(new Separator() { Margin = new Thickness(0, 0, 0, 10) }); } break; case 2: { RadioButtonInput Input = (RadioButtonInput)intype; Image image = new Image(); image.Width = 24; image.Height = 24; image.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Good Teacher;Component/Resources/Controls/ToggleButton.png")); TextBlock textBlock = new TextBlock(); textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.TextWrapping = TextWrapping.Wrap; textBlock.Margin = new Thickness(5, 0, 0, 0); textBlock.Text = Input.ID; StackPanel idPanel = new StackPanel(); idPanel.Orientation = Orientation.Horizontal; idPanel.Children.Add(image); idPanel.Children.Add(textBlock); idPanel.Margin = new Thickness(0, 0, 0, 5); TextBlock textBlockTXT = new TextBlock(); textBlockTXT.VerticalAlignment = VerticalAlignment.Center; textBlockTXT.TextWrapping = TextWrapping.Wrap; textBlockTXT.Margin = new Thickness(0, 5, 0, 15); textBlockTXT.Text = Input.Text; CheckBox checkBox = new CheckBox(); checkBox.Content = Good_Teacher.Strings.ResStrings.IsChecked; checkBox.IsChecked = Input.Check; checkBox.IsEnabled = false; StackPanel stackPanel = new StackPanel(); stackPanel.Margin = new Thickness(0, 5, 0, 10); stackPanel.Children.Add(idPanel); if (!String.IsNullOrWhiteSpace(Input.Text)) { stackPanel.Children.Add(textBlockTXT); } stackPanel.Children.Add(checkBox); ControlInputPanel.Children.Add(stackPanel); ControlInputPanel.Children.Add(new Separator() { Margin = new Thickness(0, 0, 0, 10) }); } break; } } }