コード例 #1
0
        public ClassInfoControl(List<ClassList> cl, List<Transaction> mmr, ExamList el)
        {
            this.InitializeComponent();
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                outGrid.Width = 350;
                outGrid.Margin = new Thickness(0, 0, 0, 0);
                contentAll.Padding = new Thickness(0);
            }
            this.SizeChanged += (s, e) =>
            {
                var state = "VisualState000";
                if (e.NewSize.Width <= 450)
                {
                    outGrid.Margin = new Thickness(0, 0, 0, 0);
                    contentAll.Padding = new Thickness(0);
                }
                if (e.NewSize.Width > 450)
                {
                    state = "VisualState800";

                }
                VisualStateManager.GoToState(this, state, true);
            };

            this.Width = Window.Current.Bounds.Width;
            this.Height = Window.Current.Bounds.Height;
            this.Loaded += MessagePopupWindow_Loaded;
            this.Unloaded += MessagePopupWindow_Unloaded;
            ExamList ei = Resources["ei"] as ExamList;
            if (el != null)
            {
                ei.Course = el.Course;
                ei.Week = $"第{el.Week}周";
                switch (el.Weekday[0])
                {
                    case '1':
                        ei.Week += " 星期一";
                        break;
                    case '2':
                        ei.Week += " 星期二";
                        break;
                    case '3':
                        ei.Week += " 星期三";
                        break;
                    case '4':
                        ei.Week += " 星期四";
                        break;
                    case '5':
                        ei.Week += " 星期五";
                        break;
                    case '6':
                        ei.Week += " 星期六";
                        break;
                    case '7':
                        ei.Week += " 星期日";
                        break;
                }
                ei.Begin_time = $"{el.Begin_time}-{el.End_time} {el.Classroom}教室";
            }
            else
            {
                ei.Course = "这节暂时没有考试哦~";
            }
            if (cl.Count != 0)
            {
                ClassList pl = Resources["pl"] as ClassList;
                ClassList pl2 = Resources["pl2"] as ClassList;
                pl.Course = cl[0].Course;
                pl.Teacher = cl[0].Teacher;
                pl.Classroom = cl[0].Classroom;
                pl.Day = $"{cl[0].Day} {cl[0].Lesson}";
                pl.Type = cl[0].Type;
                pl.RawWeek = cl[0].RawWeek;
                if (cl.Count != 1)
                {
                    istype1 = false;
                    type1.Visibility = Visibility.Collapsed;
                    type2.Visibility = Visibility.Visible;
                    pl2.Course = cl[1].Course;
                    pl2.Teacher = cl[1].Teacher;
                    pl2.Classroom = cl[1].Classroom;
                    pl2.Day = $"{cl[1].Day} {cl[1].Lesson}";
                    pl2.Type = cl[1].Type;
                    pl2.RawWeek = cl[1].RawWeek;
                }
            }
            else
            {
                //ClassList pl = Resources["pl"] as ClassList;
                //pl.Course = "这里有个图没切 先这样吧老大";
                classGrid.Visibility = Visibility.Collapsed;
                noclassGrid.Visibility = Visibility.Visible;
            }
            List<Transaction> mrl = new List<Transaction>();
            if (mmr.Count != 0)
            {
                foreach (var item in mmr)
                {
                    Transaction temp = new Transaction();
                    if (item.date.Count > 1)
                    {
                        for (int i = 0; i < item.date.Count; i++)
                        {
                            for (int j = 0; j < item.date[i].week.Length; j++)
                            {
                                if (temp.week == null)
                                    if (item.date[i].week.Length == 1)
                                        temp.week += item.date[i].week[j].ToString();
                                    else
                                        temp.week += item.date[i].week[j].ToString() + "、";
                                else if (j == item.date[i].week.Length - 1 && !temp.week.Contains(item.date[i].week[j].ToString()))
                                    temp.week += item.date[i].week[j].ToString();
                                else if (temp.week != null)
                                {
                                    if (!temp.week.Contains(item.date[i].week[j].ToString()))
                                        temp.week += item.date[i].week[j].ToString() + "、";
                                }
                            }
                        }
                    }
                    else if (item.date.Count == 1)
                    {
                        temp.title = mmr[0].title;
                        temp.content = mmr[0].content;
                        temp.week = $"{mmr[0].date[0].week[0].ToString()}";
                    }
                    temp.week += "周";
                    temp.title = item.title;
                    temp.content = item.content;
                    mrl.Add(temp);
                }
            }
            else 
            {
                //mrl.Add(new Transaction { title = "没做完 别看" });
                transactionGridson.Visibility = Visibility.Collapsed;
                notransactionGrid.Visibility = Visibility.Visible;
            }
            //else if (mmr.Count == 1)
            //{
            //    Transaction temp = new Transaction();
            //    temp.title = mmr[0].title;
            //    temp.content = mmr[0].content;
            //    temp.week = $"{mmr[0].date[0].week[0].ToString()}周";
            //    mrl.Add(temp);
            //}
            RemindListView.ItemsSource = mrl;
            m_Popup = new Popup();
            m_Popup.Child = this;
        }
コード例 #2
0
        private async void initExam()
        {
            string exam = "";
            List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>();
            var vault = new Windows.Security.Credentials.PasswordVault();
            var credentialList = vault.FindAllByResource(resourceName);
            credentialList[0].RetrievePassword();

            //await Utils.ShowSystemTrayAsync(Color.FromArgb(255, 2, 140, 253), Colors.White, text: "正在紧张安排考试...", isIndeterminate: true);
            //TODO:未登陆时 没有考试/补考信息
            if (IsExamOrRe == 2)
            {
                //paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString()));
                //paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString()));
                paramList.Add(new KeyValuePair<string, string>("stuNum", credentialList[0].UserName));
                paramList.Add(new KeyValuePair<string, string>("idNum", credentialList[0].Password));
                exam = await NetWork.getHttpWebRequest("api/examSchedule", paramList);
            }
            else if (IsExamOrRe == 3)
            {
#if DEBUG
                paramList.Add(new KeyValuePair<string, string>("stu", "2014214136"));
#else   
                //paramList.Add(new KeyValuePair<string, string>("stu", appSetting.Values["stuNum"].ToString()));
                paramList.Add(new KeyValuePair<string, string>("stu", credentialList[0].UserName));
#endif
                exam = await NetWork.getHttpWebRequest("examapi/index.php", paramList);
            }
            Debug.WriteLine("exam->" + exam);
            if (exam != "")
            {
                try
                {
                    JObject obj = JObject.Parse(exam);
                    if (Int32.Parse(obj["status"].ToString()) == 200)
                    {
                        List<ExamList> examList = new List<ExamList>();
                        JArray ExamListArray = Utils.ReadJso(exam);
                        for (int i = 0; i < ExamListArray.Count; i++)
                        {
                            ExamList examitem = new ExamList();
                            examitem.GetAttribute((JObject)ExamListArray[i]);
                            if (IsExamOrRe == 2)
                                examitem.DateTime = "第" + examitem.Week + "周周" + examitem.Weekday + "\r\n" + examitem.Begin_time + "-" + examitem.End_time;
                            else if (IsExamOrRe == 3)
                                examitem.DateTime = "日期:" + examitem.Date + "\r\n" + "时间:" + examitem.Time;
                            examList.Add(examitem);
                        }
                        examList = examList.OrderBy(x => x.DateTime).ToList();
                        var nonzeroweek = from x in examList where x.Begin_time=="待定" select x;//    examList.Select(x => !x.DateTime.Contains("周0")).ToList();
                        var zeroweek = from x in examList where x.Begin_time!="待定" select x;// examList.Select(x => x.DateTime.Contains("周0"));
                        List<ExamList> orderedlist = new List<ExamList>();
                        orderedlist.AddRange(zeroweek);
                        orderedlist.AddRange(nonzeroweek);
                        ObservableCollection<ExamList> move = new ObservableCollection<ExamList>();
                        ExamListView.ItemsSource = move;
                        for (int i = 0; i < orderedlist.Count; i++)
                        {
                            move.Add(orderedlist[i]);
                            await Task.Delay(60);
                        }
                    }
                    else if (Int32.Parse(obj["status"].ToString()) == 300)
                    {
                        ListFailedStackPanelTextBlock.Text = "暂无数据,过几天再来看看";

                        ListFailedStackPanel.Visibility = Visibility.Visible;
                        ListFailedStackPanelImage.Visibility = Visibility.Collapsed;
                        ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
                    }
                    else if (Int32.Parse(obj["status"].ToString()) == 0)
                    {
                        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;
                    }
                }
                catch (Exception)
                {
                    Debug.WriteLine("考试信息->解析异常");
                    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();
        }
コード例 #3
0
        private async void initExam()
        {
            string exam = "";
            List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>();


            await Utils.ShowSystemTrayAsync(Color.FromArgb(255, 2, 140, 253), Colors.White, text: "正在紧张安排考试...", isIndeterminate: true);
            if (IsExamOrRe == 2)
            {
                ExamTextBlock.Text = "考试安排";
                paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString()));
                paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString()));
                exam = await NetWork.getHttpWebRequest("api/examSchedule", paramList);
            }
            else if (IsExamOrRe == 3)
            {
                ExamTextBlock.Text = "补考安排";
#if DEBUG
                paramList.Add(new KeyValuePair<string, string>("stu", "2014214136"));
#else   
                paramList.Add(new KeyValuePair<string, string>("stu", appSetting.Values["stuNum"].ToString()));
#endif
                exam = await NetWork.getHttpWebRequest("examapi/index.php", paramList);
            }
            Debug.WriteLine("exam->" + exam);
            if (exam != "")
            {
                try
                {
                    JObject obj = JObject.Parse(exam);
                    if (Int32.Parse(obj["status"].ToString()) == 200)
                    {
                        List<ExamList> examList = new List<ExamList>();
                        JArray ExamListArray = Utils.ReadJso(exam);
                        for (int i = 0; i < ExamListArray.Count; i++)
                        {
                            ExamList examitem = new ExamList();
                            examitem.GetAttribute((JObject)ExamListArray[i]);
                            if (IsExamOrRe == 2)
                                examitem.DateTime = "第" + examitem.Week + "周周" + examitem.Weekday + "\r\n" + examitem.Begin_time + "-" + examitem.End_time;
                            else if (IsExamOrRe == 3)
                                examitem.DateTime = "日期:" + examitem.Date + "\r\n" + "时间:" + examitem.Time;
                            examList.Add(examitem);
                        }
                        ExamListView.ItemsSource = examList;
                    }
                    else if (Int32.Parse(obj["status"].ToString()) == 300)
                    {
                        ListFailedStackPanelTextBlock.Text = "暂无数据,过几天再来看看";

                        ListFailedStackPanel.Visibility = Visibility.Visible;
                        ListFailedStackPanelImage.Visibility = Visibility.Collapsed;
                        ListFailedStackPanelTextBlock.Visibility = Visibility.Visible;
                    }
                    else if (Int32.Parse(obj["status"].ToString()) == 0)
                    {
                        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;
                    }
                }
                catch (Exception)
                {
                    Debug.WriteLine("考试信息->解析异常");
                    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();
        }