Exemplo n.º 1
0
        public static void GetTripAsyncTEST()
        {            
            Meeting startMeeting = new Meeting()
            {
                Location = new Location()
                {
                    Latitude = 49.47518,
                    Longitude = 1.091378
                }
            };
            Meeting endMeeting = new Meeting()
            {
                Location = new Location()
                {
                    Latitude = 49.4401397705078,
                    Longitude = 1.08940994739532
                }
            };

            ITripManager manager = new TripManager();

            manager.TripReceived += (o, e) =>
            {
                Debug.WriteLine("Coucou lol");
            };
            //manager.GetTripAsync(startMeeting, endMeeting);
        }
Exemplo n.º 2
0
 public DateAndPositions(int id, DateTime date, Meeting start, Meeting end)
 {
     _id = id;
     _start = start;
     _end = end;
     _date = date;
 }
 public LocationFailCollectionDesign()
 {
     Meeting m = new Meeting() { IsLocationFail = true, Subject = "Company Meeting Microsoft 2013", DateTime = DateTime.Now };
     Meeting m2 = new Meeting() { IsLocationFail = true, Subject = " Dupont agence immo", DateTime = DateTime.Now.Date.AddHours(12) };
     _items.Add(new LocationFailDesign(m));
     _items.Add(new LocationFailDesign(m2));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Verifie les coordonnées géographiques d'un rendez-vous du Calendrier
        /// </summary>
        /// <param name="appointment">Rendez-vous</param>
        /// <remarks>Abonnez vous d'abord à l'évènement LocationChecked avant l'appel de cette méthode</remarks>
        public void CheckLocationAsync(Appointment appointment)
        {
            //Procédure de connexion et préparation de la requete
            GeocodeRequest request = new GeocodeRequest() { Credentials = new Credentials { ApplicationId = BingMapCredential.CREDENTIAL } };
            if (appointment.Location == null)
                return;
            request.Query = appointment.Location;
            GeocodeServiceClient service = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");

            //Lorsque bing map nous envoie une réponse
            service.GeocodeCompleted += (o, e) =>
            {
                Appointment a = e.UserState as Appointment;
                LocationCheckedEventArgs eventToSend = new LocationCheckedEventArgs();
                //Construction du Meeting qui sera envoyé en résultat
                Meeting m = new Meeting();
                m.Subject = a.Subject;
                m.DateTime = a.StartTime;
                m.Duration = (a.EndTime - a.StartTime).TotalMinutes;
                m.Address = a.Location;

                m.IsLocationFail = true;
                //Si dans le service bing map a trouvé les latitude et longitude de la requete
                if (e.Result != null)
                {
                    if (e.Result.Results.Any(obj => obj.Locations != null && obj.Locations.Any()) && e.Result.Results.Count > 0)
                    {
                        if (e.Result.Results.FirstOrDefault().Confidence == Confidence.High && !String.IsNullOrEmpty(e.Result.Results.FirstOrDefault().Address.Locality))
                        {
                            m.IsLocationFail = false;
                            m.Location.Latitude = e.Result.Results.FirstOrDefault().Locations.FirstOrDefault().Latitude;
                            m.Location.Longitude = e.Result.Results.FirstOrDefault().Locations.FirstOrDefault().Longitude;
                            m.City = e.Result.Results.FirstOrDefault().Address.Locality;
                        }
                    }

                }

                eventToSend.Meeting = m;
                //On notifie l'observateur (dans ce cas, la méthode GetAllMeetingsAsync)
                LocationChecked(this, eventToSend);
            };
            service.GeocodeAsync(request, appointment);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Verifie les coordonnées géographiques d'un rendez-vous du Calendrier
        /// </summary>
        /// <param name="appointment">Rendez-vous</param>
        /// <remarks>Abonnez vous d'abord à l'évènement LocationChecked avant l'appel de cette méthode</remarks>
        public void CheckLocationAsync(Appointment appointment)
        {
            //Procédure de connexion et préparation de la requete
            GeocodeRequest request = new GeocodeRequest() { Credentials = new Credentials { ApplicationId = BingMapCredential.CREDENTIAL } };
            if (appointment.Location == null)
                return;
            request.Query = appointment.Location;
            GeocodeServiceClient service = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
            
            //Lorsque bing map nous envoie une réponse
            service.GeocodeCompleted += (o, e) =>
            {
                //Construction du Meeting qui sera envoyé en résultat
                Meeting m = new Meeting();
                m.Subject = appointment.Subject;
                m.DateTime = appointment.StartTime;
                m.Duration = (appointment.EndTime - appointment.StartTime).TotalMinutes;

                //Si dans le service bing map a trouvé les latitude et longitude de la requete
                if (e.Result == null || 
                    e.Result.Results.Count < 0 || 
                    e.Result.Results.Any(obj => obj.Locations == null && obj.Locations.Any()))
                {
                    throw new Exception("Pas de géolocalisation possible");
                }

                m.IsLocationFail = true;
                if (e.Result.Results.FirstOrDefault().Confidence == Confidence.High)
                {
                    m.IsLocationFail = false;
                    m.Location.Latitude = e.Result.Results.FirstOrDefault().Locations.FirstOrDefault().Latitude;
                    m.Location.Longitude = e.Result.Results.FirstOrDefault().Locations.FirstOrDefault().Longitude;
                }

                LocationCheckedEventArgs eventToSend = new LocationCheckedEventArgs();
                eventToSend.Meeting = m;
                //On notifie l'observateur (dans ce cas, la méthode GetAllMeetingsAsync)
                LocationChecked(this, eventToSend);
            };
            service.GeocodeAsync(request);
        }
        public LocationCheckedEventArgs()
        {
            Meeting = new Meeting();

        }
Exemplo n.º 7
0
        /// <summary>
        /// Récupère tous les enfants d'un noeud de manière récursive
        /// </summary>
        /// <param name="unusedMeetings">Les rendez-vous pas encore référencés dans l'arbre</param>
        /// <param name="end"></param>
        /// <returns></returns>
        private List<Node> getChildren(List<Meeting> unusedMeetings, Meeting end)
        {
            List<Node> children = new List<Node>();

            foreach (var meeting in unusedMeetings)
            {
                Node node = new Node();
                node.MeetingRef = meeting;
                if (unusedMeetings.Count <= 1)
                {
                    Node endNode = new Node();
                    endNode.MeetingRef = end;
                    endNode.Parent = node;
                    node.Children.Add(endNode);
                    _pathes.Add(endNode);
                }
                else
                {
                    List<Meeting> unusedMeetingsbis = new List<Meeting>();
                    unusedMeetingsbis.AddRange(unusedMeetings);
                    unusedMeetingsbis.Remove(meeting);
                    node.Children.AddRange(getChildren(unusedMeetingsbis, end));
                }
                children.Add(node);
                foreach(var child in node.Children)
                    child.Parent = node;
            }

            //unusedMeetings = null;
            return children;
        }
Exemplo n.º 8
0
 public DateAndPositions(DateTime date, Meeting start, Meeting end)
 {
     _start = start;
     _end = end;
     _date = date;
 }
 public LocationFailDesign(Meeting meeting)
 {
     _meeting = meeting;
 }