Beispiel #1
0
    }//连接封装

    static public submitInfo checkSubmitState(string RunId, hduUser user)
    {
        String     url        = "http://acm.hdu.edu.cn/status.php?first=+" + RunId + "+&user="******"table_text")[0].Children[0].Children[2];
        submitInfo Item       = new submitInfo();

        Item.runId     = RunId;
        Item.ProblemId = submitItem.Children[3].FirstChild.Text();
        Item.Time      = submitItem.Children[4].Text();
        Item.Memory    = submitItem.Children[5].Text();
        Item.State     = submitItem.Children[2].FirstChild.Text();
        return(Item);
    }//检查提交状态
Beispiel #2
0
 XmlNodeList ProblemNodeList;                   //题目列表
 public MainWindow()                            //主窗体初始化
 {
     problemHistoryArray = new List <string>();
     user = hduUser.readUserJson();                            //导入用户文件,因为第一屏需要用户信息,所以在前端初始化之前
     InitializeComponent();                                    //前端初始化
     loadProblemXml();                                         //导入XML文件
     ProblemHistorySelector.ItemsSource = problemHistoryArray; //数据源设定
     tab.SelectionChanged  += Tab_SelectionChangedAsync;       //绑定Tab切换事件
     submitQueryQueue       = new Queue <string>();
     queueSubmitStateThread = new Thread(new ThreadStart(() =>
     {
         while (true)
         {
             lock (submitQueryQueue)
             {
                 if (submitQueryQueue.Count == 0)
                 {
                     break;
                 }
                 Console.WriteLine(submitQueryQueue.Count);
                 String nowId    = submitQueryQueue.Dequeue();
                 submitInfo Item = hduHttpHelper.checkSubmitState(nowId, user);
                 if (Item.State != "Queuing" && Item.State != "Compiling" && Item.State != "Running")
                 {
                     if (Item.State == "Accepted")
                     {
                         this.Invoke(new Action(() =>
                         {
                             judgeStateToast toast = new judgeStateToast();
                             toast.Accepted(Item.ProblemId + '\t' + Item.Time + '\t' + Item.Memory);
                         }));
                     }
                     else if (Item.State == "Presentation Error")
                     {
                         this.Invoke(new Action(() =>
                         {
                             judgeStateToast toast = new judgeStateToast();
                             toast.Warning(Item.ProblemId + '\t' + Item.Time + '\t' + Item.Memory);
                         }));
                     }
                     else
                     {
                         this.Invoke(new Action(() =>
                         {
                             judgeStateToast toast = new judgeStateToast();
                             toast.Error(Item.ProblemId + '\t' + Item.Time + '\t' + Item.Memory);
                         }));
                     }
                     Console.WriteLine(Item.State);
                 }
                 else
                 {
                     submitQueryQueue.Enqueue(nowId);
                 }
             }
             Thread.Sleep(500);
         }
     }))//申明线程及其运行时匿名函数
     {
         IsBackground = true
     };
 }