示例#1
0
 private void PasswordBox2_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         var newUser = new User();
         if (!String.IsNullOrEmpty(NameBox.Text) && !String.IsNullOrEmpty(PasswordBox1.Password) &&
             PasswordBox1.Password == PasswordBox2.Password)
         {
             if (!_repo.FindUser(NameBox.Text, PasswordBox1.Password, out newUser))
             {
                 newUser          = new User();
                 newUser.Name     = NameBox.Text;
                 newUser.Password = PasswordBox1.Password;
                 _repo.AddUser(newUser);
                 var packpage = new PackPage(newUser);
                 NavigationService.Navigate(packpage);
             }
             else
             {
                 MessageBlock.Text = "Юзер с такими данным уже существует";
             }
         }
         else
         {
             MessageBlock.Text = "Введены некорректные данные";
         }
     }
 }
        public QuestionPage(Package pack, PackPage packpage)
        {
            InitializeComponent();
            package = pack;
            PackNameLabel.Content = pack.Name;
            List <Question> shortQuestions = new List <Question>();

            for (int i = 0; i < pack.Questions.Count; i++)
            {
                if (pack.Questions[i].FieldQuestion.Length <= 70)
                {
                    shortQuestions.Add(pack.Questions[i]);
                }
                else
                {
                    shortQuestions.Add(
                        new Question()
                    {
                        FieldQuestion = pack.Questions[i].FieldQuestion.Substring(0, 70) + "...\r\n",
                    });
                }
            }
            QuestList.ItemsSource       = shortQuestions;
            QuestList.DisplayMemberPath = "FieldQuestion";

            Ppage = packpage;
        }
示例#3
0
 public GamePage(Package pack, int num, Session session, PackPage packpage)
 {
     InitializeComponent();
     Ppage = packpage;
     _pack = pack;
     _pack.CurrentQuestion = pack.Questions[num - 1];
     _questionNum          = num;
     QuestionBlock.Text    = _pack.CurrentQuestion.FieldQuestion;
     _session = session;
     if (_pack.CurrentQuestion.PicturePath != "")
     {
         var path = "Images/" + pack.CurrentQuestion.PicturePath;
         QuestionImage.Source   = BitmapFrame.Create(new Uri(@"pack://application:,,,/Images/" + _pack.CurrentQuestion.PicturePath));
         ImageButton.Visibility = Visibility.Visible;
     }
 }
        private void PackButton_Click(object sender, RoutedEventArgs e)
        {
            var packpage = new PackPage(_session.User);

            NavigationService.Navigate(packpage);
        }