예제 #1
0
        private void menuItemGPSenabled_Click(object sender, EventArgs e)
        {
            menuItemGPSenabled.Checked = !menuItemGPSenabled.Checked;

            if (!menuItemGPSenabled.Checked)
            {
                if (gps.Opened)
                {
                    gps.Close();
                    SetOffGPSPower();
                }

                count     = 0;
                countReal = 0;
                Total     = 0;
                {
                    TimeUTC = null;
                    Lat     = null;
                    Lng     = null;
                    Delta   = 0;
                }
                lock (Satellites)
                {
                    Satellites.Clear();
                    Satellites.TrimExcess();
                }

                if (Controls.Contains(pageGps))
                {
                    pageGps.panelSignals.Invalidate();
                }

                TryCommitData();

                gpsPos.Pen.Color = Color.Blue;
            }
            else // start tracking
            {
                gpsPos.Pen.Color = Color.Red;
                gpsPos.IsVisible = true;

                if (!gps.Opened)
                {
                    gps.Open();
                    SetOnGPSPower();
                }
            }
        }
예제 #2
0
        public GpsConnector(Form1 parentForm)
        {
            //signed parent to gpsConnector
            this.parentForm = parentForm;

            //initialize gps hardware handler
            _gps = Hardware.Hardware.GetGpsHandler();

            //initialize list to contain position info
            _tmpPositionList = new List <GpsPosition>();
            //initialize satelliteView to contain satellite info
            satView = new SatelliteView();

            //if gps hardware exist and gpsIntermediateDriver exist
            //initialize gps connection and events
            if (_gps.hasGPS)
            {
                gps = new Gps();

                gpsEvents = new GpsEvents(this);

                if (!gps.Opened)
                {
                    gps.Open();
                    gpsEvents.newLocationReceived += new EventHandler <LocationChangedEventArgs>(gpsEvents.Form1_NewLocationReceived);

                    gps.LocationChanged += new LocationChangedEventHandler(gpsEvents.gps_LocationChanged);
                }
            }
        }
예제 #3
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     if (gps != null && !gps.Opened)
     {
         gps.Open();
     }
     btnNewTrack_Click(null, null);
 }
예제 #4
0
 //open gps
 public void openGps()
 {
     if (!gps.Opened)
     {
         gps.Open();
     }
     parentForm.gpsStatus = Form1.GpsStatus.GPS_OPEN;
 }
예제 #5
0
파일: Form1.cs 프로젝트: shahbazp12/Samples
        private void startGpsMenuItem_Click(object sender, EventArgs e)
        {
            if (!gps.Opened)
            {
                gps.Open();
            }

            startGpsMenuItem.Enabled = false;
            stopGpsMenuItem.Enabled  = true;
        }
예제 #6
0
        private void StartGPS()
        {
            if (!gps.Opened)
            {
                gps.Open();
                status.Text += "StartGPS()...\r\n";
            }

            mnuGPSStart.Enabled = false;
            mnuGPSStop.Enabled  = true;
        }
예제 #7
0
        private void miOnGPS_Click(object sender, EventArgs e)
        {
            if (!gps.Opened)
            {
                gps.Open();
            }

            miOnGPS.Enabled  = false;
            miOffGPS.Enabled = true;
            miGetLoc.Enabled = true;
        }
예제 #8
0
 private void GpsOpen()
 {
     if (_gps.Opened)
     {
         PrintLn("GPS already opened");
     }
     else
     {
         _gps.Open();
         PrintLn("Opened GPS");
     }
 }
예제 #9
0
 private void menuItemGPS_Click(object sender, EventArgs e)
 {
     statusBar1.Visible = true;
     statusBar1.Text    = "Procurando Satélites, aguarde";
     if (!gps.Opened)
     {
         gps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged);
         gps.Open();
     }
     else
     {
         gps.LocationChanged -= gps_LocationChanged;
         gps.Close();
     }
 }
예제 #10
0
        private void GPSMenuItem_Click(object sender, EventArgs e)
        {           

            if (!gps.Opened)
            {

                updateDataHandler = new EventHandler(UpdateData);
                gps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged); // location changed is an event
                gps.Open();           
                GPSMenuItem.Text = "Turn Gps Off";
            }
            else
            {
               
                gps.LocationChanged -= gps_LocationChanged;
                gps.Close();
                GPSMenuItem.Text = " Turn Gps On";
                Reminder_Occurs = false;
              
            }
        }