コード例 #1
0
        private async Task AnimateButtons()
        {
            Button1.Scale = 0;
            Button2.Scale = 0;
            Button3.Scale = 0;
            Button4.Scale = 0;
            Button5.Scale = 0;
            Button6.Scale = 0;
            Button7.Scale = 0;
            Button8.Scale = 0;
            Button9.Scale = 0;
            Button0.Scale = 0;
            ButtonX.Scale = 0;

            await Task.Delay(300);

            var tasks = new Task[]
            {
                Button1.ScaleTo(1, 200),
                Button2.ScaleTo(1, 200),
                Button3.ScaleTo(1, 200),
                Button4.ScaleTo(1, 200),
                Button5.ScaleTo(1, 200),
                Button6.ScaleTo(1, 200),
                Button7.ScaleTo(1, 200),
                Button8.ScaleTo(1, 200),
                Button9.ScaleTo(1, 200),
                Button0.ScaleTo(1, 200),
                ButtonX.ScaleTo(1, 200)
            };
            await Task.WhenAll(tasks);
        }
コード例 #2
0
 private bool Handle9()
 {
     if (Solution == null || Position == Solution.Length)
     {
         return(false);
     }
     Button9.AddInteractionPunch(0.2f);
     Handle(9);
     return(false);
 }
コード例 #3
0
 public void ClickButton(int value)
 {
     foreach (var digit in value.ToString())
     {
         if (digit == '1')
         {
             Button1.Click();
         }
         if (digit == '2')
         {
             Button2.Click();
         }
         if (digit == '3')
         {
             Button3.Click();
         }
         if (digit == '4')
         {
             Button4.Click();
         }
         if (digit == '5')
         {
             Button5.Click();
         }
         if (digit == '6')
         {
             Button6.Click();
         }
         if (digit == '7')
         {
             Button7.Click();
         }
         if (digit == '8')
         {
             Button8.Click();
         }
         if (digit == '9')
         {
             Button9.Click();
         }
         if (digit == '0')
         {
             Button0.Click();
         }
     }
 }
コード例 #4
0
    void Awake()
    {
        thisLoggingID = loggingID++;

        Buttons = new KMSelectable[] { Button0, Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9 };

        transform.Find("Background").GetComponent <MeshRenderer>().material.color = new Color(1, 0.1f, 0.1f);

        MeshRenderer mr = transform.Find("Wiring").GetComponent <MeshRenderer>();

        mr.materials[0].color = new Color(0.1f, 0.1f, 0.1f);
        mr.materials[1].color = new Color(0.3f, 0.3f, 0.3f);
        mr.materials[2].color = new Color(0.1f, 0.4f, 0.8f);

        transform.Find("Main Display").Find("Edge").GetComponent <MeshRenderer>().material.color  = new Color(0, 0, 0);
        transform.Find("Stage Display").Find("Edge").GetComponent <MeshRenderer>().material.color = new Color(0, 0, 0);

        Button0.OnInteract += Handle0;
        Button1.OnInteract += Handle1;
        Button2.OnInteract += Handle2;
        Button3.OnInteract += Handle3;
        Button4.OnInteract += Handle4;
        Button5.OnInteract += Handle5;
        Button6.OnInteract += Handle6;
        Button7.OnInteract += Handle7;
        Button8.OnInteract += Handle8;
        Button9.OnInteract += Handle9;

        Color c = new Color(.71f, .70f, .68f); //new Color(0.91f, 0.88f, 0.86f);

        Button0.GetComponent <MeshRenderer>().material.color = c;
        Button1.GetComponent <MeshRenderer>().material.color = c;
        Button2.GetComponent <MeshRenderer>().material.color = c;
        Button3.GetComponent <MeshRenderer>().material.color = c;
        Button4.GetComponent <MeshRenderer>().material.color = c;
        Button5.GetComponent <MeshRenderer>().material.color = c;
        Button6.GetComponent <MeshRenderer>().material.color = c;
        Button7.GetComponent <MeshRenderer>().material.color = c;
        Button8.GetComponent <MeshRenderer>().material.color = c;
        Button9.GetComponent <MeshRenderer>().material.color = c;

        GetComponent <KMBombModule>().OnActivate += ActivateModule;
    }
コード例 #5
0
        public ConverterDigits()
        {
            TBLayout.SuspendLayout();
            Controls.Add(TBLayout);
            Controls.Add(TextArea);
            Controls.Add(TextLine);
            Name = "ConverterDigits";

            Button7.AddColor1(); Button7.Click += new EventHandler(InsertText);
            Button8.AddColor1(); Button8.Click += new EventHandler(InsertText);
            Button9.AddColor1(); Button9.Click += new EventHandler(InsertText);
            ButtonBackspace.AddColor1(); ButtonBackspace.Click += new EventHandler(Backspace);
            ButtonC.AddColor1(); ButtonC.Click           += new EventHandler(InsertText);
            ButtonD.AddColor1(); ButtonD.Click           += new EventHandler(InsertText);
            ButtonDelete.AddColor1(); ButtonDelete.Click += new EventHandler(Delete);
            ButtonEnter.AddColor1(); ButtonEnter.Click   += new EventHandler(GetAnswer);
            ButtonI.AddColor1(); ButtonI.Click           += new EventHandler(InsertText);
            ButtonL.AddColor1(); ButtonL.Click           += new EventHandler(InsertText);
            ButtonM.AddColor1(); ButtonM.Click           += new EventHandler(InsertText);
            ButtonV.AddColor1(); ButtonV.Click           += new EventHandler(InsertText);
            ButtonX.AddColor1(); ButtonX.Click           += new EventHandler(InsertText);
            Button0.AddColor1(); Button0.Click           += new EventHandler(InsertText);
            Button1.AddColor1(); Button1.Click           += new EventHandler(InsertText);
            Button2.AddColor1(); Button2.Click           += new EventHandler(InsertText);
            Button3.AddColor1(); Button3.Click           += new EventHandler(InsertText);
            Button4.AddColor1(); Button4.Click           += new EventHandler(InsertText);
            Button5.AddColor1(); Button5.Click           += new EventHandler(InsertText);
            Button6.AddColor1(); Button6.Click           += new EventHandler(InsertText);
            TextArea.AddColor1();
            TextLine.AddColor1();

            TBLayout.Controls.AddRange(new Control[] {
                Button7, Button8, Button9, ButtonD, ButtonEnter,
                Button4, Button5, Button6, ButtonC, ButtonBackspace,
                Button1, Button2, Button3, ButtonL, ButtonDelete,
                Button0, ButtonI, ButtonV, ButtonX, ButtonM
            });
            ResumeLayout(false);
            PerformLayout();
            TBLayout.ResumeLayout(false);
        }
コード例 #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Button0.SetCommand(_viewModel.Button0Action);
            Button1.SetCommand(_viewModel.Button1Action);
            Button2.SetCommand(_viewModel.Button2Action);
            Button3.SetCommand(_viewModel.Button3Action);
            Button4.SetCommand(_viewModel.Button4Action);
            Button5.SetCommand(_viewModel.Button5Action);
            Button6.SetCommand(_viewModel.Button6Action);
            Button7.SetCommand(_viewModel.Button7Action);
            Button8.SetCommand(_viewModel.Button8Action);
            Button9.SetCommand(_viewModel.Button9Action);
            LeftButton.SetCommand(_viewModel.LeftButtonAction);
            CommaButton.SetCommand(_viewModel.CommaButtonAction);
            RightButton.SetCommand(_viewModel.RightButtonAction);
            AddRecordButton.SetCommand(_viewModel.AddRecordAction);
            DeleteButton.SetCommand(_viewModel.DeleteButtonAction);
            IncomeButton.SetCommand(_viewModel.IncomeButtonAction);
            ExpensesButton.SetCommand(_viewModel.ExpensesButtonAction);
            TransferButton.SetCommand(_viewModel.TransferButtonAction);

            _bindings.Add(this.SetBinding(() => _viewModel.SignText, () => SignLabel.Text));
            _bindings.Add(this.SetBinding(() => _viewModel.LeftButtonText, () => LeftButtonText));
            _bindings.Add(this.SetBinding(() => _viewModel.RightButtonText, () => RightButtonText));
            _bindings.Add(this.SetBinding(() => _viewModel.AmountLabelText, () => AmountLabel.Text));
            _bindings.Add(this.SetBinding(() => _viewModel.IncomeButtonColor, () => IncomeButton.BackgroundColor).ConvertSourceToTarget(x => x.ToNative()));
            _bindings.Add(this.SetBinding(() => _viewModel.TransButtonColor, () => TransferButton.BackgroundColor).ConvertSourceToTarget(x => x.ToNative()));
            _bindings.Add(this.SetBinding(() => _viewModel.ExpensesButtonColor, () => ExpensesButton.BackgroundColor).ConvertSourceToTarget(x => x.ToNative()));

            HolderView.ApplyStyle(_viewModel.MainStyling);
            TemplatesButton.ApplyStyle(_viewModel.MainStyling);
            RightButton.ApplyStyle(_viewModel.MainStyling);
            LeftButton.ApplyStyle(_viewModel.MainStyling);
            MiddleImageView.ApplyStyle(_viewModel.MainStyling);
        }
コード例 #7
0
        void ReleaseDesignerOutlets()
        {
            if (Button0 != null)
            {
                Button0.Dispose();
                Button0 = null;
            }

            if (Button1 != null)
            {
                Button1.Dispose();
                Button1 = null;
            }

            if (Button2 != null)
            {
                Button2.Dispose();
                Button2 = null;
            }

            if (Button3 != null)
            {
                Button3.Dispose();
                Button3 = null;
            }

            if (Button4 != null)
            {
                Button4.Dispose();
                Button4 = null;
            }

            if (Button5 != null)
            {
                Button5.Dispose();
                Button5 = null;
            }

            if (Button6 != null)
            {
                Button6.Dispose();
                Button6 = null;
            }

            if (Button7 != null)
            {
                Button7.Dispose();
                Button7 = null;
            }

            if (Button8 != null)
            {
                Button8.Dispose();
                Button8 = null;
            }

            if (Button9 != null)
            {
                Button9.Dispose();
                Button9 = null;
            }

            if (ButtonAsterisc != null)
            {
                ButtonAsterisc.Dispose();
                ButtonAsterisc = null;
            }

            if (ButtonSharp != null)
            {
                ButtonSharp.Dispose();
                ButtonSharp = null;
            }

            if (CallButton != null)
            {
                CallButton.Dispose();
                CallButton = null;
            }

            if (Display != null)
            {
                Display.Dispose();
                Display = null;
            }

            if (PhoneNumberText != null)
            {
                PhoneNumberText.Dispose();
                PhoneNumberText = null;
            }

            if (TranslateButton != null)
            {
                TranslateButton.Dispose();
                TranslateButton = null;
            }
        }
コード例 #8
0
    void Awake()
    {
        if (ignoredModules == null)
        {
            ignoredModules = GetComponent <KMBossModule>().GetIgnoredModules("Forget Me Not", new string[] {
                "14",
                "42",
                "501",
                "A>N<D",
                "Bamboozling Time Keeper",
                "Black Arrows",
                "Brainf---",
                "Busy Beaver",
                "Don't Touch Anything",
                "Floor Lights",
                "Forget Any Color",
                "Forget Enigma",
                "Forget Everything",
                "Forget Infinity",
                "Forget It Not",
                "Forget Maze Not",
                "Forget Me Later",
                "Forget Me Not",
                "Forget Perspective",
                "Forget The Colors",
                "Forget Them All",
                "Forget This",
                "Forget Us Not",
                "Iconic",
                "Keypad Directionality",
                "Kugelblitz",
                "Multitask",
                "OmegaDestroyer",
                "OmegaForest",
                "Organization",
                "Password Destroyer",
                "Purgatory",
                "RPS Judging",
                "Security Council",
                "Shoddy Chess",
                "Simon Forgets",
                "Simon's Stages",
                "Souvenir",
                "Tallordered Keys",
                "The Time Keeper",
                "Timing is Everything",
                "The Troll",
                "Turn The Key",
                "The Twin",
                "Übermodule",
                "Ultimate Custom Night",
                "The Very Annoying Button",
                "Whiteout"
            });
        }

        thisLoggingID = loggingID++;

        Buttons = new KMSelectable[] { Button0, Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9 };

        transform.Find("Background").GetComponent <MeshRenderer>().material.color = new Color(1, 0.1f, 0.1f);

        MeshRenderer mr = transform.Find("Wiring").GetComponent <MeshRenderer>();

        mr.materials[0].color = new Color(0.1f, 0.1f, 0.1f);
        mr.materials[1].color = new Color(0.3f, 0.3f, 0.3f);
        mr.materials[2].color = new Color(0.1f, 0.4f, 0.8f);

        transform.Find("Main Display").Find("Edge").GetComponent <MeshRenderer>().material.color  = new Color(0, 0, 0);
        transform.Find("Stage Display").Find("Edge").GetComponent <MeshRenderer>().material.color = new Color(0, 0, 0);

        Button0.OnInteract += Handle0;
        Button1.OnInteract += Handle1;
        Button2.OnInteract += Handle2;
        Button3.OnInteract += Handle3;
        Button4.OnInteract += Handle4;
        Button5.OnInteract += Handle5;
        Button6.OnInteract += Handle6;
        Button7.OnInteract += Handle7;
        Button8.OnInteract += Handle8;
        Button9.OnInteract += Handle9;

        Color c = new Color(.71f, .70f, .68f); //new Color(0.91f, 0.88f, 0.86f);

        Button0.GetComponent <MeshRenderer>().material.color = c;
        Button1.GetComponent <MeshRenderer>().material.color = c;
        Button2.GetComponent <MeshRenderer>().material.color = c;
        Button3.GetComponent <MeshRenderer>().material.color = c;
        Button4.GetComponent <MeshRenderer>().material.color = c;
        Button5.GetComponent <MeshRenderer>().material.color = c;
        Button6.GetComponent <MeshRenderer>().material.color = c;
        Button7.GetComponent <MeshRenderer>().material.color = c;
        Button8.GetComponent <MeshRenderer>().material.color = c;
        Button9.GetComponent <MeshRenderer>().material.color = c;

        GetComponent <KMBombModule>().OnActivate += ActivateModule;
    }
コード例 #9
0
        void ReleaseDesignerOutlets()
        {
            if (Button1 != null)
            {
                Button1.Dispose();
                Button1 = null;
            }

            if (Button2 != null)
            {
                Button2.Dispose();
                Button2 = null;
            }

            if (Button3 != null)
            {
                Button3.Dispose();
                Button3 = null;
            }

            if (Button4 != null)
            {
                Button4.Dispose();
                Button4 = null;
            }

            if (Button5 != null)
            {
                Button5.Dispose();
                Button5 = null;
            }

            if (Button6 != null)
            {
                Button6.Dispose();
                Button6 = null;
            }

            if (Button7 != null)
            {
                Button7.Dispose();
                Button7 = null;
            }

            if (Button8 != null)
            {
                Button8.Dispose();
                Button8 = null;
            }

            if (Button9 != null)
            {
                Button9.Dispose();
                Button9 = null;
            }

            if (ResetButton != null)
            {
                ResetButton.Dispose();
                ResetButton = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }
        }
コード例 #10
0
ファイル: MainWindow.xaml.cs プロジェクト: Dpvh/BeatPad
        private void playBackPress(string key)
        {
            switch (key)
            {
            case "Q":
                Button1.PerformClick();
                break;

            case "W":
                Button2.PerformClick();
                break;

            case "E":
                Button3.PerformClick();
                break;

            case "R":
                Button4.PerformClick();
                break;

            case "A":
                Button5.PerformClick();
                break;

            case "S":
                Button6.PerformClick();
                break;

            case "D":
                Button7.PerformClick();
                break;

            case "F":
                Button8.PerformClick();
                break;

            case "Y":
                Button9.PerformClick();
                break;

            case "U":
                Button10.PerformClick();
                break;

            case "I":
                Button11.PerformClick();
                break;

            case "O":
                Button12.PerformClick();
                break;

            case "H":
                Button13.PerformClick();
                break;

            case "J":
                Button14.PerformClick();
                break;

            case "K":
                Button15.PerformClick();
                break;

            case "L":
                Button16.PerformClick();
                break;
            }
        }
コード例 #11
0
ファイル: MainWindow.xaml.cs プロジェクト: Dpvh/BeatPad
        //stimulates button presses when key is hit *really wanted the buttons to visually depress but this didnt do it
        private void click_handle(object sender, System.Windows.Input.KeyEventArgs e)
        {
            Console.WriteLine("Argument is: " + e.Key.ToString());
            switch (e.Key)
            {
            case Key.Q:
                e.Handled = true;
                Button1.PerformClick();
                break;

            case Key.W:
                e.Handled = true;
                Button2.PerformClick();
                break;

            case Key.E:
                e.Handled = true;
                Button3.PerformClick();
                break;

            case Key.R:
                e.Handled = true;
                Button4.PerformClick();
                break;

            case Key.A:
                e.Handled = true;
                Button5.PerformClick();
                break;

            case Key.S:
                e.Handled = true;
                Button6.PerformClick();
                break;

            case Key.D:
                e.Handled = true;
                Button7.PerformClick();
                break;

            case Key.F:
                e.Handled = true;
                Button8.PerformClick();
                break;

            case Key.Y:
                e.Handled = true;
                Button9.PerformClick();
                break;

            case Key.U:
                e.Handled = true;
                Button10.PerformClick();
                break;

            case Key.I:
                e.Handled = true;
                Button11.PerformClick();
                break;

            case Key.O:
                e.Handled = true;
                Button12.PerformClick();
                break;

            case Key.H:
                e.Handled = true;
                Button13.PerformClick();
                break;

            case Key.J:
                e.Handled = true;
                Button14.PerformClick();
                break;

            case Key.K:
                e.Handled = true;
                Button15.PerformClick();
                break;

            case Key.L:
                e.Handled = true;
                Button16.PerformClick();
                break;

            case Key.LeftShift:
                e.Handled = true;
                if (isShift == 0)
                {
                    Loop();
                }
                else
                {
                    storeLoop();
                }
                break;
            }
        }
コード例 #12
0
        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ć");
            }
        }
コード例 #13
0
 void ReleaseDesignerOutlets()
 {
     if (Button0 != null)
     {
         Button0.Dispose();
         Button0 = null;
     }
     if (Button1 != null)
     {
         Button1.Dispose();
         Button1 = null;
     }
     if (Button10 != null)
     {
         Button10.Dispose();
         Button10 = null;
     }
     if (Button11 != null)
     {
         Button11.Dispose();
         Button11 = null;
     }
     if (Button2 != null)
     {
         Button2.Dispose();
         Button2 = null;
     }
     if (Button3 != null)
     {
         Button3.Dispose();
         Button3 = null;
     }
     if (Button4 != null)
     {
         Button4.Dispose();
         Button4 = null;
     }
     if (Button5 != null)
     {
         Button5.Dispose();
         Button5 = null;
     }
     if (Button6 != null)
     {
         Button6.Dispose();
         Button6 = null;
     }
     if (Button7 != null)
     {
         Button7.Dispose();
         Button7 = null;
     }
     if (Button8 != null)
     {
         Button8.Dispose();
         Button8 = null;
     }
     if (Button9 != null)
     {
         Button9.Dispose();
         Button9 = null;
     }
     if (ResultLabel != null)
     {
         ResultLabel.Dispose();
         ResultLabel = null;
     }
 }