public static string Gps_collection() //H Sunartisi Gps_collection { string location; //Metabliti pou periexei plirofories topothesias string lat = "1"; //Arxikopoihsh metablitis pou periexei plirofories Latidute(1 gia na einai diaforo tou 0 prokeimenou na doume ama douleuei to gps) string lon = "1"; //Arxikopoihsh metablitis pou periexei plirofories Longitude(1 gia na einai diaforo tou 0 prokeimenou na doume ama douleuei to gps) Gps gps = null; //Dilosi metablitis tupou gps if (gps == null) { gps = new Gps(); //Dimiourgia neou gps gps.Open(); //Anoigma gps } else { gps.Close(); //Eidalos kleinoume to Gps gps = null; } GpsPosition position = gps.GetPosition(); //Pernoume tis plirofories apo to gps lat = position.Latitude.ToString(); //Apothikeuoume to Latitude lon = position.Longitude.ToString(); //Apothikeuoume to Longitude if (gps != null) gps.Close(); //Kleinoume ot gps location = lat + "|" + lon; //Ftiaxnoume to Sting (sumfona me ta protipo mas) return location; //To epistrefoume }
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); } } }
private void Main_Load(object sender, EventArgs e) { outlook = new OutlookSession(); gps = new Gps(); gps.Open(); #region SMS Interception Setup smsInterceptor = new MessageInterceptor(InterceptionAction.NotifyAndDelete); smsInterceptor.MessageCondition = new MessageCondition( MessageProperty.Sender, MessagePropertyComparisonType.Equal, "+14254448851"); smsInterceptor.MessageReceived += new MessageInterceptorEventHandler(smsInterceptor_MessageReceived); #endregion #region State Notification Setup umtsAvailable = new SystemState(SystemProperty.CellularSystemAvailableUmts); umtsAvailable.ComparisonType = StatusComparisonType.AnyChange; umtsAvailable.Changed += new ChangeEventHandler(umtsAvailable_Changed); detailsMenuItem.Enabled = ((int)umtsAvailable.CurrentValue & SN_CELLSYSTEMAVAILABLE_UMTS_BITMASK) != 0; #endregion }
/// <summary> /// Almacena ruta del archivo RUTAS.txt /// </summary> /// <param name="args">recibe datos desde takeData</param> /// <param name="main">recibe instancia de MainWindows</param> public NoAcces(Form1 main, params String[] args) { InitializeComponent(); this.main = main; //codigo,actual,n_medidor,verificador this.tCodeService.Text = args[0]; this.tReadActual.Text = args[1]; this.tN_medidor.Text = args[2]; this.tVerificador.Text = args[3]; this.tCodeService.Focus(); this._date_hour = new Date_hour(); #region comprueba que los codigos de servicio o rutas esten cargados if (this.main.cod_service_auto.Count < 1) { MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult dr = MessageBox.Show("No se cargo las rutas\n¿Desea cargarlas ahora?.", "", buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dr == DialogResult.Yes) { if (this.main.cargarRutas() > 0) { this.list_input_data = cid.read_file(this.main.filename); } /*else { this.list_input_data = new List<Input_data>(); Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376"); list_input_data.Add(_ID); }*/ } } else { this.list_input_data = cid.read_file(this.main.filename); /* this.list_input_data = new List<Input_data>(); Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376"); list_input_data.Add(_ID);*/ } #endregion #region configuracio y activacion gps objGps = this.main.objGps;// new Gps(); objGps.Close(); if (!objGps.Opened) { // objgps.DeviceStateChanged += new DeviceStateChangedEventHandler(gps_DeviceStateChange); objGps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged); objGps.Open(); } #endregion }
/// <summary> /// TakeData(main) /// </summary> /// <param name="main">recibe instancia de MainWindows</param> public TakeData(Form1 main) { InitializeComponent(); this.main = main; this._date_hour = new Date_hour(); this.tCodServ.Focus(); #region configuraciones visuales int anchoPanel = Convert.ToInt32(this.Width * 0.5); this.panel1.Width = anchoPanel; this.panel2.Width = anchoPanel; this.panel3.Width = anchoPanel; this.panel4.Width = anchoPanel; this.panel5.Width = anchoPanel; this.pSave.Width = anchoPanel; #endregion #region comprueba que existan los codigos de servicio o no if (this.main.cod_service_auto.Count < 1) { MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult dr = MessageBox.Show("Debe cargar las ahora.", "", buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dr == DialogResult.Yes) { if (this.main.cargarRutas() > 0) { this.list_input_data = cid.read_file(this.main.filename); } /*else { this.list_input_data = new List<Input_data>(); Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376"); list_input_data.Add(_ID); }*/ } } else { this.list_input_data = cid.read_file(this.main.filename); /* this.list_input_data = new List<Input_data>(); Input_data _ID = new Input_data("00001", "2", "000000004521", "000061869", "005", "0000194", "1.00376"); list_input_data.Add(_ID);*/ } #endregion #region configura y habilita gps objGps = this.main.objGps;//new Gps(); objGps.Close(); if (!objGps.Opened) { objGps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged); objGps.Open(); } #endregion }
/// <summary>Starts aquiring GPS data</summary> public override void Start() { gps.Open(); OnStateChanged(State); }
public void pollGPS() { gps = new Gps(); gps.Open(); gpsPosition = gps.GetPosition(); //while (!gpsPosition.LatitudeValid || !gpsPosition.LatitudeValid) //Thread.Sleep(500); gps.Close(); latitude = gpsPosition.Latitude; longitude = gpsPosition.Longitude; }