コード例 #1
0
ファイル: MainWindowVM.cs プロジェクト: PiotrO9/Projekty
        public void RandomImageGenerateImpl()
        {
            Random rn           = new Random();
            int    randomNumber = rn.Next(1, 3);

            ImagePathOfFirstPicture = SetCorrectPath.SetCorrectPathFunc(randomNumber);

            ImagePathOfSecondPicture = SetCorrectPath.SetCorrectPathFunc(randomNumber);
        }
コード例 #2
0
ファイル: MainWindowVM.cs プロジェクト: PiotrO9/Projekty
        public MainWindowVM(int n1, int n2)
        {
            ImagePathOfFirstPicture  = SetCorrectPath.SetCorrectPathFunc(n1);
            ImagePathOfSecondPicture = SetCorrectPath.SetCorrectPathFunc(n2);

            ButtonClickCommand = new RelayCommand(ButtonNumberClickCommandImpl);

            RandomImageGenerate = new RelayCommand(RandomImageGenerateImpl);
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: PiotrO9/Projekty
        private void Firstimg_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (_vm.DisplayText == "Pick")
            {
                if (_vm.ImageNumber == 3)
                {
                    _vm.ImageNumber = 1;
                }
                else
                {
                    _vm.ImageNumber++;
                }

                _vm.ImagePathOfFirstPicture = SetCorrectPath.SetCorrectPathFunc(_vm.ImageNumber);
            }
        }
コード例 #4
0
ファイル: MainWindowVM.cs プロジェクト: PiotrO9/Projekty
        public void ButtonNumberClickCommandImpl()
        {
            if (DisplayText != "Pick")
            {
                DisplayText = "Pick";

                switch (ImagePathOfSecondPicture)
                {
                case "images/paper.PNG":
                {
                    ImagePathOfSecondPicture = "images/Cpaper.PNG";
                    break;
                }

                case "images/Rock.PNG":
                {
                    ImagePathOfSecondPicture = "images/Crock.PNG";
                    break;
                }

                case "images/Scissors.PNG":
                {
                    ImagePathOfSecondPicture = "images/Cscissors.PNG";
                    break;
                }

                default:
                    break;
                }
            }
            else
            {
                var rand = new Random();

                int randomresult = rand.Next(1, 4);

                ImagePathOfSecondPicture = SetCorrectPath.SetCorrectPathFunc(randomresult);

                DisplayText = "Play again";

                if (ImagePathOfFirstPicture == ImagePathOfSecondPicture)
                {
                    var temp = int.Parse(FirstLabelText);
                    temp++;
                    FirstLabelText = temp.ToString();

                    temp = int.Parse(SecondLabelText);
                    temp++;
                    SecondLabelText = temp.ToString();
                }
                else if (ImagePathOfFirstPicture == "images/Rock.PNG" && ImagePathOfSecondPicture == "images/paper.PNG")
                {
                    var temp = int.Parse(SecondLabelText);
                    temp++;
                    SecondLabelText = temp.ToString();
                }
                else if (ImagePathOfFirstPicture == "images/Rock.PNG" && ImagePathOfSecondPicture == "images/Scissors.PNG")
                {
                    var temp = int.Parse(FirstLabelText);
                    temp++;
                    FirstLabelText = temp.ToString();
                }
                else if (ImagePathOfFirstPicture == "images/paper.PNG" && ImagePathOfSecondPicture == "images/Scissors.PNG")
                {
                    var temp = int.Parse(SecondLabelText);
                    temp++;
                    SecondLabelText = temp.ToString();
                }
                else if (ImagePathOfFirstPicture == "images/paper.PNG" && ImagePathOfSecondPicture == "images/Rock.PNG")
                {
                    var temp = int.Parse(FirstLabelText);
                    temp++;
                    FirstLabelText = temp.ToString();
                }
                else if (ImagePathOfFirstPicture == "images/Scissors.PNG" && ImagePathOfSecondPicture == "images/paper.PNG")
                {
                    var temp = int.Parse(FirstLabelText);
                    temp++;
                    FirstLabelText = temp.ToString();
                }
                else if (ImagePathOfFirstPicture == "images/Scissors.PNG" && ImagePathOfSecondPicture == "images/Rock.PNG")
                {
                    var temp = int.Parse(SecondLabelText);
                    temp++;
                    SecondLabelText = temp.ToString();
                }
            }
        }