コード例 #1
0
 private void MyMap_Loaded(object sender, RoutedEventArgs e)
 {
     MyMap.AddPushpin(new Windows.Devices.Geolocation.BasicGeoposition()
     {
         Latitude = _myClinic._Latitude, Longitude = _myClinic._Longitude
     }, "1");
 }
コード例 #2
0
        private void AddPushpinsBtn_Clicked(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var locs = GetSamplePoints();

            for (int i = 0; i < locs.Count; i++)
            {
                MyMap.AddPushpin(locs[i], (i + 1).ToString());
            }
        }
コード例 #3
0
ファイル: Page5.xaml.cs プロジェクト: RodolfoAndrade/S2B
        public Page5()
        {
            this.InitializeComponent();
            MyMap.SetView(new BasicGeoposition()
            {
                Latitude = -8.0464493, Longitude = -34.9324882
            }, 11);

            for (int i = 0; i < Page1.itens.Count; i++)
            {
                if (Page1.itens[i].Local.Altitude != 0)
                {
                    MyMap.AddPushpin(Page1.itens[i].Local, Page1.itens[i].NomeLocal);
                }
            }
        }
コード例 #4
0
        public findaPhysioSearch()
        {
            this.InitializeComponent();

            MyMap.MapServiceToken = "AkaRVlcfNdzPJWi3QI3iQOr_mcDepgQZutsQn-rPDa8lpe-Bs-9yV5E9dHpOBDb9";
            MyMap.SetView(new Windows.Devices.Geolocation.BasicGeoposition()
            {
                Latitude = 53.713442, Longitude = -1.0747807
            }, 18);

            DrawerLayout.InitializeDrawerLayout(); //Intialize drawer
            string[] menuItems = new string[11] {
                "Home", "About Us", "Contact", "Search", "How FindaPhysio Works", "Physiotherapists", "Aritcle Of Week", "Blog Of Week", "Podcast Of Week", "Jobs", "Courses"
            }; ListMenuItems.ItemsSource = menuItems.ToList();                                                                                                                                                                                                      //Set Menu list



            _clinics.Add(new Clinics()
            {
                _id = "1", _WebSite = "www.Find-a-Physio.co.uk", _BookUrl = "http://www.find-a-physio.co.uk/Home/online-booking", _Name = "Physiotherapy at Home", _Latitude = 53.713442, _Longitude = -1.0747807, _Address1 = "The Cottage, Main St", _Town = "Selby", _Telephone = "07761 139883", _Speciaity = "Musculoskeletal", _Postcode = "YO8 8QT", _position = 1
            });
            _clinics.Add(new Clinics()
            {
                _id = "2", _WebSite = "www.Find-a-Physio.co.uk", _BookUrl = "http://www.find-a-physio.co.uk/Home/online-booking", _Name = "Bodyworx Physio", _Latitude = 53.785101, _Longitude = -1.0670279, _Address1 = "Watendlath", _Telephone = "07783 881082", _Postcode = "YO8 4PH", _Speciaity = "Musculoskeletal", _position = 2
            });
            _clinics.Add(new Clinics()
            {
                _id = "3", _WebSite = "www.Find-a-Physio.co.uk", _BookUrl = "http://www.find-a-physio.co.uk/Home/online-booking", _Name = "Rosemary Walmsley", _Latitude = 54.196454, _Longitude = -1.4338279, _Address1 = "80 York Rd", _Telephone = "01845 446410 ", _Postcode = "YO7 4SQ", _Speciaity = "Musculoskeletal", _position = 3
            });

            MyMap.AddPushpin(new Windows.Devices.Geolocation.BasicGeoposition()
            {
                Latitude = 53.713442, Longitude = -1.0747807
            }, "1");
            MyMap.AddPushpin(new Windows.Devices.Geolocation.BasicGeoposition()
            {
                Latitude = 53.785101, Longitude = -1.0670279
            }, "2");
            MyMap.AddPushpin(new Windows.Devices.Geolocation.BasicGeoposition()
            {
                Latitude = 54.196454, Longitude = -1.4338279
            }, "3");

            searchList.ItemsSource = _clinics;
        }
        private void data_Rec(XComm.Sample.Message Data)
        {
            try
            {
                this.ZoneId   = Data.ZoneId;
                this.ZoneName = Data.ZoneName;
                LocationCollection temp_locationCollection = new LocationCollection();
                for (int i = 0; i < Data.ZoneLocation.Count; i++)
                {
                    Location temp = new Location(Data.ZoneLocation[i].Latitude, Data.ZoneLocation[i].Longitude);
                    temp_locationCollection.Add(temp);
                }
                ZoneLocation = temp_locationCollection;

                this.Temperature   = Data.Temperature;
                this.Pressure      = Data.Pressure;
                this.Humidity      = Data.Humidity;
                this.FireStatus    = Data.FireStatus;
                this.Fire_Location = new Location(Data.Fire_Location.Latitude, Data.Fire_Location.Longitude);
                this.Rain1_Status  = Data.Rain1_Status;



                LocationCollection temp_locationCollection1 = new LocationCollection();
                for (int i = 0; i < Data.Rain1_Location.Count; i++)
                {
                    Location temp = new Location(Data.Rain1_Location[i].Latitude, Data.Rain1_Location[i].Longitude);
                    temp_locationCollection1.Add(temp);
                }
                Rain1_Location = temp_locationCollection1;



                //this.Rain1_Location = Data.Rain1_Location;
                this.Rain2_Status = Data.Rain2_Status;
                LocationCollection temp_locationCollection2 = new LocationCollection();

                for (int i = 0; i < Data.Rain2_Location.Count; i++)
                {
                    Location temp = new Location(Data.Rain2_Location[i].Latitude, Data.Rain2_Location[i].Longitude);
                    temp_locationCollection2.Add(temp);
                }
                Rain2_Location = temp_locationCollection2;
                //this.Rain2_Location = Data.Rain2_Location;

                zone1_name.Dispatcher.BeginInvoke((Action) delegate
                {
                    zone1_name.Content = ZoneName;
                });

                lbl_temp.Dispatcher.BeginInvoke((Action) delegate
                {
                    lbl_temp.Content = Temperature;
                });

                lbl_pressure.Dispatcher.BeginInvoke((Action) delegate
                {
                    lbl_pressure.Content = Pressure;
                });
                lbl_humidity.Dispatcher.BeginInvoke((Action) delegate
                {
                    lbl_humidity.Content = Humidity;
                });


                myMap.Dispatcher.BeginInvoke((Action) delegate
                {
                    // for drawing zone area
                    NewMap.addNewPolyline(ZoneLocation);
                    //for zone 1 fire
                    if (Data.FireStatus == true && flag_task == false)
                    {
                        if (flag_task == false)
                        {
                            //task_fire.Start();
                        }
                        NewMap.AddLabel(Fire_Location, "fire");
                        NewMap.AddPushpin(Fire_Location);
                    }
                    else if (flag_task == true)
                    {
                        simpleSound.Stop();
                        flag_task = false;
                    }
                    //for zone 1 rain
                    if (Data.Rain1_Status == true)
                    {
                        NewMap.addNewPolygon(Rain1_Location);
                    }
                    if (Data.Rain2_Status == true)
                    {
                        NewMap.addNewPolygon(Rain2_Location);
                    }

                    //-------------------------------------------------------------------------------------------------
                    myMap.Children.Clear();
                    //------------------------------------------------------------------------------------------------
                    if (Data.Rain1_Status == true)
                    {
                        NewMap.addNewPolygon(Rain1_Location);
                    }
                    if (Data.Rain2_Status == true)
                    {
                        NewMap.addNewPolygon(Rain2_Location);
                    }
                    NewMap.addNewPolyline(ZoneLocation);
                    if (Data.FireStatus == true)
                    {
                        NewMap.AddLabel(Fire_Location, "fire");
                        NewMap.AddPushpin(Fire_Location);
                    }
                });
            }
            catch (Exception ex) {  }
            Thread.Sleep(1000);
        }
        private void CommunicationPort_DataReceivedEventHandler(string Data)
        {
            try
            {
                //split the serial port data
                string[] sd = Data.Split('|');

                if (sd.Length == 7)
                {
                    task_fire = new Task(onFire);

                    if (currentDate.Hour == DateTime.Now.Hour)
                    {
                        DatabaseOperation.Connect();
                        if (sd[0] != "")
                        {
                            DatabaseOperation.InsertUpdateDelete("INSERT INTO Temp VALUES('" + tempSensorId + "','" + zoneId + "','" + sd[0] + "','" + DateTime.Now + "') ");
                        }
                        DatabaseOperation.Disconnect();
                        DatabaseOperation.Connect();
                        if (sd[1] != "")
                        {
                            DatabaseOperation.InsertUpdateDelete("INSERT INTO Pressure VALUES('" + presSensorId + "','" + zoneId + "','" + sd[1] + "','" + DateTime.Now + "') ");
                        }
                        DatabaseOperation.Disconnect();
                        DatabaseOperation.Connect();
                        if (sd[2] != "")
                        {
                            DatabaseOperation.InsertUpdateDelete("INSERT INTO Humidity VALUES('" + humSensorId + "','" + zoneId + "','" + sd[2] + "','" + DateTime.Now + "') ");
                        }
                        DatabaseOperation.Disconnect();
                        currentDate = currentDate.AddHours(2.0);
                    }
                    Message1.Temperature = sd[0];
                    Message1.Pressure    = sd[1];
                    Message1.Humidity    = sd[2];


                    //fire
                    if (sd[3] == "1")
                    {
                        //border label
                        lbl_firestatus.Dispatcher.BeginInvoke((Action) delegate
                        {
                            lbl_firestatus.Content = "Fire";
                        });

                        //playing alarm
                        if (flag_task == false)
                        {
                            task_fire.Start();
                        }

                        myMap.Dispatcher.BeginInvoke((Action) delegate
                        {
                            NewMap.AddLabel(new Location(21.182782, 72.808912), "fire");
                            NewMap.AddPushpin(new Location(21.182782, 72.808912));
                        });

                        Message1.FireStatus = true;
                    }
                    else if (flag_task == true)
                    {
                        //border label
                        lbl_firestatus.Dispatcher.BeginInvoke((Action) delegate
                        {
                            lbl_firestatus.Content = "-";
                        });

                        //stop sound
                        simpleSound.Stop();
                        flag_task = false;

                        Message1.FireStatus = false;
                    }

                    //rain

                    if (sd[4] == "1")
                    {
                        //border lbl
                        lbl_rain1status.Dispatcher.BeginInvoke((Action) delegate
                        {
                            lbl_rain1status.Content = "rain1";
                        });
                        myMap.Dispatcher.BeginInvoke((Action) delegate
                        {
                            NewMap.addNewPolygon(zone1_rain1);
                        });
                        Message1.Rain1_Status = true;
                    }
                    else if (sd[4] == "0")
                    {
                        lbl_rain1status.Dispatcher.BeginInvoke((Action) delegate
                        {
                            lbl_rain1status.Content = "-";
                        });



                        Message1.Rain1_Status = false;
                    }
                    if (sd[5] == "1")
                    {
                        lbl_rain2status.Dispatcher.BeginInvoke((Action) delegate
                        {
                            lbl_rain2status.Content = "rain2";
                        });
                        myMap.Dispatcher.BeginInvoke((Action) delegate
                        {
                            NewMap.addNewPolygon(zone1_rain2);
                        });

                        Message1.Rain2_Status = true;
                    }
                    else if (sd[5] == "0")
                    {
                        lbl_rain2status.Dispatcher.BeginInvoke((Action) delegate
                        {
                            lbl_rain2status.Content = "-";
                        });
                        Message1.Rain2_Status = false;
                    }

                    lbl_temp.Dispatcher.BeginInvoke((Action) delegate
                    {
                        lbl_temp.Content = sd[0];
                    });

                    lbl_pressure.Dispatcher.BeginInvoke((Action) delegate
                    {
                        lbl_pressure.Content = sd[1];
                    });
                    lbl_humidity.Dispatcher.BeginInvoke((Action) delegate
                    {
                        lbl_humidity.Content = sd[2];
                    });



                    myMap.Dispatcher.BeginInvoke((Action) delegate
                    {
                        //for zone area
                        NewMap.addNewPolyline(zone1);

                        //map clear--------------------------------------------------------------------------------------------
                        myMap.Children.Clear();
                        //-----------------------------------------------------------------------------------------------------

                        NewMap.addNewPolyline(zone1);
                    });


                    if (sd[3] == "1")
                    {
                        myMap.Dispatcher.BeginInvoke((Action) delegate
                        {
                            NewMap.AddLabel(new Location(21.182782, 72.808912), "fire");
                            NewMap.AddPushpin(new Location(21.182782, 72.808912));
                        });
                    }
                    if (sd[4] == "1")
                    {
                        myMap.Dispatcher.BeginInvoke((Action) delegate
                        {
                            NewMap.addNewPolygon(zone1_rain1);
                        });
                    }

                    if (sd[5] == "1")
                    {
                        myMap.Dispatcher.BeginInvoke((Action) delegate
                        {
                            NewMap.addNewPolygon(zone1_rain2);
                        });
                    }


                    Client_main.Send(Message1);
                }
            }

            catch (Exception ex)
            {}
        }