Пример #1
0
        private LocationHandler()
        {
            xmlFileHandler = new XMLFileHandler();
            pubList = new List<LocationData>();
            LocationData d = new LocationData();
            pubList = xmlFileHandler.readPubXMLFile();
            routeList = xmlFileHandler.readRouteXMLFile(pubList);

            foreach(LocationData location in pubList)
            {
                location.setPubdayTimes();
            }
        }
Пример #2
0
        public void setPub(LocationData pub)
        {
            foreach (LocationData p in pubList)
            {
                if(p.id == pub.id)
                {
                    int index = pubList.IndexOf(p);
                    pubList[index] = pub;
                    break;
                }
            }

            xmlFileHandler.writePubXMLFile(pubList);
        }
Пример #3
0
        private bool isPubOpen(LocationData data)
        {
            bool open = true;
            String day = DateTime.Now.DayOfWeek.ToString();
            PubDay pubday = data.getDay(day);
            if (pubday.isClosed)
                open = false;
            else 
            {
                bool timeopen = pubday.isNowOpen(); 
            }

            return open;
        }
Пример #4
0
        private void fillHappyTimes(LocationData data, List<string> fromTimes, List<string> toTimes)
        {
            for (int i = 0; i < 7; i++)
            {
                data.pubdays[i].happyhourFrom = new ClockTime();
                if (fromTimes[i].ToUpper() == "CLOSED")
                    data.pubdays[i].isClosed = true;
                else
                {
                    data.pubdays[i].happyhourFrom.hour = Int32.Parse((fromTimes[i])[0] + "" + (fromTimes[i])[1]);
                    data.pubdays[i].happyhourFrom.minutes = Int32.Parse((fromTimes[i])[3] + "" + (fromTimes[i])[4]);

                    if (data.pubdays[i].happyhourFrom.hour < 10)
                        data.pubdays[i].happyhourFrom.stringhour = "0" + data.pubdays[i].happyhourFrom.hour;
                    else
                        data.pubdays[i].happyhourFrom.stringhour = data.pubdays[i].happyhourFrom.hour.ToString();

                    if (data.pubdays[i].happyhourFrom.minutes < 10)
                        data.pubdays[i].happyhourFrom.stringminutes = "0" + data.pubdays[i].happyhourFrom.minutes;
                    else
                        data.pubdays[i].happyhourFrom.stringminutes = data.pubdays[i].happyhourFrom.minutes.ToString();
                }

                data.pubdays[i].happyhourTo = new ClockTime();
                if (toTimes[i].ToUpper() == "CLOSED")
                    data.pubdays[i].isClosed = true;
                else
                {
                    data.pubdays[i].happyhourTo.hour = Int32.Parse((toTimes[i])[0] + "" + (toTimes[i])[1]);
                    data.pubdays[i].happyhourTo.minutes = Int32.Parse((toTimes[i])[3] + "" + (toTimes[i])[4]);

                    if (data.pubdays[i].happyhourTo.hour < 10)
                        data.pubdays[i].happyhourTo.stringhour = "0" + data.pubdays[i].happyhourTo.hour;
                    else
                        data.pubdays[i].happyhourTo.stringhour = data.pubdays[i].happyhourTo.hour.ToString();

                    if (data.pubdays[i].happyhourTo.minutes < 10)
                        data.pubdays[i].happyhourTo.stringminutes = "0" + data.pubdays[i].happyhourTo.minutes;
                    else
                        data.pubdays[i].happyhourTo.stringminutes = data.pubdays[i].happyhourTo.minutes.ToString();
                }
            }
        }
Пример #5
0
 public void addPubToList(LocationData data)
 {
     pubs.Add(data);
 }
Пример #6
0
        public List<PubRoute> readRouteXMLFile(List<LocationData> pubList)
        {
            if (pubList.Count != 0)
            {
                XElement element;
                List<PubRoute> routes = new List<PubRoute>();
                PubRoute route = null;
                LocationData pubdata = new LocationData();

                using (XmlReader reader = XmlReader.Create("Assets/XML/PubRoutes.xml"))
                {
                    while (reader.Read())
                    {
                        if (reader.IsStartElement())
                        {
                            switch (reader.Name.ToString().ToUpper())
                            {
                                case "ROUTE":
                                    route = new PubRoute();
                                    break;
                                case "NAME":
                                    element = XElement.ReadFrom(reader) as XElement;
                                    route.name = element.Value.ToString();
                                    break;
                                case "PUB":
                                    pubdata = new LocationData();
                                    break;
                                case "ID":
                                    element = XElement.ReadFrom(reader) as XElement;
                                    int id = -1;
                                    int.TryParse(element.Value.ToString(), out id);
                                    foreach (LocationData data in pubList)
                                    {
                                        if (data.id == id)
                                        {
                                            pubdata = data;
                                            break;
                                        }
                                    }
                                    route.addPubToList(pubdata);
                                    break;
                            }
                        }
                        else if (reader.NodeType == XmlNodeType.EndElement && reader.Name.ToString().ToUpper() == "ROUTE")
                            routes.Add(route);
                    }
                }
                return routes;
            }
            else
                return null;
        }
Пример #7
0
        private void readPubTimes(XmlReader reader, Boolean isOpentime, LocationData location)
        {
            ClockTime time = new ClockTime();
            XElement element;
            string typeTime = "CLOSETIMES";
            int day;

            if (isOpentime)
                typeTime = "OPENTIMES";

            while (reader.Read() && reader.NodeType != XmlNodeType.EndElement && reader.Name.ToString().ToUpper() != typeTime)
            {
                if (reader.IsStartElement())
                {
                    time = new ClockTime();
                    switch (reader.Name.ToString().ToUpper())
                    {
                        case "MONDAY":
                            day = 0;
                            element = XElement.ReadFrom(reader) as XElement;
                            location.pubdays[day].isClosed = FillPubHoursAndMinutes(time, element);
                            if (isOpentime)
                                location.pubdays[day].open = time;
                                //location.addOpenTime(time);
                            else
                                //location.addCloseTime(time);
                                location.pubdays[day].close = time;
                            break;
                        case "TUESDAY":
                            day = 1;
                            element = XElement.ReadFrom(reader) as XElement;
                            location.pubdays[day].isClosed = FillPubHoursAndMinutes(time, element);
                            if (isOpentime)
                                location.pubdays[day].open = time;
                            else
                                location.pubdays[day].close = time;
                            break;
                        case "WEDNESDAY":
                            day = 2;
                            element = XElement.ReadFrom(reader) as XElement;
                            location.pubdays[day].isClosed = FillPubHoursAndMinutes(time, element);
                            if (isOpentime)
                                location.pubdays[day].open = time;
                            else
                                location.pubdays[day].close = time;
                            break;
                        case "THURSDAY":
                            day = 3;
                            element = XElement.ReadFrom(reader) as XElement;
                            location.pubdays[day].isClosed = FillPubHoursAndMinutes(time, element);
                            if (isOpentime)
                                location.pubdays[day].open = time;
                            else
                                location.pubdays[day].close = time;
                            break;
                        case "FRIDAY":
                            day = 4;
                            element = XElement.ReadFrom(reader) as XElement;
                            location.pubdays[day].isClosed = FillPubHoursAndMinutes(time, element);
                            if (isOpentime)
                                location.pubdays[day].open = time;
                            else
                                location.pubdays[day].close = time;
                            break;
                        case "SATERDAY":
                            day = 5;
                            element = XElement.ReadFrom(reader) as XElement;
                            location.pubdays[day].isClosed = FillPubHoursAndMinutes(time, element);
                            if (isOpentime)
                                location.pubdays[day].open = time;
                            else
                                location.pubdays[day].close = time;
                            break;
                        case "SUNDAY":
                            day = 6;
                            element = XElement.ReadFrom(reader) as XElement;
                            location.pubdays[day].isClosed = FillPubHoursAndMinutes(time, element);
                            if (isOpentime)
                                location.pubdays[day].open = time;
                            else
                                location.pubdays[day].close = time;
                            break;

                    }
                }
            }
        }
Пример #8
0
        public List<LocationData> readPubXMLFile()
        {
            XElement element;
            List<LocationData> locations = new List<LocationData>();
            LocationData location = null;

            using (XmlReader reader = XmlReader.Create("Assets/XML/PubsInformation.xml"))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name.ToString().ToUpper())
                        {
                            case "PUB":
                                location = new LocationData();
                                break;
                            case "ID":
                                element = XElement.ReadFrom(reader) as XElement;
                                location.id = int.Parse(element.Value);
                                break;
                            case "NAME":
                                element = XElement.ReadFrom(reader) as XElement;
                                location.name = element.Value.ToString();
                                break;
                            case "STREET":
                                element = XElement.ReadFrom(reader) as XElement;
                                location.street = element.Value.ToString();
                                break;
                            case "STREETNUMBER":
                                element = XElement.ReadFrom(reader) as XElement;
                                location.streetNumber = element.Value;
                                break;
                            case "ZIPCODE":
                                element = XElement.ReadFrom(reader) as XElement;
                                location.zipcode = element.Value.ToString();
                                break;
                            case "CITY":
                                element = XElement.ReadFrom(reader) as XElement;
                                location.city = element.Value.ToString();
                                break;
                            case "COUNTRY":
                                element = XElement.ReadFrom(reader) as XElement;
                                location.country = element.Value.ToString();
                                break;
                            case "RATING":
                                element = XElement.ReadFrom(reader) as XElement;
                                int rating;
                                int.TryParse(element.Value.ToString(), out rating);
                                location.rating = rating;
                                break;
                            case "OPENTIMES":
                                readPubTimes(reader, true, location);
                                break;
                            case "CLOSETIMES":
                                readPubTimes(reader, false, location);
                                break;
                            case "LONGITUDE":
                                element = XElement.ReadFrom(reader) as XElement;
                                Double.TryParse(element.Value.ToString(), out location.position.Longitude);
                                break;
                            case "LATITUDE":
                                element = XElement.ReadFrom(reader) as XElement;
                                Double.TryParse(element.Value.ToString(), out location.position.Latitude);
                                break;
                            case "HAPPYHOURFROM":
                                //element = XElement.ReadFrom(reader) as XElement;
                                //readHappyhours(reader, location);
                                readHappyTimes(reader, true, location);
                                break;
                            case "HAPPYHOURTO":
                                //element = XElement.ReadFrom(reader) as XElement;
                                //readHappyhours(reader, location);
                                readHappyTimes(reader, false, location);
                                break;
                        }
                    }
                    else if (reader.NodeType == XmlNodeType.EndElement && reader.Name.ToString().ToUpper() == "PUB")
                        locations.Add(location);
                }
            }
            return locations;
        }
Пример #9
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     this.pub = (LocationData)e.Parameter;
     fillTextFields();
 }
Пример #10
0
        public async void OnGeofenceStateChanged(GeofenceMonitor sender, object e)
        {
            var reports = sender.ReadReports();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                foreach (GeofenceStateChangeReport report in reports)
                {
                    GeofenceState state = report.NewState;

                    Geofence geofence = report.Geofence;

                    if (state == GeofenceState.Removed)
                    {
                        // remove the geofence from the geofences collection
                        GeofenceMonitor.Current.Geofences.Remove(geofence);
                    }
                    else if (state == GeofenceState.Entered)
                    {
                        // Your app takes action based on the entered event

                        // NOTE: You might want to write your app to take particular
                        // action based on whether the app has internet connectivity.
                        foreach(LocationData data in selectedRoute.pubs)
                        {
                            if (data.name.Equals(geofence.Id))
                                geofencePub = data;
                        }

                        if (geofencePub != null)
                        {
                            //string happyhourText = "Happyhour: No";
                            String day = DateTime.Now.DayOfWeek.ToString();
                            PubDay pubday = geofencePub.getDay(day);
                           // if(pubday.happyhour)
                                //happyhourText = "Happyhour: Yes";

                            Summary.Text = "";
                            Hyperlink link = new Hyperlink();
                            link.Inlines.Add(new Run()
                            {
                                Text = geofencePub.name,
                            });
                            Summary.Inlines.Add(new LineBreak());

                            if (isPubOpen(geofencePub))
                            {
                                Summary.Inlines.Add(new Run()
                                {
                                    Text = "Open: yes"
                                });
                            }
                            else
                            {
                                Summary.Inlines.Add(new Run()
                                {
                                    Text = "Open: no",
                                });
                            }
                            Summary.Inlines.Add(link);                               
                        }

                    }
                    else if (state == GeofenceState.Exited)
                    {
                        // Your app takes action based on the exited event

                        // NOTE: You might want to write your app to take particular
                        // action based on whether the app has internet connectivity.
                        visitedPubs = 1;
                        if(visitedPubs < selectedRoute.pubs.Count)
                            getRouteWithCurrentLocation(currentLocation.Point, selectedRoute.pubs[visitedPubs]);
                    }
                }
            });
        }
Пример #11
0
        private async void getRouteWithPubs(LocationData startLoc, LocationData endLoc)
        {
            BasicGeoposition startLocation = startLoc.position;
            Geopoint startPoint = new Geopoint(startLocation);

            BasicGeoposition endLocation = endLoc.position;
            Geopoint endPoint = new Geopoint(endLocation);

            GetRouteAndDirections(startPoint, endPoint, false, Colors.Orange);
        }
Пример #12
0
        /*
        /   Voor het bepalen van de route en richtingen.
        */
        private async void getRouteWithCurrentLocation(Geopoint startLoc, LocationData endLoc)
        {
            BasicGeoposition endLocation = endLoc.position;
            Geopoint endPoint = new Geopoint(endLocation);

            GetRouteAndDirections(startLoc, endPoint, true, Colors.Red);
        }
Пример #13
0
        private void drawGeofence(LocationData location, double radius)
        {
            var strokeColor = Colors.DarkBlue;
            strokeColor.A = 100;
            var fillColor = Colors.Blue;
            fillColor.A = 50;

            MapPolygon circlePolygon = new MapPolygon
            {
                FillColor = fillColor,
                StrokeColor = strokeColor,
                StrokeThickness = 3,
                StrokeDashed = true,
                ZIndex = 1,
                Path = new Geopath(GetCirclePoints(location.position, radius))
            };

            InputMap.MapElements.Add(circlePolygon);
        }
Пример #14
0
        /*
        /   Voor het toevoegen van icon's aan de map.
        */
        private void AddMapIcon(LocationData location)
        {
            MapIcon MapIcon1 = new MapIcon();
            MapIcon1.Location = new Geopoint(location.position);
            MapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0);
            MapIcon1.Title = location.name;
            InputMap.MapElements.Add(MapIcon1);

            // Geofence
            BasicGeoposition pos = new BasicGeoposition();
            pos.Latitude = location.position.Latitude;
            pos.Longitude = location.position.Longitude;
            Geocircle circle = new Geocircle(pos, 35);
            MonitoredGeofenceStates monitoredStates =
                MonitoredGeofenceStates.Entered |
                MonitoredGeofenceStates.Exited |
                MonitoredGeofenceStates.Removed;
            TimeSpan dwellTime = TimeSpan.FromSeconds(1);
            var geofence = new Windows.Devices.Geolocation.Geofencing.Geofence(location.name, circle, monitoredStates, false, dwellTime);
            GeofenceMonitor.Current.Geofences.Add(geofence);

            drawGeofence(location, 35);
        }
Пример #15
0
 public void addPub(LocationData pub)
 {
     pub.id = pubList[pubList.Count -1].id + 1;
     checkIfListContains(pubList, pub);
     xmlFileHandler.writePubXMLFile(pubList);
 }
Пример #16
0
        private void fillTimes(LocationData data, List<string> openTimes, List<string> closeTimes)
        {
            for (int i = 0; i < 7; i++)
            {
                data.pubdays[i].open = new ClockTime();
                if (openTimes[i].ToUpper() == "CLOSED")
                    data.pubdays[i].isClosed = true;
                else
                {
                    data.pubdays[i].open.hour = Int32.Parse((openTimes[i])[0] + "" + (openTimes[i])[1]);
                    data.pubdays[i].open.minutes = Int32.Parse((openTimes[i])[3] + "" + (openTimes[i])[4]);

                    if (data.pubdays[i].open.hour < 10)
                        data.pubdays[i].open.stringhour = "0" + data.pubdays[i].open.hour;
                    else
                        data.pubdays[i].open.stringhour = data.pubdays[i].open.hour.ToString();

                    if (data.pubdays[i].open.minutes < 10)
                        data.pubdays[i].open.stringminutes = "0" + data.pubdays[i].open.minutes;
                    else
                        data.pubdays[i].open.stringminutes = data.pubdays[i].open.minutes.ToString();
                }

                data.pubdays[i].close = new ClockTime();
                if (closeTimes[i].ToUpper() == "CLOSED")
                    data.pubdays[i].isClosed = true;
                else
                {
                    data.pubdays[i].close.hour = Int32.Parse((closeTimes[i])[0] + "" + (closeTimes[i])[1]);
                    data.pubdays[i].close.minutes = Int32.Parse((closeTimes[i])[3] + "" + (closeTimes[i])[4]);

                    if (data.pubdays[i].close.hour < 10)
                        data.pubdays[i].close.stringhour = "0" + data.pubdays[i].close.hour;
                    else
                        data.pubdays[i].close.stringhour = data.pubdays[i].close.hour.ToString();

                    if (data.pubdays[i].close.minutes < 10)
                        data.pubdays[i].close.stringminutes = "0" + data.pubdays[i].close.minutes;
                    else
                        data.pubdays[i].close.stringminutes = data.pubdays[i].close.minutes.ToString();
                }
            }
        }
Пример #17
0
        public void inputData()
        {
            string name = Name_TextBox.Text;
            string street = Street_TextBox.Text;
            string houseNumber = Housenumber_TextBox.Text;
            string zipCode = Zipcode_TextBox.Text;
            string city = Place_TextBox.Text;
            string country = Country_TextBox.Text;

            string openingTimeMa = OpeningTimeMa_TextBox.Text;
            string closingTimeMa = ClosingTimeMa_TextBox.Text;
            string openingTimeDi = OpeningTimeDi_TextBox.Text;
            string closingTimeDi = ClosingTimeDi_TextBox.Text;
            string openingTimeWo = OpeningTimeWo_TextBox.Text;
            string closingTimeWo = ClosingTimeWo_TextBox.Text;
            string openingTimeDo = OpeningTimeDo_TextBox.Text;
            string closingTimeDo = ClosingTimeDo_TextBox.Text;
            string openingTimeVr = OpeningTimeVr_TextBox.Text;
            string closingTimeVr = ClosingTimeVr_TextBox.Text;
            string openingTimeZa = OpeningTimeZa_TextBox.Text;
            string closingTimeZa = ClosingTimeZa_TextBox.Text;
            string openingTimeZo = OpeningTimeZo_TextBox.Text;
            string closingTimeZo = ClosingTimeZo_TextBox.Text;

            string longitude = Longitude_TextBox.Text;
            string latitude = Latitude_TextBox.Text;

            string happyhourFromMa = HappyhourFromMa_TextBox.Text;
            string happyhourToMa = HappyhourToMa_TextBox.Text;
            string happyhourFromDi = HappyhourFromDi_TextBox.Text;
            string happyhourToDi = HappyhourToDi_TextBox.Text;
            string happyhourFromWo = HappyhourFromWo_TextBox.Text;
            string happyhourToWo = HappyhourToWo_TextBox.Text;
            string happyhourFromDo = HappyhourFromDo_TextBox.Text;
            string happyhourToDo = HappyhourToDo_TextBox.Text;
            string happyhourFromVr = HappyhourFromVr_TextBox.Text;
            string happyhourToVr = HappyhourToVr_TextBox.Text;
            string happyhourFromZa = HappyhourFromZa_TextBox.Text;
            string happyhourToZa = HappyhourToZa_TextBox.Text;
            string happyhourFromZo = HappyhourFromZo_TextBox.Text;
            string happyhourToZo = HappyhourToZo_TextBox.Text;

            int selectedRatingIndex = Rating_ComboBox.SelectedIndex;
            Object rating = Rating_ComboBox.SelectedItem;

            if (string.IsNullOrEmpty(name))
                ErrorMessage_TextBlock.Text = "Er is geen naam opgegeven.";
            else if (string.IsNullOrEmpty(street))
                ErrorMessage_TextBlock.Text = "Er is geen straat opgegeven.";
            else if (string.IsNullOrEmpty(houseNumber))
                ErrorMessage_TextBlock.Text = "Er is geen huisnummer opgegeven.";
            else if (string.IsNullOrEmpty(zipCode))
                ErrorMessage_TextBlock.Text = "Er is geen postcode opgegeven.";
            else if (string.IsNullOrEmpty(city))
                ErrorMessage_TextBlock.Text = "Er is geen plaats opgegeven.";
            else if (string.IsNullOrEmpty(country))
                ErrorMessage_TextBlock.Text = "Er is geen land opgegeven.";
            else if (string.IsNullOrEmpty(OpeningTimeMa_TextBox.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen dag opgegeven.";
            else if (string.IsNullOrEmpty(openingTimeMa) &&
                     string.IsNullOrEmpty(openingTimeDi) &&
                     string.IsNullOrEmpty(openingTimeWo) &&
                     string.IsNullOrEmpty(openingTimeDo) &&
                     string.IsNullOrEmpty(openingTimeVr) &&
                     string.IsNullOrEmpty(openingTimeZa) &&
                     string.IsNullOrEmpty(openingTimeZo))
                ErrorMessage_TextBlock.Text = "Er zijn geen openingstijden opgegeven.";
            else if (string.IsNullOrEmpty(closingTimeMa) &&
                     string.IsNullOrEmpty(closingTimeDi) &&
                     string.IsNullOrEmpty(closingTimeWo) &&
                     string.IsNullOrEmpty(closingTimeDo) &&
                     string.IsNullOrEmpty(closingTimeVr) &&
                     string.IsNullOrEmpty(closingTimeZa) &&
                     string.IsNullOrEmpty(closingTimeZo))
                ErrorMessage_TextBlock.Text = "Er zijn geen sluitingstijden opgegeven.";
            else if (string.IsNullOrEmpty(rating.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen rating opgegeven.";
            else if (string.IsNullOrEmpty(longitude.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen longitude opgegeven.";
            else if (string.IsNullOrEmpty(latitude.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen latitude opgegeven.";
            else if (string.IsNullOrEmpty(happyhourFromMa) &&
                     string.IsNullOrEmpty(happyhourFromDi) &&
                     string.IsNullOrEmpty(happyhourFromWo) &&
                     string.IsNullOrEmpty(happyhourFromDo) &&
                     string.IsNullOrEmpty(happyhourFromVr) &&
                     string.IsNullOrEmpty(happyhourFromZa) &&
                     string.IsNullOrEmpty(happyhourFromZo))
                ErrorMessage_TextBlock.Text = "Er is geen tijd opgegeven.";
            else if (string.IsNullOrEmpty(happyhourToMa) &&
                     string.IsNullOrEmpty(happyhourToDi) &&
                     string.IsNullOrEmpty(happyhourToWo) &&
                     string.IsNullOrEmpty(happyhourToDo) &&
                     string.IsNullOrEmpty(happyhourToVr) &&
                     string.IsNullOrEmpty(happyhourToZa) &&
                     string.IsNullOrEmpty(happyhourToZo))
                ErrorMessage_TextBlock.Text = "Er is geen tijd opgegeven.";
            else
            {
                ErrorMessage_TextBlock.Text = "";

                List<string> happyhourFrom = new List<string>();
                happyhourFrom.Add(happyhourFromMa);
                happyhourFrom.Add(happyhourFromDi);
                happyhourFrom.Add(happyhourFromWo);
                happyhourFrom.Add(happyhourFromDo);
                happyhourFrom.Add(happyhourFromVr);
                happyhourFrom.Add(happyhourFromZa);
                happyhourFrom.Add(happyhourFromZo);

                List<string> happyhourTo = new List<string>();
                happyhourTo.Add(happyhourToMa);
                happyhourTo.Add(happyhourToDi);
                happyhourTo.Add(happyhourToWo);
                happyhourTo.Add(happyhourToDo);
                happyhourTo.Add(happyhourToVr);
                happyhourTo.Add(happyhourToZa);
                happyhourTo.Add(happyhourToZo);

                List<string> openTimes = new List<string>();
                openTimes.Add(openingTimeMa);
                openTimes.Add(openingTimeDi);
                openTimes.Add(openingTimeWo);
                openTimes.Add(openingTimeDo);
                openTimes.Add(openingTimeVr);
                openTimes.Add(openingTimeZa);
                openTimes.Add(openingTimeZo);

                List<string> closeTimes = new List<string>();
                closeTimes.Add(closingTimeMa);
                closeTimes.Add(closingTimeDi);
                closeTimes.Add(closingTimeWo);
                closeTimes.Add(closingTimeDo);
                closeTimes.Add(closingTimeVr);
                closeTimes.Add(closingTimeZa);
                closeTimes.Add(closingTimeZo);

                LocationData pub = new LocationData(name, street, houseNumber, zipCode, city, country, selectedRatingIndex, Convert.ToDouble(longitude), Convert.ToDouble(latitude), openTimes, closeTimes, happyhourFrom, happyhourTo);
                fillTimes(pub, openTimes, closeTimes);
                fillHappyTimes(pub, happyhourFrom, happyhourTo);
                pub.setPubdayTimes();
                LocationHandler.Instance.addPub(pub);

                Frame.Navigate(typeof(View.PubMenu));
            }
        }
Пример #18
0
        private List<LocationData> checkIfListContains(List<LocationData> list, LocationData data)
        {
            Boolean isIn = false;
            foreach (LocationData ld in list)
            {
                if (ld.name == data.name && ld.city != data.city)
                    isIn = false;
                else if (ld.name == data.name)
                {
                    isIn = true;
                    break;
                }
            }
            if (!isIn)
                list.Add(data);

            return list;
        }