protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Validar); var textEmailAddress = FindViewById <EditText>(Resource.Id.etCorreo); var etPassword = FindViewById <EditText>(Resource.Id.etPassword); var btn = FindViewById <Button>(Resource.Id.btn); var txview = FindViewById <TextView>(Resource.Id.txview); btn.Click += async(sender, e) => { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading is Progress..."); progress.SetCancelable(false); progress.Show(); this.Email = textEmailAddress.Text.ToString(); this.Password = etPassword.Text.ToString(); string res = await Validate(); txview.Text = res.ToString(); progress.Cancel(); }; }
public override Android.Views.View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.SignLayout, container, false); Button clearButton = view.FindViewById<Button> (Resource.Id.clearButton); Button sendButton = view.FindViewById<Button> (Resource.Id.sendButton); EditText remarks = view.FindViewById<EditText> (Resource.Id.txtRemarks); ToggleButton notification = view.FindViewById<ToggleButton> (Resource.Id.toggleNotifications); SignView signView = view.FindViewById<SignView> (Resource.Id.signView); mDialog = new ProgressDialog(this.Activity); mDialog.SetMessage("Sending..."); mDialog.SetCancelable(false); clearButton.Click += delegate { signView.ClearCanvas(); }; sendButton.Click += delegate { using (MemoryStream stream = new MemoryStream()) { if (signView.CanvasBitmap().Compress(Bitmap.CompressFormat.Png, 100, stream)) { byte[] image = stream.ToArray(); string base64signature = Convert.ToBase64String(image); Backend.Current.send(base64signature, remarks.Text, notification.Activated, OnSendSuccess, OnSendFail); mDialog.Show(); } } }; return view; }
private async void Botonvalidar_Click(object sender, EventArgs e) { progress = new Android.App.ProgressDialog(this.Context); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Validando...Espere..."); progress.SetCancelable(false); progress.Show(); if (!string.IsNullOrEmpty(txtdni.Text)) { var dato = await controller.ValidaCliente(int.Parse(txtdni.Text)); if (dato != null) { txtnombre.Text = dato.nom_clie; txtEmail.Text = dato.correo; txtTele_F.Text = dato.telefono_f; txtTele_C.Text = dato.telefono_c; progress.Dismiss(); } else { progress.Dismiss(); Toast.MakeText(this.Context, "Cliente no encontrado", ToastLength.Long).Show(); LimpiarCasillas(); } } else { progress.Dismiss(); Toast.MakeText(this.Context, "Campo vacio", ToastLength.Long).Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var textEmailAddress = FindViewById <EditText>(Resource.Id.editTextEmail); var etPassword = FindViewById <EditText>(Resource.Id.editTextPassword); var btn = FindViewById <Button>(Resource.Id.buttonValidate); btn.Click += async(sender, e) => { progress = new Android.App.ProgressDialog(this); progress.SetCancelable(false); progress.SetTitle("Trabajando"); progress.SetMessage("Por favor, espera..."); progress.SetProgressStyle(Android.App.ProgressDialogStyle.Horizontal); progress.Indeterminate = true; progress.Show(); await Validate(); Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificación"); Alert.SetIcon(Resource.Drawable.dotnet); Alert.SetMessage( $"{Result.Status}\n{Result.FullName}\n{Result.Token}"); Alert.SetButton("Ok", (s, ev) => { }); progress.Cancel(); Alert.Show(); }; }
protected override void OnResume() { base.OnResume(); Task startupWork = new Task(() => { //Log.Debug(TAG, "Performing some startup work that takes a bit of time."); //Task.Delay(5000); // Simulate a bit of startup work. //Log.Debug(TAG, "Working in the background - important stuff."); }); startupWork.ContinueWith(t => { Log.Debug(TAG, "Work is finished - start MainActivity."); StartActivity(new Intent(Application.Context, typeof(MainActivity))); }, TaskScheduler.FromCurrentSynchronizationContext()); progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading... Please wait..."); progress.SetCancelable(false); progress.Show(); startupWork.Start(); }
private async Task ConnectToRelay() { bool connected = false; var waitIndicator = new ProgressDialog(this) { Indeterminate = true }; waitIndicator.SetCancelable(false); waitIndicator.SetMessage("Connecting..."); waitIndicator.Show(); try { var prefs = PreferenceManager.GetDefaultSharedPreferences(this); connected = await _remote.Connect(prefs.GetString("RelayServerUrl", ""), prefs.GetString("RemoteGroup", ""), prefs.GetString("HubName", "")); } catch (Exception) { } finally { waitIndicator.Hide(); } Toast.MakeText(this, connected ? "Connected!" : "Unable to connect", ToastLength.Short).Show(); }
private async void SaveButton_Click(object sender, EventArgs ea) { var dialog = new ProgressDialog(this); dialog.SetMessage(Resources.GetString(Resource.String.Saving)); dialog.SetCancelable(false); dialog.Show(); try { Bindings.UpdateSourceForLastView(); this.Model.ApplyEdit(); var returnModel = await this.Model.SaveAsync(); InitializeBindings(returnModel); } catch (Exception ex) { var alert = new AlertDialog.Builder(this); alert.SetMessage(string.Format(Resources.GetString(Resource.String.Error), ex.Message)); alert.Show(); } finally { dialog.Hide(); } }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ChapterDetailsLayout); string chapt_id = Intent.GetStringExtra("chapter_id") ?? "Data not available"; //string instructor_name = Intent.GetStringExtra("instructor_name") ?? "Name Not Available"; //instructorName.Text = instructor_name; progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetTitle("Please Wait"); progress.SetMessage("Getting Course Details"); progress.SetCancelable(false); progress.Show(); await Task.Run(() => ChapterDetailsFetcher(chapt_id)); progress.Hide(); FindViews(); instructorName.Text = Convert.ToString(instructorChapterList.inst_name); briefDescription.Text = briefDesc; mainContent.Text = chapterContent; toolbarChapterNumber.Text = chapterNumber; toolbarChapterName.Text = chapterName; }
private async void TrySave() { ProgressDialog progress; progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Logging In... Please wait..."); progress.SetCancelable(false); progress.Show(); CurrentPlatform.Init(); EditText firstName = (EditText)FindViewById(Resource.Id.firstName); EditText lastName = (EditText)FindViewById(Resource.Id.lastName); EditText email = (EditText)FindViewById(Resource.Id.email); EditText phoneNo = (EditText)FindViewById(Resource.Id.phoneNo); Spinner gender = (Spinner)FindViewById(Resource.Id.gender); Spinner county = (Spinner)FindViewById(Resource.Id.county); UserProfiles newUserInfo = new UserProfiles { UsersID = pref.GetString("UserID", "NULL"), Firstname = firstName.Text, Lastname = lastName.Text, Email = email.Text, PhoneNo = phoneNo.Text, Gender = gender.SelectedItem.ToString(), County = county.SelectedItem.ToString() }; MobileService.GetTable <UserProfiles>().InsertAsync(newUserInfo); progress.Hide(); Toast.MakeText(ApplicationContext, "User " + pref.GetString("UserName", "NULL") + " info created!", ToastLength.Short).Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Button btnClickId = FindViewById <Button>(Resource.Id.btnClickId); btnClickId.Click += async(sender, args) => { var progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Aguarde..."); progress.SetCancelable(false); progress.Show(); await Task.Delay(5000); guid = Guid.NewGuid(); progress.Dismiss(); StartActivity(typeof(WebViewActivity)); }; }
public async void ProgressDialog() { try { progress = new ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); //progress.SetProgressDrawable(Resource.Drawable.loading); progress.SetMessage("Loading data...."); progress.SetCancelable(false); progress.Show(); await Task.Run((() => Foo())); progress.Dismiss(); void Foo() { for (int i = 0; i < 2; i++) { Thread.Sleep(500); } } } catch (Exception ex) { throw ex; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Login); EditText storeUsernameText = FindViewById <EditText>(Resource.Id.editTextUserName); EditText storePasswordText = FindViewById <EditText>(Resource.Id.textViewPassword); Button btnLoginStore = FindViewById <Button>(Resource.Id.btnLogin); btnLoginStore.Click += async(sender, e) => { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading... Please wait..."); progress.SetCancelable(false); progress.Show(); try { LoginEntity loginEntity = new LoginEntity { AuthToken = "", UserNameOREmail = storeUsernameText.Text, PasswordHash = storePasswordText.Text }; JsonValue json = await HttpRequestHelper <LoginEntity> .POSTreq(ServiceTypes.Login, loginEntity); ParseJSON(json); progress.Hide(); } catch (Exception ex) { progress.Dismiss(); } }; }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.instructorChapterListToolBar); progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetTitle("Please Wait"); progress.SetMessage("Getting Course Details"); progress.SetCancelable(false); progress.Show(); string inst_id = Intent.GetStringExtra("instructor_id") ?? "Data not available"; language_id = Intent.GetStringExtra("language_id") ?? "Data not available"; inst_name = Intent.GetStringExtra("instructor_name") ?? "Name Not Available"; try { Console.WriteLine("instructor_name : " + inst_name); await Task.Run(() => ChapterList(inst_id, language_id)); await Task.Run(() => CourseInfoFetcher(language_id)); progress.Hide(); //InitData(); FindViews(); chapterListInstructorName.Text = inst_name; } catch (Exception ChapterListError) { Console.WriteLine("ChapterListError : " + ChapterListError); throw; } }
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) { // Console.WriteLine("[{0}] OnCreateView Called: {1}", TAG, DateTime.Now.ToLongTimeString()); View v = inflater.Inflate(Resource.Layout.fragment_photo, container, false); mImageView = v.FindViewById<ImageView>(Resource.Id.photoView); photoUrl = Activity.Intent.GetStringExtra(PhotoGalleryFragment.PHOTO_URL_EXTRA); photoUrl = photoUrl.Substring(0, photoUrl.Length-6) + ".jpg"; photoFilename = new FlickrFetchr().GetFilenameFromUrl(photoUrl); ProgressDialog pg = new ProgressDialog(Activity); pg.SetMessage(Resources.GetString(Resource.String.loading_photo_message)); pg.SetTitle(Resources.GetString(Resource.String.loading_photo_title)); pg.SetCancelable(false); pg.Show(); Task.Run(async () => { Bitmap image = await new FlickrFetchr().GetImageBitmapAsync(photoUrl, 0, new CancellationTokenSource().Token, photoFilename).ConfigureAwait(false); Activity.RunOnUiThread(() => { mImageView.SetImageBitmap(image); //Console.WriteLine("[{0}] File created: {1}", TAG, photoUrl); pg.Dismiss(); }); }); return v; }
public static ProgressDialog CreateProgressDialog(string message, Activity activity) { var mProgressDialog = new ProgressDialog(activity, Resource.Style.LightDialog); mProgressDialog.SetMessage(message); mProgressDialog.SetCancelable(false); mProgressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); return mProgressDialog; }
public void Show(Context context, string content) { var dialog = new ProgressDialog(context); dialog.SetMessage(content); dialog.SetCancelable(false); dialog.Show(); System.Threading.Thread.Sleep (2000); dialog.Hide (); }
void ShowDialog() { progress = new ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetMessage("Please wait..."); progress.SetCancelable(false); progress.Show(); }
public static void ShowProgressBar(Context context) { progress = new Android.App.ProgressDialog(context); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading... Please wait..."); progress.SetCancelable(false); progress.Show(); }
public void CreateProgressDialog(string message, Boolean cacelable, ProgressDialogStyle style) { mProgressDialog = new Android.App.ProgressDialog(mContext); mProgressDialog.Indeterminate = true; mProgressDialog.SetProgressStyle(style); mProgressDialog.SetMessage(message); mProgressDialog.SetCancelable(false); mProgressDialog.Show(); }
private void StarShowingPtogressDialog() { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Добавяне на абонат ..."); progress.SetCancelable(false); progress.Show(); }
private async void TryLoginAsync(object sender, EventArgs e) { ProgressDialog progress; progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Logging In... Please wait..."); progress.SetCancelable(false); progress.Show(); EditText username = (EditText)FindViewById(Resource.Id.username); EditText password = (EditText)FindViewById(Resource.Id.passwordInput); string user = username.Text.Trim(); string passwordInput = password.Text; if (!await DBHelper.DoesUserExist(user)) { progress.Hide(); Toast.MakeText(ApplicationContext, "Invalid Login", ToastLength.Short).Show(); } else { Users u = await DBHelper.GetUser(user); if (PasswordStorage.VerifyPassword(passwordInput, u.Password)) { edit.PutString("UserID", u.ID); edit.PutString("UserName", u.Username); edit.PutString("LoggedIn", "true"); edit.PutString("Password", passwordInput); edit.Commit(); Toast.MakeText(ApplicationContext, "Success", ToastLength.Short).Show(); if (await DBHelper.IsUserProfileCreated(u.ID)) { //go to main menu UserProfiles up = await DBHelper.GetUsersProfile(u.ID); edit.PutString("FirstName", up.Firstname); edit.PutString("LastName", up.Lastname); edit.Commit(); progress.Hide(); StartActivity(typeof(MainProfileActivity)); } else { progress.Hide(); StartActivity(typeof(SetUpProfileActivity)); } } else { progress.Hide(); Toast.MakeText(ApplicationContext, "Invalid Login", ToastLength.Short).Show(); } } }
private void StarShowingPtogressDialog() { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Зареждане... Моля изчакайте..."); progress.SetCancelable(false); progress.Show(); }
private void ShowProgressDialog() { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Изпращане на сигнал ..."); progress.SetCancelable(false); progress.Show(); }
public void OnClick(View V) { ProgressDialog progress = new ProgressDialog(this); try { switch(V.Id) { case Resource.Id.bSignIn : { isLogin=false; Boolean blnValidate= FieldValidation(); if (blnValidate==true) { progress.Indeterminate = true; progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetMessage("Contacting server. Please wait..."); progress.SetCancelable(true); progress.Show(); var progressDialog = ProgressDialog.Show(this, "Please wait...", "Checking Login info...", true); new Thread(new ThreadStart(delegate { RunOnUiThread(() => ValidateSqluserpwd(etUsername.Text.ToString() , etpwd.Text.ToString())); if (isLogin== true){ RunOnUiThread(() => Toast.MakeText(this, "Login detail found in system...", ToastLength.Short).Show()); } RunOnUiThread(() => progressDialog.Hide()); })).Start(); } break; } case Resource.Id.tvforget : { var toast = Toast.MakeText(this,"Forget link clicked",ToastLength.Short); toast.Show(); break; } case Resource.Id.tvregister : { var myIntent = new Intent (this, typeof(MainActivity)); StartActivityForResult (myIntent, 0); break; } } } catch (NullReferenceException ex) { var toast = Toast.MakeText (this, ex.Message ,ToastLength.Short); toast.Show (); } finally { // Now hide the progress dialog progress.Dismiss(); } }
public static void MakeCall(CallEntity callEntity, Activity activity) { var category = callEntity.Category; var choice = callEntity.Choice ?? ""; var detail = callEntity.Detail ?? ""; new AlertDialog.Builder(activity) .SetTitle(category + " " + choice + " " + detail) .SetMessage(Strings.CallSendMessage) .SetPositiveButton(Strings.CallSend, delegate { ThreadPool.QueueUserWorkItem(o => { activity.RunOnUiThread(() => { dialog = new ProgressDialog(activity); dialog.SetMessage(Strings.SpinnerDataSending); dialog.SetCancelable(false); dialog.Show(); }); try { ICall patientCall = new PatientCall(); // Assign the callid with the returned MongoDB id callEntity._id = patientCall.MakeCall(callEntity); activity.RunOnUiThread(() => { // Call successfull, take the user to myCalls activity.ActionBar.SelectTab(activity.ActionBar.GetTabAt(1)); SetNewCalls(callEntity); dialog.Hide(); }); } catch (Exception ex) { Console.WriteLine("ERROR making call: " + ex.Message); activity.RunOnUiThread(() => { dialog.Hide(); new AlertDialog.Builder(activity).SetTitle(Strings.Error) .SetMessage(Strings.ErrorSendingCall) .SetPositiveButton(Strings.OK, delegate { }).Show(); }); } }); }) .SetNegativeButton(Strings.Cancel, delegate {/* Do nothing */ }) .Show(); }
protected override void OnPreExecute() { base.OnPreExecute(); progDialog = new ProgressDialog(activity); progDialog.SetMessage("Logging Out..."); progDialog.Indeterminate=false; progDialog.SetProgressStyle(ProgressDialogStyle.Spinner); progDialog.SetCancelable(true); progDialog.Show(); }
public void showProgressRootView(Activity _activity){ if (progressDialogParentRootView != null) { progressDialogParentRootView.Hide (); progressDialogParentRootView = null; } progressDialogParentRootView = ProgressDialog.Show (_activity, "", "", true); progressDialogParentRootView.SetContentView(new ProgressBar(_activity)); progressDialogParentRootView.SetCancelable (true); progressDialogParentRootView.Show (); }
public async void Validate() { var errorMsg = ""; if (user.Text.Length == 0 && pass.Text.Length == 0) { if (user.Text.Length == 0 || pass.Text.Length == 0) { errorMsg = "Please enter User Name "; } if (pass.Text.Length == 0 || pass.Text.Length == 0) { errorMsg = errorMsg + "Please enter Password"; } Toast.MakeText(this, errorMsg, ToastLength.Long).Show(); return; } else { Boolean result = ic.connectivity(); if (result) { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetCancelable(false); progress.SetMessage("Please wait..."); progress.Show(); JsonValue login_value = null; try { login_value = await nextActivity(user.Text, pass.Text); } catch (Exception e) { } if (login_value != null) { await ParseAndDisplay(login_value, user.Text); } else { Toast.MakeText(this, "No Internet", ToastLength.Long).Show(); } // loginId1 = user.Text; // password1 = pass.Text; } else { Toast.MakeText(this, "No Internet", ToastLength.Long).Show(); } } }
public DownloadFileHelper(Activity parent) { CallingActivity = parent; progress = new ProgressDialog(CallingActivity); progress.Indeterminate = false; progress.SetProgressStyle(ProgressDialogStyle.Horizontal); progress.SetMessage("Downloading. Please wait..."); progress.SetCancelable(false); progress.Max = 100; //OnFinishDownloadHandle += new OnFinishDownload (FinishDownload); }
public static ProgressDialog ShowProgressDialog(Activity activity, int messageResId, /*int titleResId,*/ bool allowCancel, ProgressDialogStyle style=ProgressDialogStyle.Spinner) { ProgressDialog dialog = new ProgressDialog(activity); dialog.SetProgressStyle(style); //dialog.SetTitle(titleResId); dialog.SetMessage(activity.Resources.GetString(messageResId)); dialog.SetCancelable(allowCancel); dialog.SetCanceledOnTouchOutside(allowCancel); dialog.Show(); return dialog; }
private void ShowProgressDialog() { // Looper.Prepare(); progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Обновяване ..."); progress.SetCancelable(false); progress.Show(); }
private ProgressDialog CreateProgressDialog() { var progress = new ProgressDialog(this) { Indeterminate = true }; progress.SetCancelable(false); progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetMessage("Contacting server. Please wait..."); return progress; }
public ExpenseFormArrayAdapter(Activity context) : base() { this.context = context; this.items = new List<SavedExpenseForm> (); mDialog = new ProgressDialog(this.context); mDialog.SetMessage("Loading..."); mDialog.SetCancelable(false); Backend.Current.getExpenseForms(OnGetExpenseFormsSuccess, OnGetExpenseFormsFail); mDialog.Show (); }
public async Task getorglist(string org_id) { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetCancelable(false); progress.SetMessage("Please wait..."); progress.Show(); dynamic value = new ExpandoObject(); value.OrgId = org_id; string json = JsonConvert.SerializeObject(value); try { string item = await restservice.MarkingList(this, json, location).ConfigureAwait(false); markinglist = JsonConvert.DeserializeObject <List <MarkingListModel> >(item); markinglist[0].DesignationName = "Select Designation"; for (int j = 0; j < markinglist.Count; j++) { MarkingListModel model = new MarkingListModel(); model.DesignationName = markinglist[j].DesignationName; addmarkinglist.Add(model); } //db.InsertMarkingList(markinglist); progress.Dismiss(); } catch (Exception ex) { progress.Dismiss(); } if (markinglist != null) { this.RunOnUiThread(() => { designationSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Selectdesignation_ItemSelected); ArrayAdapter adapter1 = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, addmarkinglist); designationSpinner.Adapter = adapter1; }); //Activity.RunOnUiThread(() => //{ // marked = new MarkingListAdapter(this, markinglist); // list.SetAdapter(marked); //}); } progress.Dismiss(); }
private void BtnIngresar_Click(object sender, System.EventArgs e) { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Iniciando Sesion... Por Favor espere..."); progress.SetCancelable(false); progress.Show(); RunOnUiThread(() => { try { //creando la conexion MySqlConnection miConecion = new MySqlConnection(@"Password=PnH5LYCjBx;Persist Security Info=True;User ID=sql8171912;Initial Catalog=sql8171912;Data Source=sql8.freesqldatabase.com"); //abriendo conexion miConecion.Open(); MySqlCommand comando = new MySqlCommand("select id, password from usuarios where id = '" + User.Text + "'And password = '******' ", miConecion); //ejecuta una instruccion de sql devolviendo el numero de las filas afectadas comando.ExecuteNonQuery(); DataSet ds = new DataSet(); MySqlDataAdapter da = new MySqlDataAdapter(comando); //Llenando el dataAdapter da.Fill(ds, "usuarios"); //utilizado para representar una fila de la tabla que necesitas en este caso usuario DataRow DR; DR = ds.Tables["usuarios"].Rows[0]; //evaluando que la contraseña y usuario sean correctos if ((User.Text == DR["id"].ToString()) || (Password.Text == DR["password"].ToString())) { string user = User.Text; //instanciando la actividad principal Intent intent = new Intent(this, typeof(Inicio)); intent.PutExtra("IdUser", user); StartActivity(intent); } else { Toast.MakeText(this, "Error! Su contraseña y/o usuario son invalidos", ToastLength.Long); } } catch { Toast.MakeText(this, "Error! Su contraseña y/o usuario son invalidos", ToastLength.Long); } }); }
private void ShowProgressDialog(ProgressDialog progressDialog, string message, bool show) { if (show) { progressDialog.Indeterminate = true; progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); progressDialog.SetMessage(message); progressDialog.SetCancelable(false); progressDialog.Show(); } else progressDialog.Hide(); }
public static void ShowProgressDialog(Activity context, string msg="Loading", string title="",bool isCancle=false) { if(_mProgressDialog != null) return; _mProgressDialog = new ProgressDialog(context); _mProgressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); _mProgressDialog.SetTitle(title); _mProgressDialog.SetMessage(msg); _mProgressDialog.SetCancelable(isCancle); if (!context.IsFinishing) { _mProgressDialog.Show(); } }
public async void button_Click(object sender, EventArgs e) { MSCognitiveServices cognitiveServices = new MSCognitiveServices(); MyClass c = new MyClass(); string path = string.Empty; string albumPath = string.Empty; Stream data = await c.LoadPhoto(path, albumPath); progress = new Android.App.ProgressDialog(this); progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading... Please wait..."); progress.SetCancelable(false); progress.Show(); MemoryStream faceStream = new MemoryStream(); data.CopyTo(faceStream); data.Seek(0, SeekOrigin.Begin); MemoryStream emotionStream = new MemoryStream(); data.CopyTo(emotionStream); data.Seek(0, SeekOrigin.Begin); faceStream.Seek(0, SeekOrigin.Begin); emotionStream.Seek(0, SeekOrigin.Begin); Dictionary <string, string> faceProperties = await cognitiveServices.GetFaceProperties(faceStream); Dictionary <string, float> emotionProperties = await cognitiveServices.GetEmotionProperties(emotionStream); var et_faceText = FindViewById <TextView>(Resource.Id.et_faceText); et_faceText.Text = string.Format("Gender: {0} Age: {1}", faceProperties["Gender"], faceProperties["Age"]); var et_emotionText = FindViewById <TextView>(Resource.Id.et_emotionText); var et_emotionText_1 = FindViewById <TextView>(Resource.Id.et_emotionText_1); var et_emotionText_2 = FindViewById <TextView>(Resource.Id.et_emotionText_2); var et_emotionText_3 = FindViewById <TextView>(Resource.Id.et_emotionText_3); et_emotionText.Text = string.Format("Anger: {0}% Contempt:{1}% ", emotionProperties["Anger"], emotionProperties["Contempt"]); et_emotionText_1.Text = string.Format("Fear: {0}% Happiness:{1}% ", emotionProperties["Fear"], emotionProperties["Happiness"]); et_emotionText_2.Text = string.Format("Sadness: {0}% Surprise:{1}%", emotionProperties["Sadness"], emotionProperties["Surprise"]); et_emotionText_3.Text = string.Format("Disgust:{0}% Neutral:{1}%", emotionProperties["Disgust"], emotionProperties["Neutral"]); var imageView = FindViewById <ImageView>(Resource.Id.myImageView); using (var stream = data) { var bitmap = BitmapFactory.DecodeStream(stream); imageView.SetImageBitmap(bitmap); // do stuff with bitmap } progress.Hide(); faceStream.Close(); emotionStream.Close(); }
/// <summary> /// Shows the progress dialog /// </summary> /// <param name="message">The message to display</param> public void Show(string message) { if (_currentDialog != null) { this.Hide(); } _currentDialog = new ProgressDialog(_activity); _currentDialog.Indeterminate = true; _currentDialog.SetProgressStyle(ProgressDialogStyle.Spinner); _currentDialog.SetMessage(message); _currentDialog.SetCancelable(false); _currentDialog.Show(); }
private static void IsBusyChanged(View view, AttachedMemberChangedEventArgs<bool> args) { var dialog = ProgressDialogAttachedProperty.GetValue(view, null); if (dialog == null) { dialog = new ProgressDialog(view.Context); dialog.SetCancelable(false); ProgressDialogAttachedProperty.SetValue(view, dialog); } if (args.NewValue) dialog.Show(); else dialog.Dismiss(); }
public void ShowProgressMessage(string message, bool spinner) { spinners++; if (m_Progress == null) { switch (theme) { case Theming.Themes.Comos: m_Progress = new ProgressDialog(m_Activity, ProgressDialog.ThemeHoloLight); break; case Theming.Themes.Siemens: m_Progress = new ProgressDialog(m_Activity, ProgressDialog.ThemeDeviceDefaultLight); break; case Theming.Themes.Light: m_Progress = new ProgressDialog(m_Activity, ProgressDialog.ThemeHoloDark); break; case Theming.Themes.Black: m_Progress = new ProgressDialog(m_Activity, ProgressDialog.ThemeDeviceDefaultDark); break; default: m_Progress = new ProgressDialog(m_Activity); break; } m_Progress.Indeterminate = true; if (spinner) { m_Progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); } else { m_Progress.SetProgressStyle(Android.App.ProgressDialogStyle.Horizontal); } m_Progress.SetMessage(message); m_Progress.SetCancelable(false); m_Progress.SetMessage(message); m_Progress.Show(); } else { m_Progress.SetMessage(message); } }
protected void showProgressDialog(int messageId) { if (progressDialog != null && progressDialog.IsShowing) { return; } if (progressDialog == null) { progressDialog = new Android.App.ProgressDialog(this); progressDialog.SetCancelable(false); } progressDialog.SetMessage(Resources.GetString(messageId)); progressDialog.Show(); }
private async void TryRegister(object sender, EventArgs e) { ProgressDialog progress; progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Registering... Please wait..."); progress.SetCancelable(false); progress.Show(); EditText username = (EditText)FindViewById(Resource.Id.usernameReg); EditText password = (EditText)FindViewById(Resource.Id.passwordInput1); EditText confirmPassword = (EditText)FindViewById(Resource.Id.passwordInput2); if (password.Text == confirmPassword.Text) { string hashedPassword = PasswordStorage.CreateHash(password.Text); string userName = username.Text.Trim(); //CurrentPlatform.Init(); Users newUser = new Users { Username = userName, Password = hashedPassword }; List <Users> allUsers = await MobileService.GetTable <Users>().ToListAsync(); Users u = allUsers.FirstOrDefault(x => x.Username == newUser.Username); if (u == null) { DBHelper.InsertNewUser(newUser); //MobileService.GetTable<Users>().InsertAsync(newUser); progress.Hide(); Toast.MakeText(ApplicationContext, "User " + newUser.Username + " created! You can now log in!", ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } else { progress.Hide(); Toast.MakeText(ApplicationContext, "User " + u.Username + " already exists!", ToastLength.Short).Show(); } } else { progress.Hide(); string message = "Passwords don't match."; Toast.MakeText(ApplicationContext, message, ToastLength.Short).Show(); } }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.MyShop_ProductDetails); product_id = Intent.GetIntExtra("product_id",0); //setup background worker for data loading worker = new BackgroundWorker (); worker.DoWork += worker_DoWork; worker.WorkerSupportsCancellation = true; worker.RunWorkerCompleted += worker_RunWorkerCompleted; worker.RunWorkerAsync (); progress = new ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetMessage("Memuatkan data.."); progress.SetCancelable(false); progress.Show(); productImage = FindViewById<MultiImageView>(Resource.Id.productImage); tv_price = FindViewById <TextView> (Resource.Id.tv_price); tv_prodTitle = FindViewById <TextView> (Resource.Id.tv_prodTitle); wv_prodDesc = FindViewById <WebView> (Resource.Id.wv_prodDesc); // btn_addToCart = FindViewById <Button> (Resource.Id.btn_addToCart); btn_sellerInfo = FindViewById <Button> (Resource.Id.btn_sellerInfo); var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar); SetSupportActionBar (toolbar); toolbar.SetBackgroundColor (Color.ParseColor ("#9C27B0")); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetDisplayShowHomeEnabled (true); //call addToCart method // btn_addToCart.Click += (sender, e) => { // addToCart(); // }; btn_sellerInfo.Click += btnSellerInfo_click; }
private async void Botonregistrar_Click(object sender, EventArgs e) { progress = new Android.App.ProgressDialog(this.Context); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Registrando...Espere..."); progress.SetCancelable(false); progress.Show(); string dni = txtdni.Text; string nombre = txtnombre.Text; string email = txtEmail.Text; string telef = txtTele_F.Text; string telec = txtTele_C.Text; try { if (!string.IsNullOrEmpty(dni) || !string.IsNullOrEmpty(nombre) || !string.IsNullOrEmpty(email) || !string.IsNullOrEmpty(telef) || !string.IsNullOrEmpty(telec)) { //await var dato = await controller.RegistraCliente(int.Parse(dni), nombre, email, int.Parse(telef), int.Parse(telec)); if (dato != null) { progress.Dismiss(); Toast.MakeText(this.Context, "Registrado Correctamente", ToastLength.Short).Show(); LimpiarCasillas(); } else { progress.Dismiss(); Toast.MakeText(this.Context, "Error al Registrar", ToastLength.Short).Show(); LimpiarCasillas(); } } else { progress.Dismiss(); Toast.MakeText(this.Context, "Campos vacios", ToastLength.Short).Show(); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.HomeLayout); // find our layout items addButton = FindViewById<Button> (Resource.Id.btnAddExpense); viewButton = FindViewById<Button> (Resource.Id.btnViewExpense); logoutButton = FindViewById<Button> (Resource.Id.btnLogout); lblWelcome = FindViewById<TextView> (Resource.Id.lblWelcome); mDialog = new ProgressDialog(this); mDialog.SetMessage("Logging out..."); mDialog.SetCancelable(false); // Check if the user is logged in try { if (!Backend.Current.isAuthenticated ()) { StartActivity (typeof(LoginActivity)); } lblWelcome.Text = "Welcome " + Backend.Current.getFullName () + "!"; } catch (Exception ex) { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage(ex.Message) .SetPositiveButton("OK", delegate { }) .Show(); } // set up the delegate actions for the buttons addButton.Click += delegate { StartActivity (typeof(MenuActivity)); }; viewButton.Click += delegate { StartActivity (typeof(ExpenseFormOverviewActivity)); }; logoutButton.Click += delegate { Backend.Current.logout(OnLogoutSuccess, OnLogoutFail); mDialog.Show (); }; }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.courseDetailToolBar); courseCode = Intent.GetStringExtra("courseCode") ?? "Data not available"; //Defines the settings for progress bar progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetTitle("Please Wait"); progress.SetMessage("Getting Course Details"); progress.SetCancelable(false); progress.Show(); try { await Task.Run(() => CourseListFetcher(courseCode)); await Task.Run(() => InstructorListFetcher(courseCode)); progress.Hide(); //listSample.Add("Getting Instructors"); InitData(); FindViews(); //foreach (var item in listSample) //{ // Console.WriteLine("ListSample : " + item); //} //foreach (var item in userID) //{ // Console.WriteLine("UserIDs : " + item); //} } catch (System.Exception something) { progress.Hide(); Console.WriteLine("Something : " + something); throw; } }
public async Task getOrgData() { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetCancelable(false); progress.SetMessage("Please wait..."); progress.Show(); //dynamic value = new ExpandoObject(); //value.OrgId = orgid; // string json = JsonConvert.SerializeObject(value); try { string item = await restservice.OrgnizationList(this, "", location); //orgmodel[0].organizationName = "Select Orgnization"; orgmodel = JsonConvert.DeserializeObject <List <OrgModel> >(item); orgmodel[0].organizationName = "Select Organization"; for (int i = 0; i < orgmodel.Count; i++) { OrgModel org = new OrgModel(); //org.organizationName=orgmodel[0]. org.organizationName = orgmodel[i].organizationName; orgname.Add(org); } // db.InsertMarkingList(orgmodel); progress.Dismiss(); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Selectorg_ItemSelected); ArrayAdapter adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, orgname); spinner.Adapter = adapter; // getorglist() } catch (Exception ex) { progress.Dismiss(); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var ListItemColor = FindViewById <ListView>(Resource.Id.ListItemColor); var txview = FindViewById <TextView>(Resource.Id.txview); ListItemColor.Adapter = new CustomAdapters.ColorAdapter(this, Resource.Layout.ListItems, Resource.Id.textView2, Resource.Id.textView3, Resource.Id.imageView1 ); Data = new Complex(); if (Data.res == null) { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading is Progress..."); progress.SetCancelable(false); progress.Show(); res = await Validate(); Data.res = res; progress.Cancel(); } else { res = Data.GetRes(); } txview.Text = res; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate (Resource.Layout.MyShop_ProductDetails, container, false); //setup background worker for data loading worker = new BackgroundWorker (); worker.DoWork += worker_DoWork; worker.WorkerSupportsCancellation = true; worker.RunWorkerCompleted += worker_RunWorkerCompleted; worker.RunWorkerAsync (); progress = new ProgressDialog(Activity); progress.Indeterminate = true; progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetMessage("Memuatkan data.."); progress.SetCancelable(false); progress.Show(); productImage = view.FindViewById<MultiImageView>(Resource.Id.productImage); tv_price = view.FindViewById <TextView> (Resource.Id.tv_price); tv_prodTitle = view.FindViewById <TextView> (Resource.Id.tv_prodTitle); wv_prodDesc = view.FindViewById <WebView> (Resource.Id.wv_prodDesc); // btn_addToCart = FindViewById <Button> (Resource.Id.btn_addToCart); btn_sellerInfo = view.FindViewById <Button> (Resource.Id.btn_sellerInfo); // var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar); // SetSupportActionBar (toolbar); // SupportActionBar.SetDisplayHomeAsUpEnabled (true); //call addToCart method // btn_addToCart.Click += (sender, e) => { // addToCart(); // }; btn_sellerInfo.Click += btnSellerInfo_click; return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.LoginLayout); // Get our button from the layout resource, // and attach an event to it EditText txtEmail = FindViewById<EditText> (Resource.Id.txtEmail); EditText txtPassword = FindViewById<EditText> (Resource.Id.txtPassword); Button loginButton = FindViewById<Button> (Resource.Id.btnLogin); mDialog = new ProgressDialog(this); mDialog.SetMessage("Logging in..."); mDialog.SetCancelable(false); loginButton.Click += delegate { mDialog.Show (); Backend.Current.login(txtEmail.Text, txtPassword.Text, OnLoginSuccess, OnLoginFail); }; }
private async Task Initialize() { if (Initialized) return; Initialized = true; // create binding manager Bindings = new BindingManager(this); //ErrorText = FindViewById<TextView>(Resource.Id.ErrorText); var saveButton = FindViewById<Button>(Resource.Id.SaveButton); saveButton.Click += SaveButton_Click; var cancelButton = FindViewById<Button>(Resource.Id.CancelButton); cancelButton.Click += CancelButton_Click; var deleteButton = FindViewById<Button>(Resource.Id.DeleteButton); deleteButton.Click += DeleteButton_Click; var dialog = new ProgressDialog(this); dialog.SetMessage(Resources.GetString(Resource.String.Loading)); dialog.SetCancelable(false); dialog.Show(); try { var customerEdit = await Library.CustomerEdit.GetCustomerEditAsync(1); InitializeBindings(customerEdit); } catch (Exception ex) { var alert = new AlertDialog.Builder(this); alert.SetMessage(string.Format(Resources.GetString(Resource.String.Error), ex.Message)); alert.Show(); } finally { dialog.Hide(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //先初始化BMapManager DemoApplication app = (DemoApplication)this.Application; if (app.mBMapManager == null) { app.mBMapManager = new BMapManager(this); app.mBMapManager.Init( new DemoApplication.MyGeneralListener()); } SetContentView(Resource.Layout.activity_panorama_main); mPanoramaView = FindViewById<PanoramaView>(Resource.Id.panorama); //UI初始化 mBtn = FindViewById<Button>(Resource.Id.button); mBtn.Visibility = ViewStates.Invisible; //道路名 mRoadName = FindViewById<TextView>(Resource.Id.road); mRoadName.Visibility = ViewStates.Visible; mRoadName.Text = "百度全景"; mRoadName.SetBackgroundColor(Color.Argb(200, 5, 5, 5)); //背景透明度 mRoadName.SetTextColor(Color.Argb(255, 250, 250, 250)); //文字透明度 mRoadName.TextSize = 22; //跳转进度条 pd = new ProgressDialog(this); pd.SetMessage("跳转中……"); pd.SetCancelable(true);//设置进度条是否可以按退回键取消 //初始化Searvice mService = PanoramaService.GetInstance(ApplicationContext); mCallback = new IPanoramaServiceCallbackImpl(this); //设置全景图监听 mPanoramaView.SetPanoramaViewListener(this); //解析输入 ParseInput(); }
async void LogInProcess(object sender, EventArgs e) { errormsg = FindViewById<TextView> (Resource.Id.errorMSG); if (Common.checkNWConnection (this) == true) { Exception error = null; if (!String.IsNullOrEmpty (username.Text) && !String.IsNullOrEmpty (password.Text)) { ProgressDialog dialog = new ProgressDialog (this); dialog.SetMessage ("Đăng nhập..."); dialog.Indeterminate = false; dialog.SetCancelable (false); dialog.Show (); error=await BUser.CheckAuth(username.Text,password.Text,SQLite_Android.GetConnection()); if (error==null) { Intent myintent = new Intent (this, typeof(DrawerActivity)); myintent.PutExtra ("FirstLoad", true); dialog.SetMessage ("Đang tải dữ liệu...."); await Common.LoadDataFromSV (this); StartActivity (myintent); this.Finish (); } else { dialog.Dismiss (); errormsg.Text = error.Message; } } else { errormsg.Text = "Vui lòng nhập đầy đủ thông tin đăng nhập"; } } else { errormsg.Text = "Không có kết nối mạng, vui lòng thử lại sau"; } }
async void LogInProcess(object sender, EventArgs e) { errormsg = FindViewById<TextView> (Resource.Id.errorMSG); if (!String.IsNullOrEmpty (username.Text) && !String.IsNullOrEmpty (password.Text)) { ProgressDialog dialog = new ProgressDialog (this); dialog.SetMessage ("Login..."); dialog.Indeterminate = false; dialog.SetCancelable (false); dialog.Show (); if (await BUser.CheckAuth (username.Text, password.Text, SQLite_Android.GetConnection ())) { Intent myintent = new Intent (this, typeof(DrawerActivity)); StartActivity (myintent); this.Finish (); } else { dialog.Dismiss (); errormsg.Text = "Mã Sinh Viên Hoặc Mật Khẩu Không Đúng!"; } } }
public void Show (Android.Content.Context context, string messageToShow) { try { string message; if (String.IsNullOrEmpty (messageToShow)) { message = "Laden..."; } else { message = messageToShow; } if (progressDialog != null) { progressDialog = null; } progressDialog = new ProgressDialog (context); progressDialog.Indeterminate = true; progressDialog.SetProgressStyle (ProgressDialogStyle.Spinner); progressDialog.SetMessage (message); progressDialog.SetCancelable (false); progressDialog.Show (); } catch (Exception ex){ Insights.Report(ex); } }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { ProgressDialog dialog = new ProgressDialog (Activity); dialog.SetTitle (Resource.String.dialogtitle); dialog.SetMessage (GetString (Resource.String.dialogmessage)); dialog.Indeterminate = true; dialog.SetCancelable (false); return dialog; }
public void init(){ var textFormat = Android.Util.ComplexUnitType.Px; _dialog = new ProgressDialog(this); //popupBuilder.SetView(_dialog); _dialog.SetMessage("Espere por favor..."); _dialog.SetCancelable(false); //_dialog.Show(); mainLayout = new RelativeLayout (this); relSingup = new RelativeLayout (this); relLogin = new RelativeLayout (this); linearLicencia = new LinearLayout (this); linearLogin = new LinearLayout (this); linearSingup = new LinearLayout (this); linearLogo = new LinearLayout (this); imgLogo = new ImageView (this); btnLogin = new ImageButton (this); btnSingUp = new ImageButton (this); btnFacebook = new ImageButton (this); chkLogin = new CheckBox (this); txtLicencia_a = new TextView (this); txtLicencia_b = new TextView (this); txtlogin_a1 = new TextView (this); txtlogin_a2 = new TextView (this); txtlogin_b1 = new TextView (this); txtlogin_b2 = new TextView (this); txtlogin_c1 = new TextView (this); txtlogin_c2 = new TextView (this); initText (txtlogin_a1, "", "#00c6ff"); txtlogin_a1.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); initText (txtlogin_a2, "", "#ffffff"); txtlogin_a2.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); initText (txtlogin_b1, "", "#00c6ff"); txtlogin_b1.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); initText (txtlogin_b2, "","#ffffff"); txtlogin_b2.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); initText (txtlogin_c1, "", "#00c6ff"); txtlogin_c1.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); initText (txtlogin_c2, "", "#ffffff"); txtlogin_c2.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); linearTxta = new LinearLayout (this); linearTxtb = new LinearLayout (this); linearTxtc = new LinearLayout (this); linearContentText = new LinearLayout (this); linearTxta.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearTxtb.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearTxtc.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearContentText.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearTxta.Orientation = Orientation.Horizontal; linearTxta.SetGravity (GravityFlags.Center); linearTxtb.Orientation = Orientation.Horizontal; linearTxtb.SetGravity (GravityFlags.Center); linearTxtc.Orientation = Orientation.Horizontal; linearTxtc.SetGravity (GravityFlags.Center); linearContentText.Orientation = Orientation.Vertical; linearContentText.SetGravity (GravityFlags.Center); linearTxta.AddView (txtlogin_a1); linearTxta.AddView (txtlogin_a2); linearTxtb.AddView (txtlogin_b1); linearTxtb.AddView (txtlogin_b2); linearTxtc.AddView (txtlogin_c1); linearTxtc.AddView (txtlogin_c2); linearContentText.AddView (linearTxta); linearContentText.AddView (linearTxtb); linearContentText.AddView (linearTxtc); mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1); Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/afondo.png"), 768, 1024, true)); mainLayout.SetBackgroundDrawable (d); relSingup.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1); relLogin.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1); linearLicencia.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent); linearLicencia.Orientation = Orientation.Horizontal; linearLicencia.SetGravity (GravityFlags.Center); linearLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent); linearLogin.Orientation = Orientation.Horizontal; linearLogin.SetGravity (GravityFlags.Right); linearSingup.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent); linearSingup.Orientation = Orientation.Vertical; linearSingup.SetGravity (GravityFlags.Center); linearLogo.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent); linearLogo.Orientation = Orientation.Vertical; linearLogo.SetGravity (GravityFlags.Center); txtLicencia_a.Text = "TO REGISTER, ACCEPT THE"; txtLicencia_a.SetTextSize(textFormat,Configuration.getHeight(25)); txtLicencia_a.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtLicencia_a.SetTextColor (Color.ParseColor ("#ffffff")); txtLicencia_b.Text = " TERMS OF USE"; txtLicencia_b.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtLicencia_b.SetTextSize(textFormat,Configuration.getHeight(25)); txtLicencia_b.SetTextColor (Color.ParseColor ("#00c6ff")); chkLogin.Checked = false; chkLogin.SetBackgroundColor(Color.ParseColor("#ffffff")); imgLogo.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/logo.png"), Configuration.getWidth(360), Configuration.getHeight(230),true)); btnLogin.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/login.png"), Configuration.getWidth(210), Configuration.getHeight(60),true)); btnFacebook.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signupface.png"), Configuration.getWidth(507), Configuration.getHeight(80),true)); btnSingUp.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signupnolisto.png"), Configuration.getWidth(507), Configuration.getHeight(80),true)); Drawable dc = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/toregister.png"), Configuration.getWidth(47), Configuration.getHeight(47), true)); chkLogin.SetBackgroundDrawable (dc); initButtonColor (btnLogin); initButtonColor (btnFacebook); initButtonColor (btnSingUp); linearLicencia.AddView (chkLogin); linearLicencia.AddView (txtLicencia_a); linearLicencia.AddView (txtLicencia_b); linearLogin.AddView (btnLogin); linearSingup.AddView (linearLicencia); linearSingup.AddView (btnSingUp); linearSingup.AddView (btnFacebook); linearLogo.AddView (imgLogo); linearLogo.SetX (0); linearLogo.SetY (Configuration.getHeight(373)); linearContentText.SetX (0); linearContentText.SetY (Configuration.getHeight(557)); linearLogin.SetX (0); linearLogin.SetY (Configuration.getHeight(30)); linearSingup.SetX (0); linearSingup.SetY (Configuration.getHeight(785)); relSingup.AddView (linearLogo); relSingup.AddView (linearContentText); relSingup.AddView (linearLogin); relSingup.AddView (linearSingup); mainLayout.AddView (relSingup); btnSingUp.Click+= delegate { if(chkLogin.Checked==true){ var com = ((LoginViewModel)this.DataContext).SignUpCommand; com.Execute(null); } }; btnLogin.Click+= BtnLogin_Click; btnFacebook.Click += async delegate { await Authenticate(MobileServiceAuthenticationProvider.Facebook); /*var com = ((LoginViewModel)this.DataContext).FacebookLoginCommand; com.Execute(null); */ }; chkLogin.CheckedChange += delegate { if(chkLogin.Checked==true){ btnSingUp.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signuplisto.png"), Configuration.getWidth(507), Configuration.getHeight(80),true)); } if(chkLogin.Checked==false){ btnSingUp.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signupnolisto.png"), Configuration.getWidth(507), Configuration.getHeight(80),true)); } }; }
private void StartVolumeCountdown() { reading = false; StopAction(true); const string message = " seconds remaining...\nTalk as loudly as possible!"; const int startNum = 10; int remaining = startNum; ProgressDialog countDialog = null; RunOnUiThread(() => { countDialog = new ProgressDialog(this); countDialog.SetMessage(remaining + message); countDialog.SetProgressStyle(ProgressDialogStyle.Horizontal); countDialog.SetCancelable(false); countDialog.Indeterminate = false; countDialog.Progress = 0; countDialog.Max = startNum; countDialog.Show(); }); audioManager.StartRecording(AppData.TempRecording.Path, 300); double[] vols = new double[startNum*5]; while (remaining > 0) { if (countDialog == null) { // Wait until the GUI thread has created the dialog window Thread.Sleep(10); continue; } RunOnUiThread(() => { countDialog.SetMessage(remaining + message); countDialog.IncrementProgressBy(1); }); int countStart = (startNum - remaining)*vols.Length/startNum; for (int i = countStart; i < countStart + vols.Length/startNum; i++) { Thread.Sleep(200); vols[i] = audioManager.GetAmplitude(); } remaining--; } audioManager.StopRecording(); double total = 0; foreach (double vol in vols) { total += vol; } loudTargetVol = (int) (total/vols.Length); RunOnUiThread(() => { countDialog.Hide(); }); }
/// <summary> /// Pulls today's featured wikipedia article /// </summary> private async void LoadWikiInfo() { ProgressDialog dialog = new ProgressDialog(this); dialog.SetTitle("Please Wait..."); dialog.SetMessage("Downloading today's content!"); dialog.SetCancelable(false); dialog.Show(); wiki = await AndroidUtils.GetTodaysWiki(this); if (wikiImage != null && wiki.imageURL != null) { if (!File.Exists(wiki.imageURL)) { // Force update, file has been deleted somehow wiki = await ServerData.FetchWikiData(AndroidUtils.DecodeHTML); } wikiImage.SetImageURI(Android.Net.Uri.FromFile(new Java.IO.File(wiki.imageURL))); wikiImage.Visibility = ViewStates.Visible; } else if(wikiImage != null) { wikiImage.Visibility = ViewStates.Gone; } string[] sentences = wiki.content.Split(new[] {". "}, StringSplitOptions.RemoveEmptyEntries); string finalText = ""; int charTarget = 400; foreach (string sentence in sentences) { if (finalText.Length < charTarget && finalText.Length + sentence.Length < 570) { finalText += sentence + ". "; } else { break; } } wikiText.Text = finalText; // If it's longer than expected, reduce the text size! if (finalText.Length > 520) { if ((Resources.Configuration.ScreenLayout & Android.Content.Res.ScreenLayout.SizeMask) <= Android.Content.Res.ScreenLayout.SizeNormal) { wikiText.SetTextSize(Android.Util.ComplexUnitType.Sp, 15); } else { wikiText.SetTextSize(Android.Util.ComplexUnitType.Sp, 19); } } SwitchMode(ServerData.TaskType.Loudness); dialog.Hide(); }