public void RandomImageGenerateImpl() { Random rn = new Random(); int randomNumber = rn.Next(1, 3); ImagePathOfFirstPicture = SetCorrectPath.SetCorrectPathFunc(randomNumber); ImagePathOfSecondPicture = SetCorrectPath.SetCorrectPathFunc(randomNumber); }
public MainWindowVM(int n1, int n2) { ImagePathOfFirstPicture = SetCorrectPath.SetCorrectPathFunc(n1); ImagePathOfSecondPicture = SetCorrectPath.SetCorrectPathFunc(n2); ButtonClickCommand = new RelayCommand(ButtonNumberClickCommandImpl); RandomImageGenerate = new RelayCommand(RandomImageGenerateImpl); }
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); } }
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(); } } }