Inheritance: Windows.UI.Xaml.Controls.UserControl
 //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);
                 }
             }
         }
     }
 }
        //TODO:未登陆时 没有课表
        private async void initKB(bool isRefresh = false)
        {
            string Transactiontemp = null;

            try
            {
                var vault = new Windows.Security.Credentials.PasswordVault();
                var credentialList = vault.FindAllByResource(resourceName);
                credentialList[0].RetrievePassword();
                //if (stuNum == appSetting.Values["stuNum"].ToString() && !isRefresh)
                if (stuNum == credentialList[0].UserName && !isRefresh)
                {
                    try
                    {
                        IStorageFolder applicationFolder = ApplicationData.Current.LocalFolder;
                        IStorageFile storageFileRE = await applicationFolder.GetFileAsync("kb");
                        IRandomAccessStream accessStream = await storageFileRE.OpenReadAsync();
                        using (StreamReader streamReader = new StreamReader(accessStream.AsStreamForRead((int)accessStream.Size)))
                        {
                            kb = streamReader.ReadToEnd();
                        }
                        HubSectionKBNum.Text = " | 第" + appSetting.Values["nowWeek"].ToString() + "周";
#if DEBUG
                        showKB(2, 5);
#else
                    showKB(2);
#endif
                    }
                    catch (Exception) { Debug.WriteLine("主页->课表数据缓存异常"); }
                }
                //if (stuNum == appSetting.Values["stuNum"].ToString())
                if (stuNum == credentialList[0].UserName)
                {
                    HubSectionKBTitle.Text = "我的课表";
                    HubSectionKBTitle.FontSize = 18;

                }

            }
            catch { }

            List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>();
            paramList.Add(new KeyValuePair<string, string>("stuNum", stuNum));
            //if (isRefresh)
            //    paramList.Add(new KeyValuePair<string, string>("forceFetch", "true"));


            string kbtemp = await NetWork.getHttpWebRequest("redapi2/api/kebiao", paramList); //新
                                                                                              //string kbtemp = await NetWork.getHttpWebRequest("api/kebiao", paramList); //旧
            try
            {
                var vault = new Windows.Security.Credentials.PasswordVault();
                var credentialList = vault.FindAllByResource(resourceName);
                credentialList[0].RetrievePassword();
                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));
                Transactiontemp = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/Person/getTransaction", TransactionparamList);
            }
            catch
            {
                NotifyPopup notifyPopup = new NotifyPopup("网络异常 无法读取事项~");
                notifyPopup.Show();
            }
            if (!appSetting.Values.ContainsKey("HttpTime"))
                appSetting.Values["HttpTime"] = DateTimeOffset.Now.ToString();
            if (kbtemp != "")
            {
                kb = kbtemp;
                Debug.WriteLine("DateTimeOffset.Now.ToString()" + DateTimeOffset.Now.ToString());
                appSetting.Values["HttpTime"] = DateTimeOffset.Now.Year.ToString() + "/" + DateTimeOffset.Now.Month.ToString() + "/" + DateTimeOffset.Now.Day.ToString();
            }
            Debug.WriteLine("kb->" + kb);
            if (kb != "")
            {
                JObject obj = JObject.Parse(kb);
                if (Int32.Parse(obj["status"].ToString()) == 200)
                {
                    IStorageFile storageFileWR = await applicationFolder.CreateFileAsync("kb", CreationCollisionOption.OpenIfExists);
                    try
                    {
                        await FileIO.WriteTextAsync(storageFileWR, kb);
                    }
                    catch (Exception)
                    {
                        Debug.WriteLine("主页 -> 课表缓存,读取异常");
                    }
                    //保存当前星期

                    if (kbtemp == "")
                    {
                        Debug.WriteLine("上次时间" + appSetting.Values["HttpTime"].ToString());
                        //DateTimeOffset d = DateTimeOffset.Parse(appSetting.Values["HttpTime"].ToString());
                        Debug.WriteLine("1");
                        int httpweekday = (Int16)DateTimeOffset.Parse(appSetting.Values["HttpTime"].ToString()).DayOfWeek == 0 ? 7 : (Int16)DateTimeOffset.Parse(appSetting.Values["HttpTime"].ToString()).DayOfWeek;

                        Debug.WriteLine("差" + (DateTimeOffset.Now - DateTimeOffset.Parse(appSetting.Values["HttpTime"].ToString())).TotalDays);
                        double weekday = (DateTimeOffset.Now - DateTimeOffset.Parse(appSetting.Values["HttpTime"].ToString())).TotalDays - (7 - httpweekday);
                        Debug.WriteLine("weekday_前" + weekday);
                        //if (weekday % ((Int16)weekday) > 0 || weekday > 0 && weekday < 1)
                        //    weekday = (Int16)weekday + 1;
                        weekday = (Int16)weekday;
                        Debug.WriteLine("weekday_后" + weekday);
                        if (weekday > 0)
                            appSetting.Values["nowWeek"] = Int16.Parse(obj["nowWeek"].ToString()) + (Int16)(weekday + 6) / 7;
                        else
                            appSetting.Values["nowWeek"] = obj["nowWeek"].ToString();
                        Debug.WriteLine(" appSetting.Values[\"nowWeek\"]" + appSetting.Values["nowWeek"].ToString());
                    }
                    else
                        appSetting.Values["nowWeek"] = obj["nowWeek"].ToString();
                    HubSectionKBNum.Text = " | 第" + appSetting.Values["nowWeek"].ToString() + "周";
                    todayNumofstuTextBlock.Text = "开学第" + ((Int16.Parse(appSetting.Values["nowWeek"].ToString()) - 1) * 7 + (Int16.Parse(Utils.GetWeek()) == 0 ? 7 : Int16.Parse(Utils.GetWeek()))).ToString() + "天";
                    //showKB(2, Int32.Parse(appSetting.Values["nowWeek"].ToString()));
#if DEBUG
                    showKB(2, 0, Transactiontemp);
#else
                    showKB(2);
#endif
                }
            }
            DateTime now = DateTime.Now;
            DateTime weekstart = GetWeekFirstDayMon(now);
            DateTime weekend = GetWeekLastDaySun(now);
            this.HubSectionKBDate.Text = weekstart.Month + "." + weekstart.Day + "--" + weekend.Month + "." + weekend.Day;
            ShowWeekOnKB(weekstart);

        }