protected override void OnCreate(Bundle estado) { base.OnCreate(estado); Xamarin.Essentials.Platform.Init(this, estado); SetContentView(Resource.Layout.activity_main); vwima = FindViewById <ImageView>(Resource.Id.Mapa0); btini = FindViewById <Button> (Resource.Id.Iniciar); btfin = FindViewById <Button> (Resource.Id.Parar); btxml = FindViewById <Button> (Resource.Id.Xml); txcro = FindViewById <TextView> (Resource.Id.Crono); txbea = FindViewById <TextView> (Resource.Id.Beacons); vwfot = FindViewById <ImageView>(Resource.Id.Info_Foto); txfot = FindViewById <TextView> (Resource.Id.Txt_Foto); try { BluetoothAdapter BTAD = BTLE_Verificar(); SensorManager Sensores = (SensorManager)GetSystemService(Context.SensorService); IList <Sensor> Lsensores = Sensores.GetSensorList(SensorType.All); Sensor S_Bus = Sensores.GetDefaultSensor(SensorType.Orientation); //Sensor S_Mag = Sensores.GetDefaultSensor(SensorType.MagneticField); //Sensor S_Pro = Sensores.GetDefaultSensor(SensorType.Proximity); //Sensor S_Lux = Sensores.GetDefaultSensor(SensorType.Light); Sensores.RegisterListener(this, S_Bus, SensorDelay.Normal); // Sensor de Bussola //Sensores.RegisterListener ( this , S_Pro , SensorDelay.Normal); // Sensor de Proximity //Sensores.RegisterListener ( this , S_Lux , SensorDelay.Normal); // Sensor de Iluminamento //Sensores.RegisterListener ( this , S_Mag , SensorDelay.Normal); // Sensor de Campo Magnético btini.SetBackgroundColor(corazul); btfin.SetBackgroundColor(corazul); btxml.SetBackgroundColor(corazul); btini.Text = "ESCANEAR"; btfin.Text = "PARAR"; btxml.Text = "XML"; imagen = PNG_Fotos(MapasPNG[1][0], MapasPNG[1][1], vwima, vwfot); TextToSpeech.SpeakAsync("Sistema pronto.", Tts_Voz(0.25)); btes = new BES(); txfot.Text = "\n Lat: " + Latitude + "\n Lon: " + Longitud + "\n Alt: " + Altitude; XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(Raiz_Loc + "Mapa_Promenade_2019.xml"); XmlNodeList Lnodos = xmldoc.SelectNodes("/Mapa/Registro"); btini.Click += async delegate { await Processar_ON(Lnodos, escanea = true); }; btfin.Click += delegate { Processar_OF(escanea = false); }; btxml.Click += delegate { Processar_XML(Lnodos, escanea = false); }; } catch { } finally { bec_inform = "Aguardando...."; } }
public Canvas PNG_Marca(Bitmap imag, string form, BES.Localiza pos, int sc) { if (Modulo(sc, 30) == 0 && pos.Noco != "--") { TextToSpeech.SpeakAsync("Você está na sala " + pos.Nuco + ". No andar " + pos.Andar, Tts_Voz(0.15)); } string x = pos.X; string y = pos.Y; int diam = 40; float di = Modulo(sc * 10, diam); double x1 = 718 - Convert.ToDouble(x) / 1.5; double y1 = 407 - Convert.ToDouble(y) / 1.5; double x2 = x1 + di; double y2 = y1 + di; Paint pin = PNG_Pincel(new int[] { 255, 50, 50 }, sc); canvas = new Canvas(imag); switch (form.ToLower()) { case "c": canvas.DrawCircle((float)x1, (float)y1, di, pin); break; case "r": canvas.DrawRect((float)x1, (float)y1, (float)x2, (float)y2, pin); break; default: break; // default: canvas.DrawCircle((float)x1, (float)y1, di, pin); break; } string texto = "\n MAC: " + pos.Mac + "\n Bloco: " + pos.Bloco + "\n Andar: " + pos.Andar + "\n Num: " + pos.Nuco + " Nome: " + pos.Noco + "\n Area: " + pos.Area + " Pdir: " + pos.Pd + "\n Lat: " + Latitude + "\n Lon: " + Longitud + "\n Alt: " + Altitude; // Escreve no campo da interface txfot.Text = texto; vwima.Invalidate(); // forçar a atualização da imagem1 vwfot.Invalidate(); // forçar a atualização da imagem2 return(canvas); }