Beispiel #1
0
        public void SetContent(JudgeInfo jInfo)
        {
            Title = $"评测详情 - #{jInfo.JudgeId}";
            ResultSummary.Content = jInfo.ResultSummary;
            if (jInfo.ResultSummary == "Accepted")
            {
                ResultSummary.Foreground = Brushes.Green;
            }
            else if (!(jInfo.ResultSummary == "Judging..."))
            {
                if (jInfo.ResultSummary.Contains("Exceeded"))
                {
                    ResultSummary.Foreground = Brushes.DarkOrange;
                }
                else
                {
                    ResultSummary.Foreground = Brushes.Red;
                }
            }
            JudgeInfoSummary.Content =
                $"#{jInfo.JudgeId},评测时间:{jInfo.JudgeDate},题目:{jInfo.ProblemName},得分:{jInfo.FullScore}";
            CodeBox.Text = "代码:\n" + jInfo.Code;
            var details = new ObservableCollection <JudgeInfoDetails>();

            JudgeDetailsTree.ItemsSource = details;
            if (jInfo.Result != null)
            {
                for (var i = 0; i < jInfo.Result.Length; i++)
                {
                    var tmp = new JudgeInfoDetails {
                        Title = $"#{i + 1}:{jInfo.Result[i]},{jInfo.Score[i]}"
                    };
                    tmp.Children = new ObservableCollection <JudgeInfoDetails>
                    {
                        new JudgeInfoDetails {
                            Title = $"时间:{jInfo.Timeused[i]}ms"
                        },
                        new JudgeInfoDetails {
                            Title = $"内存:{jInfo.Memoryused[i]}kb"
                        },
                        new JudgeInfoDetails {
                            Title = $"退出代码:{jInfo.Exitcode[i]}"
                        }
                    };
                    details.Add(tmp);
                }
            }

            DetailsBox.Text = "其他信息:\n" + jInfo.AdditionInfo;
        }
Beispiel #2
0
        private bool Filter(JudgeInfo p)
        {
            var    now = GetNowDateTime();
            string pf = null, uf = null;
            var    tf = -1;

            Dispatcher.Invoke(() =>
            {
                pf = ProblemFilter.SelectedItem as string;
                uf = UserFilter.SelectedItem as string;
                tf = TimeFilter.SelectedIndex;
            });
            if (pf != null)
            {
                if (p.ProblemName != pf)
                {
                    return(false);
                }
            }
            if (uf != null)
            {
                if (p.UserName != uf)
                {
                    return(false);
                }
            }
            if (tf != -1)
            {
                var ti = Convert.ToDateTime(p.JudgeDate);
                switch (tf)
                {
                case 0:
                {
                    if (ti.Year != now.Year || ti.Month != now.Month || ti.Day != now.Day)
                    {
                        return(false);
                    }
                    break;
                }

                case 1:
                {
                    if ((now - ti).TotalDays > 3)
                    {
                        return(false);
                    }
                    break;
                }

                case 2:
                {
                    if ((now - ti).TotalDays > 7)
                    {
                        return(false);
                    }
                    break;
                }

                case 3:
                {
                    if ((now - ti).TotalDays > 30)
                    {
                        return(false);
                    }
                    break;
                }

                case 4:
                {
                    if ((now - ti).TotalDays > 91)
                    {
                        return(false);
                    }
                    break;
                }

                case 5:
                {
                    if ((now - ti).TotalDays > 182)
                    {
                        return(false);
                    }
                    break;
                }

                case 6:
                {
                    if ((now - ti).TotalDays > 365)
                    {
                        return(false);
                    }
                    break;
                }
                }
            }
            return(true);
        }
Beispiel #3
0
        private bool Filter(JudgeInfo p)
        {
            var now = DateTime.Now;
            var tf  = TimeFilter.SelectedIndex;

            if (ProblemFilter.SelectedItem is string pf)
            {
                if (p.ProblemName != pf)
                {
                    return(false);
                }
            }
            if (UserFilter.SelectedItem is string uf)
            {
                if (p.UserName != uf)
                {
                    return(false);
                }
            }
            if (tf != -1)
            {
                var ti = Convert.ToDateTime(p.JudgeDate);
                switch (tf)
                {
                case 0:
                {
                    if (ti.Year != now.Year || ti.Month != now.Month || ti.Day != now.Day)
                    {
                        return(false);
                    }
                    break;
                }

                case 1:
                {
                    if ((now - ti).TotalDays > 3)
                    {
                        return(false);
                    }
                    break;
                }

                case 2:
                {
                    if ((now - ti).TotalDays > 7)
                    {
                        return(false);
                    }
                    break;
                }

                case 3:
                {
                    if ((now - ti).TotalDays > 30)
                    {
                        return(false);
                    }
                    break;
                }

                case 4:
                {
                    if ((now - ti).TotalDays > 91)
                    {
                        return(false);
                    }
                    break;
                }

                case 5:
                {
                    if ((now - ti).TotalDays > 182)
                    {
                        return(false);
                    }
                    break;
                }

                case 6:
                {
                    if ((now - ti).TotalDays > 365)
                    {
                        return(false);
                    }
                    break;
                }
                }
            }
            return(true);
        }