/// <summary> /// SerialPortのイベント受け取りに見せかけたTimerのTick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _serialPort_DataReceived(object sender, EventArgs e) { try { Random rnd = new Random(); int deg = rnd.Next(359); double radian = deg * 3.141592 / 180.0; double sin = Math.Sin(radian); double cos = Math.Cos(radian); this.Ido += (sin / 1000); this.Keido += (cos / 1000); Dictionary <String, String> eventData = new Dictionary <string, string>(); eventData.Add("Enable", "true"); eventData.Add("Time", "0"); eventData.Add("Latitude", this.Ido.ToString()); eventData.Add("NS", "N"); eventData.Add("Longitude", this.Keido.ToString()); eventData.Add("EW", "E"); eventData.Add("Quality", "test"); eventData.Add("Satellites", "test"); eventData.Add("GeoidHeight", "test");; GpsEmuReadEventArgs gpsEvent = new GpsEmuReadEventArgs(eventData); OnGpsEmuDataReceive(gpsEvent); } catch (Exception) { } }
/// <summary> /// イベントハンドラを発生させる為に呼ぶメソッド /// </summary> /// <param name="e"></param> protected virtual void OnGpsEmuDataReceive(GpsEmuReadEventArgs e) { GpsEmuDataReceive(this, e); }