Пример #1
0
        private async void SetAlert(object sender, RoutedEventArgs e)
        {
            StationFeature stationFeature = this.lvStations.SelectedItem as StationFeature;

            if (stationFeature != null)
            {
                rootPage.SetAlert(stationFeature);
            }
            else
            {
                var messageDialog = new MessageDialog("请先选择站点!");
                await messageDialog.ShowAsync();
            }
        }
Пример #2
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();
            }
        }