Beispiel #1
0
        private void UpdateInfo()
        {
            if (testSession.TestName != null)
            {
                TestNameText.Text = testSession.TestName;

                DefaultToolTip.SetToolTip(TestNameText, TestNameText.Text);
            }
            else
            {
                TestNameText.Text = "-";

                TestNameText.Enabled  = false;
                TestNameLabel.Enabled = false;
            }

            if (testSession.CreatorId.HasValue)
            {
                TeacherAccountLink.Click += (sender, args) => Process.Start(NaUrokClient.GetProfileUrl(testSession.CreatorId.Value));
            }
            else
            {
                TeacherAccountLink.Enabled = false;
                TeacherLabel.Enabled       = false;
            }

            if (testSession.TestStartDateTime.HasValue)
            {
                CreateDateTimeText.Text = testSession.TestStartDateTime.Value.ToString();
            }
            else
            {
                CreateDateTimeText.Text = "-";

                CreateDateTimeText.Enabled  = false;
                CreateDateTimeLabel.Enabled = false;
            }

            if (testSession.TestEndDateTime.HasValue)
            {
                EndDateTimeText.Text = testSession.TestEndDateTime.Value.ToString();
            }
            else
            {
                EndDateTimeText.Text = "-";

                EndDateTimeText.Enabled  = false;
                EndDateTimeLabel.Enabled = false;
            }

            StartDateTimeText.Text = testSession.StartDateTime.ToString();

            if (testSession.Duration.HasValue)
            {
                DurationText.Text = string.Empty;

                if (testSession.Duration.Value.Hours > 0)
                {
                    DurationText.Text += testSession.Duration.Value.Hours + "ч ";
                }

                DurationText.Text += testSession.Duration.Value.Minutes + "мин";
            }
            else
            {
                DurationText.Text = "-";

                DurationText.Enabled  = false;
                DurationLabel.Enabled = false;
            }

            QuestionsCountText.Text = testSession.TestQuestionsCount.ToString();
        }