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; }
//bool isGetTransactionSuccess = false; //新增:获取事项信息 private async void GetTransaction(string contentstring = null) { bool secondTimeAdd = false; if (contentstring == null) { //clear出了无法理解的问题..暂时用一个判断吧 聊胜于无 var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList[0] != null) { try { List<KeyValuePair<String, String>> TransactionparamList = new List<KeyValuePair<String, String>>(); TransactionparamList.Add(new KeyValuePair<string, string>("stuNum", credentialList[0].UserName)); TransactionparamList.Add(new KeyValuePair<string, string>("idNum", credentialList[0].Password)); string Transactiontemp = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/Person/getTransaction", TransactionparamList); //isGetTransactionSuccess = true; JObject Tobj = JObject.Parse(Transactiontemp); if (Int32.Parse(Tobj["status"].ToString()) == 200) { JArray TransactionArray = Utils.ReadJso(Transactiontemp); for (int i = 0; i < TransactionArray.Count; i++) { Transaction transactionItem = new Transaction(); transactionItem.GetAttribute((JObject)TransactionArray[i]); foreach (var existItem in transationList) { if (transactionItem.id == existItem.id) { secondTimeAdd = true; break; } } if (!secondTimeAdd) transationList.Add(transactionItem); Debug.WriteLine(i); } } } catch { NotifyPopup notifyPopup = new NotifyPopup("网络异常 无法读取事项~"); notifyPopup.Show(); } } } else { if (contentstring!=null&&contentstring != "") { JObject Tobj = JObject.Parse(contentstring); if (Int32.Parse(Tobj["status"].ToString()) == 200) { JArray TransactionArray = Utils.ReadJso(contentstring); for (int i = 0; i < TransactionArray.Count; i++) { Transaction transactionItem = new Transaction(); transactionItem.GetAttribute((JObject)TransactionArray[i]); foreach (var existItem in transationList) { if (transactionItem.id == existItem.id) { secondTimeAdd = true; break; } } if (!secondTimeAdd) transationList.Add(transactionItem); Debug.WriteLine(i); } } } } }