コード例 #1
0
        private async void ApplicationBarMenuItem_Click_1(object sender, EventArgs e)
        {
            if (addFavePressed == false)
            {
                addFavePressed = true;
                OCDirection direction = OCDirection.newOCDirection(int.Parse(routeNumber.Text), routeName.Text, "", "", 0);

                direction.FromStopNumber  = stopID;
                direction.FromStopName    = fromStopName;
                direction.DirectionalName = "TO " + this.direction.ToUpper();
                int result = await OCTranspoStopsData.addFavouriteStop(direction);

                if (result > 0)
                {
                    MessageBox.Show("Your favourite stop was succesfully added.");
                    ApplicationBarIconButton button = (ApplicationBarIconButton)sender;
                    button.IsEnabled = false;
                    favourite        = true;
                }
                else
                {
                    MessageBox.Show("There was an error adding your favourite stop, please try again.");
                    addFavePressed = favourite = false;
                }
            }
        }
コード例 #2
0
ファイル: OCSupport.cs プロジェクト: jules2689/OCTranspoWP8
    private static List <OCDirection> makeDirection(XElement routeDir)
    {
        List <OCDirection> dirs = new List <OCDirection>();
        int      routeNo;
        String   routeLabel, direction, procTime;
        XElement trips;

        foreach (XElement dir in routeDir.Elements())
        {
            routeNo    = int.Parse(dir.Element("RouteNo").Value);
            routeLabel = dir.Element("RouteLabel").Value;
            direction  = dir.Element("Direction").Value;
            procTime   = dir.Element("RequestProcessingTime").Value;
            trips      = dir.Element("Trips");
            dirs.Add(OCDirection.newOCDirection(routeNo, routeLabel, direction, procTime, 0));
        }

        return(dirs);
    }
コード例 #3
0
        private async void addFavourite_Click(object sender, RoutedEventArgs e)
        {
            var         menItem   = (MenuItem)sender;
            OCApiRoute  apiRoute  = (OCApiRoute)menItem.DataContext;
            OCDirection direction = OCDirection.newOCDirection(apiRoute.RouteNumber, apiRoute.RouteHeading, apiRoute.Direction, "", 0);

            direction.FromStopName    = stopName.Text;
            direction.FromStopNumber  = int.Parse(stopID.Text);
            direction.DirectionalName = "TO " + apiRoute.RouteHeading.ToUpper();
            int result = await OCTranspoStopsData.addFavouriteStop(direction);

            if (result > 0)
            {
                MessageBox.Show("Your favourite stop was succesfully added.");
            }
            else
            {
                MessageBox.Show("There was an error adding your favourite stop, please try again.");
            }
        }