public ComputeNumSystem() { ((ISupportInitialize)(FirstNumeric)).BeginInit(); TBLayout.SuspendLayout(); ((ISupportInitialize)(SecondNumeric)).BeginInit(); ((ISupportInitialize)(AnswerNumeric)).BeginInit(); SuspendLayout(); TBLayout.SuspendLayout(); Controls.Add(ButtonAnswer); Controls.Add(FirstNumeric); Controls.Add(FirstLabel); Controls.Add(FirstTextBox); Controls.Add(TBLayout); Controls.Add(SecondNumeric); Controls.Add(SecondLabel); Controls.Add(SecondTextBox); Controls.Add(LabelAnswer); Controls.Add(AnswerNumeric); Controls.Add(AnswerTextBox); Name = "ComputeNumSystem"; ButtonAnswer.AddColor1(); ButtonAnswer.Click += new EventHandler(EnterAnswer); ButtonPlus.AddColor1(); ButtonPlus.Click += new EventHandler(InsertSymbol); ButtonMinus.AddColor1(); ButtonMinus.Click += new EventHandler(InsertSymbol); ButtonDevide.AddColor1(); ButtonDevide.Click += new EventHandler(InsertSymbol); ButtonMultiple.AddColor1(); ButtonMultiple.Click += new EventHandler(InsertSymbol); TBLayout.Controls.AddRange(new Control[] { ButtonPlus, ButtonMinus, ButtonDevide, ButtonMultiple }); ((ISupportInitialize)(FirstNumeric)).EndInit(); TBLayout.ResumeLayout(false); ((ISupportInitialize)(SecondNumeric)).EndInit(); ((ISupportInitialize)(AnswerNumeric)).EndInit(); }
void ReleaseDesignerOutlets() { if (ViewLabel != null) { ViewLabel.Dispose(); ViewLabel = null; } if (ButtonZero != null) { ButtonZero.Dispose(); ButtonZero = null; } if (ButtonOne != null) { ButtonOne.Dispose(); ButtonOne = null; } if (ButtonTwo != null) { ButtonTwo.Dispose(); ButtonTwo = null; } if (ButtonThree != null) { ButtonThree.Dispose(); ButtonThree = null; } if (ButtonFour != null) { ButtonFour.Dispose(); ButtonFour = null; } if (ButtonFive != null) { ButtonFive.Dispose(); ButtonFive = null; } if (ButtonSix != null) { ButtonSix.Dispose(); ButtonSix = null; } if (ButtonSeven != null) { ButtonSeven.Dispose(); ButtonSeven = null; } if (ButtonEight != null) { ButtonEight.Dispose(); ButtonEight = null; } if (ButtonNine != null) { ButtonNine.Dispose(); ButtonNine = null; } if (ButtonPlus != null) { ButtonPlus.Dispose(); ButtonPlus = null; } if (ButtonMinus != null) { ButtonMinus.Dispose(); ButtonMinus = null; } if (ButtonMultiply != null) { ButtonMultiply.Dispose(); ButtonMultiply = null; } if (ButtonDivide != null) { ButtonDivide.Dispose(); ButtonDivide = null; } if (ButtonEquals != null) { ButtonEquals.Dispose(); ButtonEquals = null; } if (ButtonClear != null) { ButtonClear.Dispose(); ButtonClear = null; } }
public void Sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { string txt = e.Result.Text; float confidence = e.Result.Confidence; if (confidence >= 0.4) { int first = Convert.ToInt32(e.Result.Semantics["first"].Value); //int second = Convert.ToInt32(e.Result.Semantics["second"].Value); //string operation = e.Result.Semantics["operation"].Value.ToString(); switch (first) { case 1: Button1.Dispatcher.Invoke(new Action(() => { Button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button1.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 2: Button2.Dispatcher.Invoke(new Action(() => { Button2.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button2.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 3: Button3.Dispatcher.Invoke(new Action(() => { Button3.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button3.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 4: Button4.Dispatcher.Invoke(new Action(() => { Button4.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button4.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 5: Button5.Dispatcher.Invoke(new Action(() => { Button5.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button5.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 6: Button6.Dispatcher.Invoke(new Action(() => { Button6.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button6.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 7: Button7.Dispatcher.Invoke(new Action(() => { Button7.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button7.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 8: Button8.Dispatcher.Invoke(new Action(() => { Button8.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button8.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 9: Button9.Dispatcher.Invoke(new Action(() => { Button9.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button9.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 0: Button0.Dispatcher.Invoke(new Action(() => { Button0.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button0.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 10: ButtonRowne.Dispatcher.Invoke(new Action(() => { ButtonRowne.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonRowne.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 11: ButtonPlus.Dispatcher.Invoke(new Action(() => { ButtonPlus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonPlus.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 12: ButtonMinus.Dispatcher.Invoke(new Action(() => { ButtonMinus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonMinus.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 13: ButtonRazy.Dispatcher.Invoke(new Action(() => { ButtonRazy.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonRazy.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 14: ButtonPrzez.Dispatcher.Invoke(new Action(() => { ButtonPrzez.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonPrzez.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 15: ButtonC.Dispatcher.Invoke(new Action(() => { ButtonC.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonC.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; default: break; } //if (operation == "plus") //{ // ButtonPlus.Dispatcher.Invoke(new Action(() => // { // ButtonPlus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //else if (operation == "minus") //{ // ButtonMinus.Dispatcher.Invoke(new Action(() => // { // ButtonMinus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //else if (operation == "razy") //{ // ButtonRazy.Dispatcher.Invoke(new Action(() => // { // ButtonRazy.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //else if (operation == "przez") //{ // ButtonPrzez.Dispatcher.Invoke(new Action(() => // { // ButtonPrzez.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //switch (second) //{ // case 1: // Button1.Dispatcher.Invoke(new Action(() => // { // Button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 2: // Button2.Dispatcher.Invoke(new Action(() => // { // Button2.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 3: // Button3.Dispatcher.Invoke(new Action(() => // { // Button3.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 4: // Button4.Dispatcher.Invoke(new Action(() => // { // Button4.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 5: // Button5.Dispatcher.Invoke(new Action(() => // { // Button5.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 6: // Button6.Dispatcher.Invoke(new Action(() => // { // Button6.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 7: // Button7.Dispatcher.Invoke(new Action(() => // { // Button7.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 8: // Button8.Dispatcher.Invoke(new Action(() => // { // Button8.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 9: // Button9.Dispatcher.Invoke(new Action(() => // { // Button9.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 0: // Button0.Dispatcher.Invoke(new Action(() => // { // Button0.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // default: // break; //} //ButtonRowne.Dispatcher.Invoke(new Action(() => //{ // ButtonRowne.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); //})); } else { ss.Speak("Proszę powtórzyć"); } }