private void gps_DeviceStateChanged(object sender, Microsoft.WindowsMobile.Samples.Location.DeviceStateChangedEventArgs args) { if (oldState == args.DeviceState.ServiceState) { return; } //switch (args.DeviceState.ServiceState) { // case GpsServiceState.Uninitialized: // case GpsServiceState.Unknown : // case GpsServiceState.Off: OnStateChanged(GpsState.Closed); // break; // case GpsServiceState.On: OnStateChanged(GpsState.Open); // break; // case GpsServiceState.Unloading : // case GpsServiceState.ShuttingDown:OnStateChanged(GpsState.Closing); // break; // case GpsServiceState.StartingUp: OnStateChanged(GpsState.Opening); // break; //} oldState = args.DeviceState.ServiceState; }
////http://www.highoncoding.com/Articles/532_How%20to%20access%20GPS%20in%20Windows%20Mobile%20devices.aspx //private delegate void MessageHandler(object sender, DeviceStateChangedEventArgs args); //private void UpdateControl(object sender, DeviceStateChangedEventArgs args) //{ // UpdateData(sender, args); // //control.Text = message; //} //========================================================================== void gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args) { ////http://www.highoncoding.com/Articles/532_How%20to%20access%20GPS%20in%20Windows%20Mobile%20devices.aspx //MessageHandler dev_change = UpdateControl; //device = args.DeviceState; //Invoke(dev_change, status, device); //Invoke(cu, tbGPSDeviceState, device.DeviceState.ToString()); //Invoke(cu, tbGPSServiceState, device.ServiceState.ToString()); // call the UpdateData method via the updateDataHandler so that we // update the UI on the UI thread try { BeginInvoke(updateDataHandler); } catch (NullReferenceException) { } }
void gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args) { device = args.DeviceState; // call the UpdateData method via the updateDataHandler so that we // update the UI on the UI thread Invoke(updateDataHandler); }
/// <summary> /// Zmena dat v zarizeni /// </summary> void gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args) { device = args.DeviceState; // call the UpdateData method via the updateDataHandler so that we update the UI on the UI thread try { Invoke(updateDataHandler); } catch (NullReferenceException) { } }
private void OnDeviceStateChanged(object sender, DeviceStateChangedEventArgs args) { string friendlyName = args.DeviceState == null || string.IsNullOrEmpty(args.DeviceState.FriendlyName) ? "unknown" : args.DeviceState.FriendlyName; Log.Info("LocationService.OnDeviceStateChanged", "FriendlyName={0}", friendlyName); if (StateChanged != null) { string deviceState = args.DeviceState == null ? "unknown" : args.DeviceState.DeviceState.ToString(); string serviceState = args.DeviceState == null ? "unknown" : args.DeviceState.ServiceState.ToString(); StateChanged(this, new StateEventArgs(friendlyName, deviceState, serviceState)); } }
void _gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args) { GpsDeviceState = args.DeviceState; PrintLn("GPS Device State Changed: " + GpsDeviceState); }