protected override void OnCreate(Bundle bundle) { #region Android stuff base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Title = "SVB Console"; Monitor = FindViewById <TextView>(Resource.Id.MonitorView); ButtonRun = FindViewById <Button>(Resource.Id.MyButton); MainAct = this; ConfFile = new FileHelper(); ConfigEntity = Helper.Parse(ConfFile.Read()); MainDictionary = new Dictionary <string, string> { { "phone", ConfigEntity.SosPhone1 }, { "phone2", ConfigEntity.SosPhone2 }, { "sender", "0552395895" }, { "longitude", "0.000000" }, { "latitude", "0.000000" }, { "password", ConfigEntity.Password }, { "address", "NULL Address ! GPS ma rahch ykhdem" } }; #endregion #region Bluetooth stuff Bluetooth = new MyBluetooth("HC-05", 100); Bluetooth.PropertyChanged += DoOnBluetoothPropChanged; if (Bluetooth.Socket.IsConnected) { Monitor.Text += "\r\n Bluetooth HC-05 Connected !!! \r\n"; } else { Monitor.Text += "\r\n Ooops Bluetooth not Connected !!! \r\n"; } #endregion Monitor.MovementMethod = new Android.Text.Method.ScrollingMovementMethod(); Monitor.TextChanged += ClearMonitor; ButtonRun.Click += delegate { GetAdress(); }; InitializeLocationManager(); _smsManager = SmsManager.Default; }
public static ConfigSvb Parse(string message, char splitChar = '/') { if (!message.ToUpper().StartsWith("#CONFIG#")) { return new ConfigSvb { Password = "******", SosPhone1 = "+213552395895", SosPhone2 = "+213552395895" } } ; var conf = message.Remove(0, 8); var mainConf = new ConfigSvb { SosPhone1 = conf.Split(splitChar)[0], SosPhone2 = conf.Split(splitChar)[1], Password = conf.Split(splitChar)[2] }; return(mainConf); } }