/// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。
        /// 此参数通常用于配置页。</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            Windows.Phone.UI.Input.HardwareButtons.BackPressed += (sender, arg) => { arg.Handled = true; };
            if (StaticObj.user is HeartLink_Lib.Student)
            {
                gridForStudent.Visibility    = Visibility.Visible;
                gridForSupervisor.Visibility = Visibility.Collapsed;
            }
            else
            {
                gridForSupervisor.Visibility = Visibility.Visible;
                gridForStudent.Visibility    = Visibility.Collapsed;
                AskOffList = new ContentCollection <AskOffContent>();
                StaticObj.SendPackets(DataParser.Str2Packets(Convert.ToInt32(CommandCode.GetAskOff), ""));

                Packet[] incommingAskOff = await StaticObj.ReceivePackets();

                if (DataParser.GetPacketCommandCode(incommingAskOff[0]) == Convert.ToInt32(CommandCode.ReturnAskOff))
                {
                    List <Dictionary <string, string> > jsonAskOffs = JsonParser.DeserializeListOfDictionaryObject(DataParser.Packets2Str(incommingAskOff));

                    foreach (Dictionary <string, string> con in jsonAskOffs)
                    {
                        AskOffContent temp = new AskOffContent();
                        temp.Reason = con["REASON"];
                        temp.ID     = con["ID"];
                        temp.Date   = con["ASKOFFDATE"];
                        temp.Time   = con["ASKOFFTIME"];
                        AskOffList.Add(temp);
                    }

                    display.ItemsSource = AskOffList;
                }
            }
        }
Esempio n. 2
0
 private const double EARTH_RADIUS = 6378.137; //地球半径
 public Inspection()
 {
     this.InitializeComponent();
     ProgressBar.Height = MapControl.ActualHeight;
     ProgressBar.Width  = MapControl.ActualWidth;
     locationBox        = new ContentCollection <LocationContent>();
 }
Esempio n. 3
0
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。
        /// 此参数通常用于配置页。</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            Windows.Phone.UI.Input.HardwareButtons.BackPressed += (sender, arg) => { arg.Handled = true; };
            Contacters = new ContentCollection <ContactorContent>();
            MessageBox = new ContentCollection <MessageBoxContent>();

            #region GetContacters
            Dictionary <string, string> commandPair = new Dictionary <string, string>();
            commandPair.Add("ID", StaticObj.user.ID);
            Packet[] packets = DataParser.Str2Packets(Convert.ToInt32(CommandCode.GetContacters), JsonParser.SerializeObject(commandPair));
            StaticObj.SendPackets(packets);

            Packet[] incommingContacters = await StaticObj.ReceivePackets();

            if (DataParser.GetPacketCommandCode(incommingContacters[0]) == Convert.ToInt32(CommandCode.ReturnContacters))
            {
                List <Dictionary <string, string> > jsonContacters = JsonParser.DeserializeListOfDictionaryObject(DataParser.Packets2Str(incommingContacters));

                foreach (Dictionary <string, string> con in jsonContacters)
                {
                    ContactorContent listContent = new ContactorContent();
                    listContent.Name     = con["NAME"];
                    listContent.PhoneNum = con["CELLPHONE"];
                    Contacters.Add(listContent);
                }
            }
            #endregion

            #region GetMessageBox
            packets = DataParser.Str2Packets(Convert.ToInt32(CommandCode.GetMessageBox), "");
            StaticObj.SendPackets(packets);

            Packet[] incommingMessageBox = await StaticObj.ReceivePackets();

            if (DataParser.GetPacketCommandCode(incommingMessageBox[0]) == Convert.ToInt32(CommandCode.ReturnMessageBox))
            {
                List <Dictionary <string, string> > jsonMessageBox = JsonParser.DeserializeListOfDictionaryObject(DataParser.Packets2Str(incommingMessageBox));

                foreach (Dictionary <string, string> msg in jsonMessageBox)
                {
                    MessageBoxContent listContent = new MessageBoxContent();
                    listContent.ID = msg["ID"];
                    if (msg["ISFROMSTUDENT"].Equals("1"))
                    {
                        listContent.Type = "Student";
                    }
                    else
                    {
                        listContent.Type = "Supervisor";
                    }
                    //listContent.Type = msg["TYPE"];
                    listContent.Time    = msg["SENDTIME"];
                    listContent.Content = msg["CONTENT"];
                    MessageBox.Add(listContent);
                }
            }
            #endregion

            if (StaticObj.user is HeartLink_Lib.Student)
            {
                WorkServiceForStudent.Visibility    = Visibility.Visible;
                WorkServiceForSupervisor.Visibility = Visibility.Collapsed;

                StaticObj.SendPackets(DataParser.Str2Packets(Convert.ToInt32(CommandCode.GetDailyReminder), ""));

                Packet[] incommingDailyReminder = await StaticObj.ReceivePackets();

                DailyReminderDisplay dis = new DailyReminderDisplay();
                if (DataParser.GetPacketCommandCode(incommingDailyReminder[0]) == Convert.ToInt32(CommandCode.ReturnDailyReminder))
                {
                    Dictionary <string, string> dailyReminder = JsonParser.DeserializeObject(DataParser.Packets2Str(incommingDailyReminder));
                    dis.ReminderTime    = dailyReminder["REMINDTIME"];
                    dis.ReminderContent = dailyReminder["CONTENT"];
                }
                WorkServiceForStudent.DataContext = dis;
            }
            else
            {
                WorkServiceForSupervisor.Visibility = Visibility.Visible;
                WorkServiceForStudent.Visibility    = Visibility.Collapsed;
            }
        }