예제 #1
0
        private void SprawdzOdpowiedz(object sender)
        {
            Question q = new Question();
            string answer = (sender as Button).Content.ToString();
            var messagePrompt = new MessagePrompt();

            switch ((sender as Button).Name[7])
            {
                case '1' :
                    q = pytanieIMG; break;
                case '2' :
                    q = pytanieTrailer; break;
                case '3':
                    q = pytanieSong; break;
            }

            if(answer.Equals(q.Answer))
            {
                if (MainPage.CanMusic)
                    _correctSound.Play();
                SetScore();
                messagePrompt.Title = "Correct Answer";
            }
            else
            {
                if (MainPage.CanMusic)
                    _wrongSound.Play();

                messagePrompt.Title = "Wrong Answer";
                messagePrompt.Message = "The correct answer is: " + q.Answer;

            }
            messagePrompt.OnCompleted(new PopUpEventArgs<string, PopUpResult>
            {
                Result = messagePrompt.Value,
                PopUpResult = PopUpResult.Ok
            });

            BlokowanieOdpowiedzi(int.Parse((sender as Button).Name[7].ToString()));

            messagePrompt.Completed += MessagePromptCompleted;
            messagePrompt.Show();
        }
		private void MessageSuperClick(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Advanced Message",
				Background = _naturalBlueSolidColorBrush,
				Foreground = _aliceBlueSolidColorBrush,
				Overlay = _cornFlowerBlueSolidColorBrush,
			};

			var btnHide = new RoundButton { Content = "Hide" };
			btnHide.Click += (o, args) => messagePrompt.Hide();

			var btnComplete = new RoundButton { Content = "Complete" };
			btnComplete.Click += (o, args) => messagePrompt.OnCompleted(new PopUpEventArgs<string, PopUpResult> { PopUpResult = PopUpResult.Ok, Result = "You clicked the Complete Button" });

			messagePrompt.ActionPopUpButtons.Clear();
			messagePrompt.ActionPopUpButtons.Add(btnHide);
			messagePrompt.ActionPopUpButtons.Add(btnComplete);

			messagePrompt.Completed += PopUpPromptStringCompleted;

			messagePrompt.Show();
		}