コード例 #1
0
        public rslt()
        {
            InitializeComponent();
            string path = string.Format("{0}\\Images\\logo.png", AppDomain.CurrentDomain.BaseDirectory);

            image.Source = new BitmapImage(new Uri(path));
            result r = new result();
            string d;

            r.reader(out d);
            date.Content = d;
            string   name;
            username u = new username();

            u.reader(out name);
            success.Content = r.success;
            if (r.success < 50)
            {
                comment.Content    = "You must study hard, " + name;
                comment.Foreground = new SolidColorBrush(Colors.DarkRed);
            }
            else if (r.success >= 50 && r.success < 80)
            {
                comment.Content    = "Not bad, almost done, " + name;
                comment.Foreground = new SolidColorBrush(Colors.Orange);
            }
            else if (r.success > 80)
            {
                comment.Content    = "Well done, " + name;
                comment.Foreground = new SolidColorBrush(Colors.Green);
            }
            var list = new ObservableCollection <DataObject>();

            list.Add(new DataObject()
            {
                A = 0, B = "Question", C = "True", D = "Answer"
            });
            for (int i = 0; i < 10; i++)
            {
                list.Add(new DataObject()
                {
                    A = (i + 1), B = r.questions[i], C = r.trues[i], D = r.answers[i]
                });
            }
            comment.Visibility    = Visibility.Visible;
            this.data.ItemsSource = list;
        }