public async void Validate(string Email, string Password) { var ServiceClient = new SAL.ServiceClient(); var Result = await ServiceClient.AutenticateAsync( Email, Password); if (Result.Status == Entities.Status.Success) { var ActivityIntent = new Android.Content.Intent(this, typeof(EvidencesActivity)); ActivityIntent.PutExtra("Token", Result.Token); ActivityIntent.PutExtra("FullName", Result.FullName); StartActivity(ActivityIntent); } else { AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificación"); Alert.SetIcon(Resource.Drawable.Icon); Alert.SetMessage( $"{Result.Status}\n{Result.FullName}\n{Result.Token}"); Alert.SetButton("Ok", (s, ev) => { }); Alert.Show(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); string dbPath; List <string> spinList = new List <string>(); string spinSelected = ""; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //move db from assets to file system dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "TidesDB.s3db"); if (!File.Exists(dbPath)) { using (Stream inStream = Assets.Open("TidesDB.s3db")) using (Stream outStream = File.Create(dbPath)) inStream.CopyTo(outStream); } //create object from db layer for population TideDbAccess tideDb = new TideDbAccess(dbPath); //place locales from db into spinner value list and update spinner with values foreach (TideDB tide in tideDb.RetrieveLocales()) { spinList.Add(tide.Locale); if (spinSelected == "") { spinSelected = tide.Locale; } } Spinner spinner = FindViewById <Spinner>(Resource.Id.SpinSelect); var spinCont = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, spinList); spinCont.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = spinCont; //store selected item selected spinner.ItemSelected += (sender, e) => { spinSelected = spinner.GetItemAtPosition(e.Position).ToString(); }; //datepicker var datePicker = FindViewById <DatePicker>(Resource.Id.datePick); datePicker.MinDate = Long.ParseLong(ConvertToUnixTimestamp(tideDb.RetrieveDates(-1)[0].Date).ToString()); datePicker.MaxDate = Long.ParseLong(ConvertToUnixTimestamp(tideDb.RetrieveDates(1)[0].Date).ToString()); //do it to it!! var button = FindViewById <Button>(Resource.Id.submit); button.Click += delegate { var go = new Android.Content.Intent(this, typeof(TideList)); go.PutExtra("Location", spinSelected); go.PutExtra("Date", datePicker.DateTime.ToString("yyyy/MM/dd")); StartActivity(go); }; }
private void SaveButton_Click(object sender, System.EventArgs e) { var msg = saveMessage(); Android.Content.Intent alarmIntent = new Android.Content.Intent(this, typeof(SmsAlarmReciever)); alarmIntent.PutExtra("recieverPhoneNumber", msg.RecieverNumber); alarmIntent.PutExtra("recieverMessage", msg.MessageContent); alarmIntent.PutExtra("messageSendDate", msg.Date.ToString()); //var triggerTime = msg.Date.AddHours(1).Subtract(System.DateTime.UtcNow).TotalMilliseconds; //var x = System.Convert.ToInt64(triggerTime); //Java.Lang.JavaSystem.tim var timeDifference = System.Convert.ToInt64(msg.Date.Subtract(System.DateTime.Now).TotalMilliseconds); PendingIntent pendingIntent = PendingIntent.GetBroadcast(this, 0, alarmIntent, PendingIntentFlags.UpdateCurrent); AlarmManager alarmManager = (AlarmManager)GetSystemService(AlarmService); alarmManager.SetExact(AlarmType.RtcWakeup, Java.Lang.JavaSystem.CurrentTimeMillis() + timeDifference, pendingIntent); //showNotification(msg); var intent = new Android.Content.Intent(this, typeof(MessageList)); StartActivity(intent); }
public static void SaveFile(string content) { #if __ANDROID__ //Email or cloud Android.Content.Intent intent = new Android.Content.Intent(Android.Content.Intent.ActionSend); intent.SetType("plain/text"); intent.PutExtra(Android.Content.Intent.ExtraSubject, "Logging"); intent.PutExtra(Android.Content.Intent.ExtraText, content); Forms.Context.StartActivity(intent); #elif __IOS__ //Email or cloud #else //Anywhere var documentpicker = new Windows.Storage.Pickers.FileSavePicker(); documentpicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary; documentpicker.FileTypeChoices.Add("Comma seperated files.", new List <string>() { ".csv" }); documentpicker.SuggestedFileName = "Logfile"; documentpicker.PickSaveFileAsync().AsTask().ContinueWith((Task <Windows.Storage.StorageFile> resutl) => { var file = resutl.Result; Windows.Storage.FileIO.WriteTextAsync(file, content); }); #endif }
private async void mainInsertBTN_ClickAsync(object sender, EventArgs e) { int n = 0; try { SqlConnection connection = new SqlConnection( "Data Source = smartclosetdatabase.database.windows.net; Initial Catalog = smartclosetdb; User ID = HAGATZAR; Password = SCAMO236###; Connect Timeout = 30; Encrypt = True; TrustServerCertificate = False; ApplicationIntent = ReadWrite; MultiSubnetFailover = False;"); connection.Open(); SqlCommand command = new SqlCommand("(select min(CELLNUM) from (SELECT CELLNUM FROM CELLS except (SELECT CELLNUM FROM ITEMS WHERE username = '******' and incloset = 1)) diff)", connection); SqlDataReader reader = command.ExecuteReader(); Console.WriteLine("test1:{0}", reader); if (reader.HasRows) { reader.Read(); n = reader.GetInt32(0); } else { Console.WriteLine("No rows found."); } reader.Close(); } catch (SqlException err) { // Console.WriteLine(err); //todo } await BluetoothHandler.sendAsync(n - 1); Android.Content.Intent insert = new Android.Content.Intent(this, typeof(insertMainActivity)); insert.PutExtra("username", username); insert.PutExtra("currCell", n); StartActivity(insert); }
private async void BtnValidate_Click(object sender, System.EventArgs e) { ServiceClient sc = new ServiceClient(); ResultInfo resulInfo = new ResultInfo(); EditText email = FindViewById <EditText>(Resource.Id.editTextEmail); EditText password = FindViewById <EditText>(Resource.Id.editTextPassword); resulInfo = await sc.AutenticateAsync(email.Text, password.Text); if (resulInfo.Status == Status.Success) { var MicrosoftEvidence = new LabItem() { DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), Email = email.Text, Lab = "Hack@Home" }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); intent.PutExtra("Token", resulInfo.Token); intent.PutExtra("FullName", resulInfo.FullName); StartActivity(intent); } else { MuestraMensaje("No se pudo autenticar \n en TI Capacitación."); } }
private async void ValidateButton_Click(object sender, System.EventArgs e) { var email = emailEditText.Text; var password = passwordEditText.Text; emailEditText.Enabled = false; passwordEditText.Enabled = false; var serviceClient = new ServiceClient(); var result = await serviceClient.AutenticateAsync(email, password); if (result.Status == Status.Success || result.Status == Status.AllSuccess) { string deviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); var microsotClient = new MicrosoftServiceClient(); await microsotClient.SendEvidence(new LabItem { DeviceId = deviceId, Email = email, Lab = "Hack@Home" }); var newIntent = new Android.Content.Intent(this, typeof(EvidenceActivity)); newIntent.PutExtra("FullName", result.FullName); newIntent.PutExtra("Token", result.Token); StartActivity(newIntent); emailEditText.Text = string.Empty; passwordEditText.Text = string.Empty; emailEditText.Enabled = true; passwordEditText.Enabled = true; } else { int messageId; switch (result.Status) { case Status.InvalidUserOrNotInEvent: messageId = Resource.String.InvalidUserOrNotInEvent_Authentication; break; case Status.OutOfDate: messageId = Resource.String.OutOfDate_Authentication; break; case Status.Error: default: messageId = Resource.String.Error_Authentication; break; } new Android.App.AlertDialog.Builder(this) .SetMessage(this.Resources.GetString(messageId)) .SetPositiveButton("OK", delegate { }) .Show(); emailEditText.Enabled = true; passwordEditText.Enabled = true; } }
/// <summary> /// Open the EditMetadata page for a song. /// </summary> /// <param name="item"></param> /// <param name="queuePosition">Set this to a position of the song in the queue, it will update the queue slot after the edit.</param> public static void EditMetadata(Song item, int queuePosition = -1) { item = CompleteItem(item); Intent intent = new Intent(Application.Context, typeof(EditMetaData)); intent.PutExtra("Song", item.ToString()); intent.PutExtra("Position", queuePosition); MainActivity.instance.StartActivity(intent); }
/// <summary> /// Gets the platform Native UI (Android - [Chrome] Custom Tabs). /// </summary> /// <returns> /// The platform Native UI (non-embeded/non-integrated Browser Control/Widget/View (WebView). /// Android.Support.CustomTabs.CustomTabsIntent /// </returns> /// <see cref="https://components.xamarin.com/gettingstarted/xamandroidsupportcustomtabs"/> protected virtual AuthenticateUIType GetPlatformUINative(UIContext context) { AuthenticateUIType ui = new AuthenticateUIType(context, typeof(WebAuthenticatorNativeBrowserActivity)); ui.PutExtra("ClearCookies", ClearCookiesBeforeLogin); var state = new WebAuthenticatorNativeBrowserActivity.State { Authenticator = this, }; ui.PutExtra("StateKey", WebAuthenticatorNativeBrowserActivity.StateRepo.Add(state)); return(ui); }
private async void Validate() { ServiceClient ServiceClient = new ServiceClient(); var emailEditText = FindViewById <EditText>(Resource.Id.editTextEmail); var passwordEditText = FindViewById <EditText>(Resource.Id.editTextPassword); ResultInfo Result = await ServiceClient.AutenticateAsync(emailEditText.Text, passwordEditText.Text); var MicrosoftEvidence = new LabItem { Email = emailEditText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); // Creamos un dialogo para mostrar el resultado de la validacion Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la Validación"); Alert.SetIcon(Resource.Drawable.hath_icon); // Mostramos un mensaje personalizado string message; if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { message = $"Bienvenido {Result.FullName}"; } else { message = $"Error:\n{Result.Status}\n{Result.FullName}"; } // Finalizamos el dialogo y al precionar el boton OK si todo fue satisfactorio pasamos a la otra actividad Alert.SetMessage(message); Alert.SetButton("Ok", (s, ev) => { if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { var Intent = new Android.Content.Intent(this, typeof(EvidenceListActivity)); Intent.PutExtra("FullName", Result.FullName); Intent.PutExtra("Token", Result.Token); StartActivity(Intent); } }); Alert.Show(); }
private void SelectedLab(object sender, AdapterView.ItemClickEventArgs e) { var labID = _adapter.GetItemId(e.Position); var Intent = new Android.Content.Intent(this, typeof(EvidenceDetailActivity)); var Evidence = _data.Data.Find(x => x.EvidenceID == labID); Intent.PutExtra("EvidenceTitle", Evidence.Title); Intent.PutExtra("EvidenceStatus", Evidence.Status); Intent.PutExtra("LabID", labID); Intent.PutExtra("Token", _token); Intent.PutExtra("Name", _name); StartActivity(Intent); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var BtnValidate = FindViewById <Button>(Resource.Id.buttonValidate); var UserMail = FindViewById <EditText>(Resource.Id.EditTextEmail); var UserPass = FindViewById <EditText>(Resource.Id.EditTextPassword); BtnValidate.Click += async(object sender, System.EventArgs e) => { BtnValidate.Enabled = false; string StudentEmail = UserMail.Text; string StudentPassword = UserPass.Text; if (!string.IsNullOrEmpty(StudentEmail) && !string.IsNullOrEmpty(StudentPassword)) { ServiceClient ServiceClient = new ServiceClient(); ResultInfo Result = await ServiceClient.AutenticateAsync(StudentEmail, StudentPassword); if (Result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = StudentEmail, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; MicrosoftServiceClient MicrosoftService = new MicrosoftServiceClient(); await MicrosoftService.SendEvidence(MicrosoftEvidence); var EvidenceIntent = new Android.Content.Intent(this, typeof(EvidenceActivity)); EvidenceIntent.PutExtra("Token", Result.Token); EvidenceIntent.PutExtra("UserName", Result.FullName); StartActivity(EvidenceIntent); UserMail.Text = string.Empty; UserPass.Text = string.Empty; } else { string ErrorMessageAuth = GetString(Resource.String.ErrorLogin); var ErrorDialog = new AlertDialog.Builder(this); ErrorDialog.SetMessage(ErrorMessageAuth); ErrorDialog.SetNegativeButton(GetString(Resource.String.Ok), delegate { }); ErrorDialog.Show(); } BtnValidate.Enabled = true; } }; }
/// <summary> /// Gets the platform UI (Android - WebView). /// </summary> /// <returns> /// The platform Native UI (embeded/integrated Browser Control/Widget/View (WebView)). /// Android.Support.CustomTabs.CustomTabsIntent /// </returns> /// <see cref="https://components.xamarin.com/gettingstarted/xamandroidsupportcustomtabs"/> protected AuthenticateUIType GetPlatformUIEmbeddedBrowser(UIContext context) { // Embedded Browser - Deprecated AuthenticateUIType ui = new AuthenticateUIType(context, typeof(WebAuthenticatorActivity)); ui.PutExtra("ClearCookies", ClearCookiesBeforeLogin); var state = new WebAuthenticatorActivity.State { Authenticator = this, }; ui.PutExtra("StateKey", WebAuthenticatorActivity.StateRepo.Add(state)); return(ui); }
// Codigo de Luis Beltran protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var edtCorreo = FindViewById <EditText>(Resource.Id.edtCorreo); var edtPassword = FindViewById <EditText>(Resource.Id.edtPassword); var ValidateButton = FindViewById <Button>(Resource.Id.ValidateButton); ValidateButton.Click += async(s, e) => { try { var ServiceClient = new ServiceClient(); string StudentEmail = edtCorreo.Text; string Password = edtPassword.Text; var Result = await ServiceClient.AutenticateAsync(StudentEmail, Password); if (Result.Status == Status.Success) { var MicrosoftServiceClient = new MicrosoftServiceClient(); LabItem item = new LabItem() { DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), Email = StudentEmail, Lab = "Hack@Home" }; await MicrosoftServiceClient.SendEvidence(item); var Intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); Intent.PutExtra("token", Result.Token); Intent.PutExtra("fullname", Result.FullName); Intent.PutExtra("email", StudentEmail); StartActivity(Intent); } else { Toast.MakeText(this, $"Error: {Result.Status}", ToastLength.Long); } } catch (System.Exception ex) { } }; }
void diagSignUp_onSignUpComplete(object sender, OnSignUpEvent e) { //StartActivity(typeof(SuscessfulRegistration)); //txtUsername.Text = e.UserName; //txtEmail.Text = e.Email; //txtPassword.Text = e.Password; var activity2 = new Android.Content.Intent(this, typeof(SuscessfulRegistration)); activity2.PutExtra("userData", "Your Name: " + e.UserName + " Your eMail: " + e.Email); activity2.PutExtra("userName", e.UserName); activity2.PutExtra("userEmail", e.Email); StartActivity(activity2); }
/// <summary> /// Gets the platform Native UI (Android - [Chrome] Custom Tabs). /// </summary> /// <returns> /// The platform Native UI (non-embeded/non-integrated Browser Control/Widget/View (WebView). /// Android.Support.CustomTabs.CustomTabsIntent /// </returns> /// <see cref="https://components.xamarin.com/gettingstarted/xamandroidsupportcustomtabs"/> protected virtual AuthenticateUIType GetPlatformUINative(UIContext context) { System.Uri uri_netfx = this.GetInitialUrlAsync().Result; AuthenticateUIType ui = new AuthenticateUIType(context, typeof(WebAuthenticatorNativeBrowserActivity)); ui.PutExtra("ClearCookies", ClearCookiesBeforeLogin); var state = new WebAuthenticatorNativeBrowserActivity.State { Uri = uri_netfx, Authenticator = this }; ui.PutExtra("StateKey", WebAuthenticatorNativeBrowserActivity.StateRepo.Add(state)); return(ui); }
private void startMotionTracking() { Intent startmotiontracking = new Intent(this, typeof(com.projecttango.motiontrackingcsharp.MotionTracking)); startmotiontracking.PutExtra(KEY_MOTIONTRACKING_AUTORECOVER, mUseAutoReset); StartActivity(startmotiontracking); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Categories); ada = new CatListAdapter(this, Resource.Id.textView1, maxCategories); ada.LoadSPData(KEYNAME); var lvCats = FindViewById <ListView>(Resource.Id.catList); lvCats.SetBackgroundResource(Resource.Drawable.CatListStyle); lvCats.Adapter = ada; lvCats.ItemClick += (sender, e) => { lastPosition = e.Position; var c = ada.GetItemAt(lastPosition); if (c.cards == null) { c.cards = new List <card>(); } var i = new Android.Content.Intent(this, typeof(CardPager)); i.PutExtra("CARDS", JsonConvert.SerializeObject(c.cards)); StartActivityForResult(i, CPRC); }; }
public override View GetView(int position, View convertView, ViewGroup parent) { WeClipFragmentViewHolder holder; if (convertView == null) { convertView = activity.LayoutInflater.Inflate(Resource.Layout.WeClipFragmentItem, parent, false); holder = new WeClipFragmentViewHolder(); holder.ivWeClipPhoto = convertView.FindViewById <ImageView>(Resource.Id.ivWeClipFragItemWeClipPhoto); holder.ivWeClipOverImage = convertView.FindViewById <ImageView>(Resource.Id.ivWeClipFragItemvideo); holder.ivWeClipPhoto.Click += delegate { var videoPlayerActivity = new Android.Content.Intent(activity, typeof(VideoPlayerActivity)); videoPlayerActivity.PutExtra("VideoUrl", JsonConvert.SerializeObject(weclipFile[position])); activity.StartActivity(videoPlayerActivity); }; convertView.Tag = holder; } else { holder = convertView.Tag as WeClipFragmentViewHolder; } var da = weclipFile[position].Thumb; Picasso.With(activity).Load(weclipFile[position].Thumb).Placeholder(Resource.Drawable.default_event_back) .Transform(new RoundedTransformation()) .Resize(100, 100).Into(holder.ivWeClipPhoto); return(convertView); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); etCorreo = FindViewById <EditText>(Resource.Id.etCorreo); etPass = FindViewById <EditText>(Resource.Id.etPass); FindViewById <Button>(Resource.Id.btnValidar).Click += async(sender, e) => { var ServiceClient = new HackAtHome.SAL.ServiceClient(); var Result = await ServiceClient.AutenticateAsync( etCorreo.Text.ToString(), etPass.Text.ToString()); if (Result.Status == Status.Success) { SendEvidence(); Toast.MakeText(this, "Status Success", ToastLength.Short).Show(); var ActivityIntent = new Android.Content.Intent(this, typeof(EvidenciaActivity)); ActivityIntent.PutExtra("email", Result.Token); ActivityIntent.PutExtra("pass", Result.FullName); StartActivity(ActivityIntent); } else { Toast.MakeText(this, $"{Result.Status}\n{Result.FullName}\n{Result.Token}", ToastLength.Long).Show(); } }; }
/// <summary> /// Gets the platform Native UI (Android - [Chrome] Custom Tabs). /// </summary> /// <returns> /// The platform Native UI (non-embeded/non-integrated Browser Control/Widget/View (WebView). /// Android.Support.CustomTabs.CustomTabsIntent /// </returns> /// <see cref="https://components.xamarin.com/gettingstarted/xamandroidsupportcustomtabs"/> protected virtual AuthenticateUIType GetPlatformUINative(UIContext context) { System.Uri uri_netfx = this.GetInitialUrlAsync().Result; global::Android.Net.Uri uri_android = global::Android.Net.Uri.Parse(uri_netfx.AbsoluteUri); CustomTabsConfiguration.UriAndroidOS = uri_android; AuthenticateUIType ui = new AuthenticateUIType(context, typeof(WebAuthenticatorNativeBrowserActivity)); ui.PutExtra("ClearCookies", ClearCookiesBeforeLogin); var state = new WebAuthenticatorNativeBrowserActivity.State { Authenticator = this, }; ui.PutExtra("StateKey", WebAuthenticatorNativeBrowserActivity.StateRepo.Add(state)); return(ui); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Evidencias); LoginData = Intent.Extras.GetStringArrayList("LoginData") ?? new string[0]; textViewAlumno = FindViewById <TextView>(Resource.Id.textViewAlumno); ListEvidence = FindViewById <ListView>(Resource.Id.listView1); Data = (Complex)this.FragmentManager.FindFragmentByTag("Data"); if (Data == null) { Data = new Complex(); var FragmentTransaction = this.FragmentManager.BeginTransaction(); FragmentTransaction.Add(Data, "Data"); FragmentTransaction.Commit(); Validate(LoginData[0], LoginData[1]); } else { //var adapter = new EvidencesAdapter(this, Data.Lista, Resource.Layout.ListItem, Resource.Id.textViewEvidencia, Resource.Id.textViewEstado); ListEvidence.Adapter = Data.Adapter; textViewAlumno.Text = Data.Alumno; } if (savedInstanceState != null) { //ListEvidence.Adapter.se = savedInstanceState.GetInt("ListEvidencePosition", 0); } ListEvidence.ItemClick += (sender, e) => { var Intent = new Android.Content.Intent(this, typeof(DescribeLabActivity)); //var ItemPosition = ListEvidence.CheckedItemPosition; //EvidencesAdapter CA = new EvidencesAdapter(this, Data.Lista, Resource.Layout.ListItem, Resource.Id.textViewEvidencia, Resource.Id.textViewEstado); int Item = (int)Data.Adapter.GetItemId((int)e.Position); //Evidence Evidence evidences = Data.Lista[e.Position]; Intent.PutExtra("ItemPosition", Item); Intent.PutExtra("Token", Data.Token); Intent.PutExtra("Alumno", Data.Alumno); Intent.PutExtra("Title", evidences.Title); Intent.PutExtra("Status", evidences.Status); StartActivity(Intent); }; }
/// <summary> /// Add a local item at the end of the queue. /// </summary> /// <param name="path"></param> public static void PlayLast(string path) { Intent intent = new Intent(Application.Context, typeof(MusicPlayer)); intent.PutExtra("file", path); intent.SetAction("PlayLast"); Application.Context.StartService(intent); }
private void DataGridOnibus_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { OnibusClass OnibusSelecionado = ListOnibus[e.Position]; string cPlaca = OnibusSelecionado.Onibus_Placa; string cNumero = OnibusSelecionado.Onibus_Numero.ToString(); Android.Content.Intent MapsOnibus; if (OnibusSelecionado.ExisteOnibus(Convert.ToInt32(cNumero), cPlaca)) { MapsOnibus = new Android.Content.Intent(this, typeof(RotasMapas)); MapsOnibus.PutExtra("NumeOnibus", cNumero); MapsOnibus.PutExtra("PlacaOnibus", cPlaca); StartActivity(MapsOnibus); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var ButtonValidate = FindViewById <Button>(Resource.Id.buttonValidate); ButtonValidate.Click += async(object sender, System.EventArgs e) => { var EditTextEmail = FindViewById <TextView>(Resource.Id.editTextEmail); var EditTextPassword = FindViewById <TextView>(Resource.Id.editTextPassword); var TiCapacitacionClient = new ServiceClient(); var Result = await TiCapacitacionClient.AutenticateAsync(EditTextEmail.Text, EditTextPassword.Text); if (Result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = EditTextEmail.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var Intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); Intent.PutExtra("Token", Result.Token); Intent.PutExtra("FullName", Result.FullName); StartActivity(Intent); } else { Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificación"); Alert.SetIcon(Resource.Drawable.Icon); Alert.SetMessage($"{Enum.GetName(typeof(Status), Result.Status)}"); Alert.SetButton("Ok", (s, ev) => { }); Alert.Show(); } }; }
public void StartSpeechRecognition() { StopService(); try { if (ContextCompat.CheckSelfPermission(Android.App.Application.Context, Manifest.Permission.RecordAudio) != Android.Content.PM.Permission.Granted) { ActivityCompat.RequestPermissions(CrossCurrentActivity.Current.Activity, new[] { Manifest.Permission.RecordAudio }, 0); } else { if (_speechRecognizer == null) { _speechRecognizer = SpeechRecognizer.CreateSpeechRecognizer(Android.App.Application.Context); _speechRecognizer.PartialResults += _speechRecognizer_PartialResults; _speechRecognizer.Results += _speechRecognizer_Results; _speechRecognizer.Error += _speechRecognizer_Error; } var intent = new Android.Content.Intent(RecognizerIntent.ActionRecognizeSpeech); intent.PutExtra(RecognizerIntent.ExtraLanguagePreference, "de"); intent.PutExtra(RecognizerIntent.ExtraCallingPackage, Android.App.Application.Context.PackageName); intent.PutExtra(RecognizerIntent.ExtraPartialResults, true); intent.PutExtra(RecognizerIntent.ExtraMaxResults, 2); intent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500); intent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500); intent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 1500); _speechRecognizer.StartListening(intent); } } catch (Exception) { } }
void ConsoleListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { string ipAddr = _consoleListAdapter.GetItem(e.Position); var intent = new Android.Content.Intent(this, typeof(StreamActivity)); intent.PutExtra("hostName", ipAddr); StartActivity(intent); }
private async void Validate() { ServiceClient serviceclient = new ServiceClient(); var emailEditText = FindViewById <EditText>(Resource.Id.editTextCorreo); var passwordEditText = FindViewById <EditText>(Resource.Id.editTextPassword); ResultInfo Result = await serviceclient.AutenticateAsync(emailEditText.Text, passwordEditText.Text); var MicrosoftEvidence = new LabItem { Email = emailEditText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificacion"); Alert.SetIcon(Resource.Drawable.icon); string message; if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { message = $"Bienvenido {Result.FullName}"; } else { message = $"Error:\n{Result.Status}\n{Result.FullName}"; } var Intent = new Android.Content.Intent(this, typeof(EvidenceListActivity)); Intent.PutExtra("FullName", Result.FullName); Intent.PutExtra("Token", Result.Token); StartActivity(Intent); }
/// <summary> /// Handle playback of a local file using it's path. /// </summary> /// <param name="path"></param> public static void Play(string path) { Intent intent = new Intent(Application.Context, typeof(MusicPlayer)); intent.PutExtra("file", path); Application.Context.StartService(intent); MainActivity.instance.ShowPlayer(); MusicPlayer.UpdateQueueDataBase(); }
private void submit(string user) { var getMenuActivity = new Android.Content.Intent(this, typeof(menuActivity)); //extras here char[] delimiterChar = { '@' }; string[] usernameDelim = user.Split(delimiterChar); getMenuActivity.PutExtra("username", usernameDelim[0]); Console.WriteLine(usernameDelim); StartActivity(getMenuActivity); }
/// <summary> /// Gets an <see cref="Android.Content.Intent"/> that can be used to start the share activity. /// </summary> /// <returns> /// The <see cref="Android.Content.Intent"/>. /// </returns> /// <param name='activity'> /// The <see cref="Android.App.Activity"/> that will invoke the returned <see cref="Android.Content.Intent"/>. /// </param> /// <param name='item'> /// The item to share. /// </param> /// <param name='completionHandler'> /// Handler called when the share UI has finished. /// </param> public virtual ShareUIType GetShareUI (UIContext activity, Item item, Action<ShareResult> completionHandler) { var intent = new Android.Content.Intent (activity, typeof (ShareActivity)); var state = new ShareActivity.State { Service = this, Item = item, CompletionHandler = completionHandler, }; intent.PutExtra ("StateKey", ShareActivity.StateRepo.Add (state)); return intent; }