コード例 #1
0
        private async void initScore()
        {
            //await Utils.ShowSystemTrayAsync(Color.FromArgb(255, 2, 140, 253), Colors.White, text: "正在紧张批改试卷...", isIndeterminate: true);
            List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >();

            paramList.Add(new KeyValuePair <string, string>("stuNum", appSetting.Values["stuNum"].ToString()));
            paramList.Add(new KeyValuePair <string, string>("idNum", appSetting.Values["idNum"].ToString()));
            string score = await NetWork.getHttpWebRequest("api/examGrade", paramList);

            Debug.WriteLine("score->" + score);
#if DEBUG
            score = "{\"status\":200,\"term\":\"20151\",\"info\":\"success\",\"data\":[{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"},{\"student\":\"2013211594\",\"course\":\"英语口笔译基础\",\"grade\":\"99\",\"property\":\"必修\",\"status\":\"1\",\"term\":\"2\"}],\"version\":\"0.1.0\",\"stuNum\":\"2013211594\",\"idNum\":\"160155\"}";
#endif
            if (score != "")
            {
                JObject obj = JObject.Parse(score);
                if (Int32.Parse(obj["status"].ToString()) == 200)
                {
                    List <ScoreList> scoreList      = new List <ScoreList>();
                    JArray           ScoreListArray = Utils.ReadJso(score);
                    for (int i = 0; i < ScoreListArray.Count; i++)
                    {
                        ScoreList classitem = new ScoreList();
                        classitem.GetAttribute((JObject)ScoreListArray[i]);
                        scoreList.Add(classitem);
                    }
                    ScoreListView.ItemsSource = scoreList;
                }
                else if (Int32.Parse(obj["status"].ToString()) == 300)
                {
                    ListFailedStackPanelTextBlock.Text = "暂无数据,过几再来看看";

                    ListFailedStackPanel.Visibility          = Visibility.Visible;
                    ListFailedStackPanelImage.Visibility     = Visibility.Collapsed;
                    ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
                }
                else
                {
                    ListFailedStackPanelTextBlock.Text = "加载失败,点击重试";

                    ListFailedStackPanel.Visibility          = Visibility.Visible;
                    ListFailedStackPanelImage.Visibility     = Visibility.Visible;
                    ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
                }
            }
            else
            {
                ListFailedStackPanelTextBlock.Text = "加载失败,点击重试";

                ListFailedStackPanel.Visibility          = Visibility.Visible;
                ListFailedStackPanelImage.Visibility     = Visibility.Visible;
                ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
            }

            //StatusBar statusBar = StatusBar.GetForCurrentView();
            //await statusBar.ProgressIndicator.HideAsync();
        }
コード例 #2
0
        private async void initScore()
        {
            await Utils.ShowSystemTrayAsync(Color.FromArgb(255, 2, 140, 253), Colors.White, text : "正在紧张批改试卷...", isIndeterminate : true);

            List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >();

            paramList.Add(new KeyValuePair <string, string>("stuNum", appSetting.Values["stuNum"].ToString()));
            paramList.Add(new KeyValuePair <string, string>("idNum", appSetting.Values["idNum"].ToString()));
            string score = await NetWork.getHttpWebRequest("api/examGrade", paramList);

            Debug.WriteLine("score->" + score);
            if (score != "")
            {
                JObject obj = JObject.Parse(score);
                if (Int32.Parse(obj["status"].ToString()) == 200)
                {
                    List <ScoreList> scoreList      = new List <ScoreList>();
                    JArray           ScoreListArray = Utils.ReadJso(score);
                    for (int i = 0; i < ScoreListArray.Count; i++)
                    {
                        ScoreList classitem = new ScoreList();
                        classitem.GetAttribute((JObject)ScoreListArray[i]);
                        scoreList.Add(classitem);
                    }
                    ScoreListView.ItemsSource = scoreList;
                }
                else if (Int32.Parse(obj["status"].ToString()) == 300)
                {
                    ListFailedStackPanelTextBlock.Text = "暂无数据,过几再来看看";

                    ListFailedStackPanel.Visibility          = Visibility.Visible;
                    ListFailedStackPanelImage.Visibility     = Visibility.Collapsed;
                    ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
                }
                else
                {
                    ListFailedStackPanelTextBlock.Text = "加载失败,点击重试";

                    ListFailedStackPanel.Visibility          = Visibility.Visible;
                    ListFailedStackPanelImage.Visibility     = Visibility.Visible;
                    ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
                }
            }
            else
            {
                ListFailedStackPanelTextBlock.Text = "加载失败,点击重试";

                ListFailedStackPanel.Visibility          = Visibility.Visible;
                ListFailedStackPanelImage.Visibility     = Visibility.Visible;
                ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
            }

            StatusBar statusBar = StatusBar.GetForCurrentView();
            await statusBar.ProgressIndicator.HideAsync();
        }