コード例 #1
0
 public void ResetReminder(ReminderStation alertStation)
 {
     lock (reminderLock)
     {
         this.CurrentReminderStation = alertStation;
     }
 }
コード例 #2
0
        public ReminderPage()
        {
            try
            {
                ReminderStation reminder = rootPage.CurrentReminderStation;
                stationInfoList = new List <StationInfo>();

                if (reminder != null)
                {
                    foreach (StationInfo info in reminder.StationInfos)
                    {
                        this.stationInfoList.Add(info);
                    }
                    rootPage.SetBusName(reminder.name);
                    if (reminder.status != null)
                    {
                        rootPage.SetStatus(reminder.status);
                    }
                }

                this.InitializeComponent();

                this.lvStations.ItemsSource = StationInfoList;
            }
            catch
            {
            }
        }
コード例 #3
0
        public async void SetAlert(StationFeature selectedFeature)
        {
            string err = string.Empty;

            try
            {
                //set CurrentReminder
                if (this.CurrentStation != null)
                {
                    ReminderStation    newAlert = new ReminderStation();
                    List <StationInfo> infoList = new List <StationInfo>();
                    foreach (StationFeature feature in this.CurrentStation.response.resultSet.busLine.stationData.StationFeatures)
                    {
                        if (feature.type.StartsWith("L"))
                        {
                            continue;
                        }
                        StationInfo info = new StationInfo();
                        info.stationId = feature.stationId;
                        info.caption   = feature.caption;
                        string[] points = feature.points.txt.Split(',');
                        info.longitude = double.Parse(points[0]);
                        info.latitude  = double.Parse(points[1]);
                        if (selectedFeature.stationId.Equals(feature.stationId))
                        {
                            info.isReminder   = true;
                            info.displayText  = info.caption + "                     (到站提醒)";
                            info.displayStyle = "ReminderTextStyle";
                        }
                        else
                        {
                            info.isReminder   = false;
                            info.displayText  = info.caption;
                            info.displayStyle = "BasicTextStyle";
                        }
                        infoList.Add(info);
                    }
                    newAlert.name            = this.CurrentStation.response.resultSet.busLine.name;
                    newAlert.StationInfos    = infoList.ToArray();
                    newAlert.alertResponse   = false;
                    newAlert.alertDisplaying = false;

                    this.ResetReminder(newAlert);
                    loadView(typeof(ReminderPage));
                }
                else
                {
                    this.ShowStationChoose();
                    var messageDialog = new MessageDialog("请先选择线路!");
                    await messageDialog.ShowAsync();
                }
            }
            catch (Exception e)
            {
                err = e.Message;
            }
            if (err != null && err != string.Empty)
            {
                this.ShowStationChoose();
                var messageDialog = new MessageDialog("线路数据有误,请重新选择");
                await messageDialog.ShowAsync();
            }
        }