private void RefreshProgressDialogAndToastWhenInputForEgnAndBillNumberIsIncorrect() { mError.Text = "Въведете коректни данни"; mError.Visibility = ViewStates.Visible; progress.Dismiss(); }
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(); } }
private void SentAccindentSignelToApi() { ConnectToApi connectToApi = new ConnectToApi(); bool connection = connectToApi.CheckConnectionOfVikSite(); if (mCity.Text.Trim().Length > 0 && mAddress.Text.Trim().Length > 0 && mDescription.Text.Trim().Length > 0 && mPhoneNumber.Text.Trim().Length > 0 && mFullName.Text.Trim().Length > 0) { #region old stuff //// casting imageview to bitmap //Android.Graphics.Drawables.BitmapDrawable bd = // (Android.Graphics.Drawables.BitmapDrawable)pic.Drawable; //Android.Graphics.Bitmap bitmap = bd.Bitmap; //using (var stream = new MemoryStream()) //{ // bitmap.Compress(Bitmap.CompressFormat.Jpeg, 0, stream); // PostItem(stream); //} #endregion if (connection == true) { if (mSaveImageUri != null) { Stream stream = ContentResolver.OpenInputStream(mSaveImageUri); PostAccidentToDB(stream); } else { Stream stream = null; PostAccidentToDB(stream); } //else //{ // PostAccidentToDBwithoutImage(); //} } else { RunOnUiThread(() => RefreshProgressDialogAndToastWhenThereIsNoInternet()); } } else { progress.Dismiss(); Looper.Prepare(); //Toast.MakeText(this, "Попълнете полетата", ToastLength.Long); RunOnUiThread(() => { UpdateError(); }); } }
private void RefreshProgressDialogAndToatWhenThereIsNoCustomers() { mHour.Visibility = ViewStates.Gone; mDate.Visibility = ViewStates.Gone; mObnoveniKum.Visibility = ViewStates.Gone; mAbonati.Text = "Моля добавете абонати"; Toast.MakeText(this, "Няма абонати за обновяване", ToastLength.Long).Show(); progress.Dismiss(); }
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(); }
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)); }; }
protected async override void OnResume () { try { base.OnResume (); ProgressDialogLogin = ProgressDialog.Show(this, "", "Loading..."); await GetWorkshops(); if (ProgressDialogLogin != null) { ProgressDialogLogin.Dismiss(); ProgressDialogLogin = null; } } catch (Exception e) { ErrorHandling.LogError (e, this); } finally { if (ProgressDialogLogin != null) { ProgressDialogLogin.Dismiss(); ProgressDialogLogin = null; } } }
protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // shows a spinner while it gets polls from database var progressDialog = new ProgressDialog(this); progressDialog.Show(); { try { // gets all the polls from the database polls = await VotingService.MobileService.GetTable<Poll>().ToListAsync(); } catch (Exception exc) { // error dialog that shows if something goes wrong var errorDialog = new AlertDialog.Builder(this).SetTitle("Oops!").SetMessage("Something went wrong " + exc.ToString()).SetPositiveButton("Okay", (sender1, e1) => { }).Create(); errorDialog.Show(); } }; // ends spinner on completion progressDialog.Dismiss(); // created table for polls ListAdapter = new ArrayAdapter<Poll>(this, Android.Resource.Layout.SimpleListItem1, polls); }
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(); } }; }
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; }
protected override void OnResume () { base.OnResume (); Log.Debug (logTag, "ActivityBase.OnCreate."); if (!App.Current.IsInitialized){ Log.Debug(logTag, "ActivityBase.App is NOT initialized"); // show the loading overlay on the UI thread progress = ProgressDialog.Show(this, "Loading", "Please Wait...", true); // when the app has initialized, hide the progress bar and call Finished Initialzing initializedEventHandler = (s, e) => { // call finished initializing so that any derived activities have a chance to do work RunOnUiThread( () => { this.FinishedInitializing(); // hide the progress bar if (progress != null) progress.Dismiss(); }); }; App.Current.Initialized += initializedEventHandler; } else { Log.Debug(logTag, "ActivityBase.App is initialized"); } }
public static void ProgressDialogDismiss(this FragmentActivity fragmentActivity, Android.App.ProgressDialog dialog) { Log.Debug(TAG, nameof(ProgressDialogDismiss)); fragmentActivity.RunOnUiThread(() => { Log.Debug(TAG, "[3] Closing dialog."); if (dialog != null) { if (dialog.IsShowing) { Log.Debug(TAG, string.Format($"--{nameof(ProgressDialogDismiss)}: dialog - IsShowing")); dialog.Dismiss(); } else { Log.Debug(TAG, string.Format($"--{nameof(ProgressDialogDismiss)}: dialog - NOT IsShowing")); } } else { Log.Debug(TAG, string.Format($"--{nameof(ProgressDialogDismiss)}: dialog is NULL")); } Log.Debug(TAG, "[4] Dialog closed."); }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); var groupName = Intent.GetStringExtra("name"); Title = groupName; GroupName = groupName; _contactRepo = new ContactRepository(this); _progressDialog = new ProgressDialog(this); _progressDialog.SetMessage("Loading Contacts. Please wait..."); _progressDialog.Show(); Task.Factory .StartNew(() => _contactRepo.GetAllMobile()) .ContinueWith(task => RunOnUiThread(() => { if (task.Result != null) DisplayContacts(task.Result); _progressDialog.Dismiss (); })); }
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; } }
public void HideLoadingDialog() { if (mProgressDialog.IsShowing) { mProgressDialog.Dismiss(); } }
async Task<bool> fnGetProfileInfoFromGoogle() { progress = ProgressDialog.Show (this,"","Please wait..."); bool isValid=false; //Google API REST request string userInfo = await fnDownloadString (string.Format(googUesrInfoAccessleUrl, access_token )); if ( userInfo != "Exception" ) { googleInfo = JsonConvert.DeserializeObject<GoogleInfo> ( userInfo ); isValid = true; } else { if ( progress != null ) { progress.Dismiss (); progress = null; } isValid = false; Toast.MakeText ( this , "Connection failed! Please try again" , ToastLength.Short ).Show (); } if ( progress != null ) { progress.Dismiss (); progress = null; } return isValid; }
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 void CancelDelete() { progress = ProgressDialog.Show(this, "Обработка...", "Пожалуйста, подождите.", true); if (hospital.ID != 0) { HospitalManager.DeleteHospital(hospital.ID); } progress.Dismiss(); Finish(); }
protected void hideProgressDialog() { if (progressDialog == null) { return; } progressDialog.Dismiss(); }
protected void CancelDelete() { progress = ProgressDialog.Show(this, "Обработка...", "Пожалуйста, подождите.", true); if (doctor.ID != 0) { DoctorManager.DeleteDoctor(doctor.ID); } progress.Dismiss(); Finish(); }
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(); } }
private void SentAccindentSignelToApi() { ConnectToApi connectToApi = new ConnectToApi(); bool connection = connectToApi.CheckConnectionOfVikSite(); if (mCity.Text.Trim().Length > 0 && mAddress.Text.Trim().Length > 0 && mDescription.Text.Trim().Length > 0 && mPhoneNumber.Text.Trim().Length > 0 && mFullName.Text.Trim().Length > 0) { if (connection == true) { // sent with a pic if (mSaveImageUri != null) { Stream stream = ContentResolver.OpenInputStream(mSaveImageUri); PostAccidentToDB(stream); } // sent without a pic else { Stream stream = null; PostAccidentToDB(stream); } } else { RunOnUiThread(() => RefreshProgressDialogAndToastWhenThereIsNoInternet()); } } else { progress.Dismiss(); Looper.Prepare(); RunOnUiThread(() => { UpdateError(); }); } }
private async void getVacancyList() { ResDataVacancy response = await vacancy_ApI.GetVacancyList(); myvacancyList = response.res_datavacancy; mLayoutManager = new LinearLayoutManager(this); MyVacancyRecyclerview.SetLayoutManager(mLayoutManager); VacancyFragmentAdapter mAdapter = new VacancyFragmentAdapter(this, myvacancyList, MyVacancyRecyclerview); mAdapter.ItemClick += MAdapter_ItemClick; MyVacancyRecyclerview.SetAdapter(mAdapter); progress.Dismiss(); }
private async void BotonConsultar_Click(object sender, EventArgs e) { progress = new Android.App.ProgressDialog(this.Context); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Consultando...Espere..."); progress.SetCancelable(false); progress.Show(); if (!string.IsNullOrEmpty(txtnroTicket.Text)) { var dato = await controller.ConsultaReserva(int.Parse(txtnroTicket.Text)); if (dato != null) { txtpelicula.Text = dato.nombre_peli; txtlocal.Text = dato.nombre_local; txtsala.Text = dato.num_sala + ""; txtinicio.Text = dato.inicio; txtfin.Text = dato.fin; txtdnicliente.Text = dato.dni; txtnombrecliente.Text = dato.nom_cliente; progress.Dismiss(); } else { progress.Dismiss(); Toast.MakeText(this.Context, "Reserva no encontrada", ToastLength.Long).Show(); LimpiarCasillas(); } } else { progress.Dismiss(); Toast.MakeText(this.Context, "Campo vacio", ToastLength.Long).Show(); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: OnBackPressed(); break; case Resource.Id.save_image: progress = new ProgressDialog (this); progress.SetMessage ("Загрузка..."); progress.Show(); Task.Factory.StartNew (async () => { try{ await WebClient.CreateRealFileAsync(_fileUrl); RunOnUiThread(()=>{ progress.Dismiss(); }); } catch (Exception ex) { RunOnUiThread(()=>{ progress.Dismiss(); Toast.MakeText(Application.Context,"Ошибка сохранения",ToastLength.Short).Show(); }); } }); break; case Resource.Id.copy_link: ClipboardManager clipManager = (ClipboardManager)GetSystemService (ClipboardService); ClipData clip = ClipData.NewPlainText ("url", _fileUrl); clipManager.PrimaryClip = clip; break; default: return base.OnOptionsItemSelected(item); } return true; }
private async void checkHealth() { try { var baseAddress = new Uri("https://private-anon-b578fa752f-blissrecruitmentapi.apiary-mock.com/health"); using (var httpClient = new HttpClient { BaseAddress = baseAddress }) { progress = new Android.App.ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading..."); progress.SetCancelable(false); progress.Show(); HttpResponseMessage response = await httpClient.GetAsync(httpClient.BaseAddress); if (response.IsSuccessStatusCode) { progress.Dismiss(); var listScreen = new Intent(this, typeof(ListScreen)); StartActivity(listScreen); } else { progress.Dismiss(); var Retry = new Intent(this, typeof(RetryScreen)); StartActivity(Retry); } } } catch (Exception ex) { return; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.ProgressDialog); progress = ProgressDialog.Show(this, "Loading...", "Please Wait (about 4 seconds)", true); new Thread(new ThreadStart(() => { Thread.Sleep(4 * 1000); this.RunOnUiThread ( () => { FindViewById<TextView>(Resource.Id.Text1).Text = "...and we're done!"; progress.Dismiss(); }); })).Start(); }
public void HideProgressMessage() { if (m_Progress != null) { if (spinners == 1) { m_Progress.Dismiss(); spinners = 0; m_Progress = null; } else { spinners--; } } }
protected override async void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Legend); CheckBox closestFilterCheckbox = FindViewById<CheckBox>(Resource.Id.chooseClosest); Boolean filterClosest = UserPreferencesHelper.getClosestSpotsFilter (); closestFilterCheckbox.Checked = filterClosest; closestFilterCheckbox.Click += (sender, args) => { if (closestFilterCheckbox.Checked) { UserPreferencesHelper.setClosestSpotsFilter (true); } else { UserPreferencesHelper.setClosestSpotsFilter (false); } }; _loadingDialog = LoadingDialogManager.ShowLoadingDialog (this); _crueltySpotCategoriesList = FindViewById<ListView> (Resource.Id.Legend); var crueltySpotCategoriesService = new CrueltySpotCategoriesService (); _crueltySpotCategories = await crueltySpotCategoriesService.GetAllAsync (); RunOnUiThread (() => { _loadingDialog.Dismiss (); _crueltySpotCategoriesList.Adapter = new LegendAdapter (this, _crueltySpotCategories); }); List<String> categories = UserPreferencesHelper.GetFilterCategories (); if (categories.Count () == 0) { foreach (CrueltySpotCategory category in _crueltySpotCategories) { categories.Add (category.ObjectId); } UserPreferencesHelper.SaveFilterCategories (categories); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case global::Android.Resource.Id.Home: var intent = new Intent(this, typeof(MainActivity)); intent.PutExtra ("defaultTab", 1); intent.AddFlags (ActivityFlags.ClearTop); StartActivity (intent); break; case Resource.Id.menuSaveGroup: _progressDialog = new ProgressDialog(this); _progressDialog.SetMessage("Saving SMS Group. Please wait..."); _progressDialog.Show(); Task.Factory .StartNew(SaveGroup) .ContinueWith(task => RunOnUiThread(() => { _progressDialog.Dismiss (); var homeIntent = new Intent(); homeIntent.PutExtra ("defaultTab", 1); homeIntent.AddFlags (ActivityFlags.ClearTop); homeIntent.SetClass (this, typeof(MainActivity)); StartActivity(homeIntent); })); break; case Resource.Id.menuCancelEdit: new AlertDialog.Builder(this) .SetTitle ("Cancel") .SetMessage ("Are you sure you want to cancel your changes for this SMS Group?") .SetPositiveButton ("Yes", (o, e) => { var homeIntent = new Intent(); homeIntent.PutExtra ("defaultTab", 1); homeIntent.AddFlags (ActivityFlags.ClearTop); homeIntent.SetClass (this, typeof(MainActivity)); StartActivity(homeIntent); }) .SetNegativeButton ("No", (o, e) => { }) .Show (); break; } return true; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); var groupId = Intent.GetIntExtra ("groupId", -1); GroupId = groupId; _progressDialog = new ProgressDialog(this); _progressDialog.SetMessage("Loading Contacts. Please wait..."); _progressDialog.Show(); Task.Factory .StartNew(() => GetContacts(groupId)) .ContinueWith(task => RunOnUiThread(() => { DisplayContacts(task.Result); _progressDialog.Dismiss (); })); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Noticias); 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(() => { lista = FindViewById <ListView>(Resource.Id.listView1); Contenido con = new Contenido(this, Noticias.RegresarTodas()); lista.Adapter = con; progress.Dismiss(); }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); _pd = ProgressDialog.Show (this, "Please wait...", "Querying Azure!"); ThreadPool.QueueUserWorkItem (delegate { var root = BuildRoot (kGetAllUrl); RunOnUiThread (delegate { var da = new DialogAdapter(this, root); var lv = new ListView(this) {Adapter = da}; SetContentView(lv); _pd.Dismiss (); _pd.Dispose (); }); }); }
private void RunAppInitializedEventHandler() { if (!App.Current.IsInitialized) { // show the loading overlay on the UI thread progress = ProgressDialog.Show(this, "Loading", "Please Wait...", true); // when the app has initialized, hide the progress bar and call Finished Initialzing initializedEventHandler = (s, e) => { // call finished initializing so that any derived activities have a chance to do work RunOnUiThread(() => { this.FinishedInitializing(); // hide the progress bar if (progress != null) progress.Dismiss(); }); }; App.Current.Initialized += initializedEventHandler; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button>(Resource.Id.myButton); button.Click += async delegate { progress = new ProgressDialog(this) { Indeterminate = true }; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Carregando informações do tempo..."); progress.SetCancelable(false); progress.Show(); var _api = new WeatherAPI(); var currentWeather = await _api.GetWeather(); Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this); progress.Dismiss(); alert.SetTitle("Aviso sobre o tempo"); alert.SetMessage($"a temperatura atual é: {Math.Round(currentWeather.TempInCelsius, 0).ToString()}"); alert.SetPositiveButton("OK", (sender, e) => { }); Dialog dialog = alert.Create(); dialog.Show(); }; }
async void LoadData() { process = ProgressDialog.Show(this, "Loading", "Loading data from SharePoint List..."); if (App.IncidentId == -1) { int availableIncidentId = await ListHelper.GetAvailableIncidentId (); if (availableIncidentId > 0) { App.IncidentId = availableIncidentId; process.Dismiss (); LoadData (); return; } else { Toast.MakeText (this, "Incident no found", ToastLength.Long).Show (); } } else { int propertyId = await ListHelper.GetPropertyIdByIncidentId(); if (propertyId > 0) { App.PropertyId = propertyId.ToString(); incidents = await ListHelper.GetIncidents(); if (incidents != null && incidents.Any()) { LoadPropertyPhoto(); LoadIncidentPhoto(); BindPropertyData(); BindIncidentData(); } } else { Toast.MakeText(this, "The incident with ID "+ App.IncidentId +" was not find.", ToastLength.Long).Show(); } } process.Dismiss(); }
//protected override void OnCreate (Android.OS.Bundle savedInstanceState) protected override void OnResume () { base.OnResume (); //base.OnCreate (savedInstanceState); Log.Debug (logTag, "ActivityBase.OnResume."); if (!App.Current.IsInitialized){ Log.Debug(logTag, "ActivityBase.App is NOT initialized"); // if we're to restart on the main activty, and this isn't it, do so if (App.Current.RestartMainActivityOnCrash && (this.GetType() != typeof(MainActivity))){ // Log.Debug (logTag, "ActivityBase.Not MainActivity, heading home"); this.RestartApp(); return; } else { // show the loading overlay on the UI thread progress = ProgressDialog.Show(this, "Loading", "Please Wait...", true); initializedEventHandler = (s, e) => { // call finished initializing so that any derived activities have a chance to do work RunOnUiThread( () => { this.FinishedInitializing(); // hide the progress bar if (progress != null) progress.Dismiss(); }); }; // when the app has initialized, hide the progress bar and call Finished Initialzing App.Current.Initialized += initializedEventHandler; } } else { Log.Debug(logTag, "ActivityBase.App is initialized"); } }
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!"; } } }
private void DeleteMessage(MessageListItem selectedMessage) { _progressDialog = new ProgressDialog(Activity); _progressDialog.SetTitle ("Delete Message"); _progressDialog.SetMessage (string.Format ("Deleting Message with {0} recipients. Please wait...", selectedMessage.RecipientCount)); _progressDialog.Show (); Task.Factory .StartNew(() => { var messages = _messageRepo.GetAllForEvent (selectedMessage.SmsGroup.Id, selectedMessage.DateSent, selectedMessage.Text); messages.ForEach (message => _messageRepo.Delete (message)); }) .ContinueWith(task => Activity.RunOnUiThread(() => { _sortedItems = GetGroupedMessages (20); ListAdapter = new MessageListAdapter(Activity, _sortedItems); ((BaseAdapter)ListAdapter).NotifyDataSetChanged (); _progressDialog.Dismiss (); })); }
public async Task getDataFromServer() { //if (ic.connectivity()) //{ progress.Show(); dynamic value = new ExpandoObject(); value.task_id = task_id_to_send; string json = JsonConvert.SerializeObject(value); try { JsonValue item = await restService.GetComplianceTask(Activity, json, geolocation); comp = JsonConvert.DeserializeObject <ComplianceModel>(item); //db.ComplianceInsert(compliance); progress.Dismiss(); } catch (Exception e) { progress.Dismiss(); } //} // List< ComplianceModel>comp= db.GetCompliance(task_id_to_send); shapes1 = JsonConvert.DeserializeObject <Shapes>(comp.shapes); task_id = comp.task_id; task_description = comp.description; deadline = comp.deadline_date; meatingid = comp.Meeting_ID; rownum = comp.RowNo; //taskcreationDate = comp.task_creation_date; markby = comp.task_mark_by; taskstatus = comp.taskStatus; markto = comp.markTo; markingtype = comp.task_marking_type; taskcreatedby = comp.task_created_by; markingDate = comp.MarkingDate; creationdate = comp.task_creation_date; shapes_from_Comp = comp.shapes; task_name = comp.task_name; List <ComplianceJoinTable> lstAddedCompliance = comp.lstAddedCompliance; List <CommunicationModel> lstCommunication = comp.lstCommunication; List <TaskFilemappingModel2> lstTaskFileMapping = comp.lstTaskFileMapping; List <Comp_AttachmentModel> lstUploadedCompliance = comp.lstUploadedCompliance; image_lst = new List <ComplianceJoinTable>(); audio_lst = new List <ComplianceJoinTable>(); video_lst = new List <ComplianceJoinTable>(); for (int i = 0; i < lstAddedCompliance.Count; i++) { if (lstAddedCompliance[i].file_type.Equals("Image")) { image_lst.Add(lstAddedCompliance[i]); img_max += lstAddedCompliance[i].max_numbers; try { if (lstAddedCompliance[i].complianceType.ToLower().Equals("mandatory")) { img_min += lstAddedCompliance[i].max_numbers; } } catch (Exception e) { } } else if (lstAddedCompliance[i].file_type.Equals("Audio")) { audio_lst.Add(lstAddedCompliance[i]); aud_max += lstAddedCompliance[i].max_numbers; try { if (lstAddedCompliance[i].complianceType.ToLower().Equals("mandatory")) { aud_min += lstAddedCompliance[i].max_numbers; } } catch (Exception e) { } } else if (lstAddedCompliance[i].file_type.Equals("Video")) { video_lst.Add(lstAddedCompliance[i]); vdo_max += lstAddedCompliance[i].max_numbers; try { if (lstAddedCompliance[i].complianceType.ToLower().Equals("mandatory")) { vdo_min += lstAddedCompliance[i].max_numbers; } } catch (Exception e) { progress.Dismiss(); } } } for (int j = 0; j < lstCommunication.Count; j++) { if (lstCommunication[j].role.Equals("Assigner")) { mark_by_num = lstCommunication[j].mobile; } if (lstCommunication[j].role.Equals("Creator")) { creat_by_num = lstCommunication[j].mobile; } } // db.InsertCreatecomplianceAttachData(lstTaskFileMapping, task_id_to_send); audio_comp_lst = new List <Comp_AttachmentModel>(); video_comp_lst = new List <Comp_AttachmentModel>(); image_comp_lst = new List <Comp_AttachmentModel>(); for (int l = 0; l < lstUploadedCompliance.Count; l++) { if (lstUploadedCompliance[l].file_type.Equals("Video")) { video_comp_lst.Add(lstUploadedCompliance[l]); } if (lstUploadedCompliance[l].file_type.Equals("Audio")) { audio_comp_lst.Add(lstUploadedCompliance[l]); } if (lstUploadedCompliance[l].file_type.Equals("Image")) { image_comp_lst.Add(lstUploadedCompliance[l]); } } descrip_text.Text = task_description; createdby_text.Text = taskcreatedby; markby_text.Text = markby; creationdate_text.Text = creationdate; deadline_text.Text = deadline; name_text.Text = task_name; uploadimage.Text = image_comp_lst.Count.ToString(); uploadaudio.Text = audio_comp_lst.Count.ToString(); uploadvideo.Text = video_comp_lst.Count.ToString(); //if(!task_description.Equals("") && task_description != null) //{ // ll_task_desc.Visibility = ViewStates.Visible; // task_desc.Text = task_description; //} //else //{ // ll_task_desc.Visibility = ViewStates.Gone; //} Image_no.Text = img_max.ToString(); Video_no.Text = vdo_max.ToString(); Audio_no.Text = aud_max.ToString(); adapter1 = new GridViewAdapter_Image(Activity, image_comp_lst, FragmentManager); Gridview1.Adapter = adapter1; adapter2 = new GridViewAdapter_Video(Activity, video_comp_lst, FragmentManager); Gridview2.Adapter = adapter2; adapter3 = new GridViewAdapter_Audio(Activity, audio_comp_lst, FragmentManager); Gridview3.Adapter = adapter3; progress.Dismiss(); }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.My_BackgroundReports); _progressDialog = new ProgressDialog(this); _progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); _progressDialog.SetMessage("Loading Team . . ."); _progressDialog.Show(); //If the device is portrait, then show the RecyclerView in a vertical list, //else show it in horizontal list. _layoutManager = Resources.Configuration.Orientation == Android.Content.Res.Orientation.Portrait ? new LinearLayoutManager(this, LinearLayoutManager.Vertical, false) : new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false); //Experiement with a GridLayoutManger! You can create some cool looking UI! //This create a gridview with 2 rows that scrolls horizontally. // _layoutManager = new GridLayoutManager(this, 2, GridLayoutManager.Horizontal, false); //Create a reference to our RecyclerView and set the layout manager; _recyclerView = FindViewById<RecyclerView>(Resource.Id.mainActivity_recyclerView); _recyclerView.SetLayoutManager(_layoutManager); //Get our crew member data. This could be a web service. SharedData.CrewManifest = await BackgroundCheck_List_Data.GetAllCrewAsync(); //Create the adapter for the RecyclerView with our crew data, and set //the adapter. Also, wire an event handler for when the user taps on each //individual item. _adapter = new BackgroundCheckRecyclerViewAdapter(SharedData.CrewManifest, this.Resources); _adapter.ItemClick += OnItemClick; _recyclerView.SetAdapter(_adapter); _progressDialog.Dismiss(); mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar); mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById<ListView>(Resource.Id.left_drawer); mRightDrawer = FindViewById<ListView>(Resource.Id.right_drawer); mLeftDrawer.Tag = 0; mRightDrawer.Tag = 1; SetSupportActionBar(mToolbar); mLeftDataSet = new List<string>(); mLeftDataSet.Add(GetString(Resource.String.my_profile)); mLeftDataSet.Add(GetString(Resource.String.log_out)); mLeftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet); mLeftDrawer.Adapter = mLeftAdapter; //this.mLeftDrawer.ItemClick += mLeftDrawer_ItemClick; //this.mRightDrawer.ItemClick += mRightDrawer_ItemClick; mRightDataSet = new List<string>(); mRightDataSet.Add(GetString(Resource.String.drawer_faq)); mRightDataSet.Add(GetString (Resource.String.support)); mRightDataSet.Add(GetString(Resource.String.rentproof_summary)); mRightAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mRightDataSet); mRightDrawer.Adapter = mRightAdapter; mDrawerToggle = new NavigationBar( this, //Host Activity mDrawerLayout, //DrawerLayout Resource.String.openDrawer, //Opened Message Resource.String.closeDrawer //Closed Message ); mDrawerLayout.SetDrawerListener(mDrawerToggle); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetDisplayShowTitleEnabled(true); mDrawerToggle.SyncState(); if (bundle != null){ if (bundle.GetString("DrawerState") == "Opened"){ SupportActionBar.SetTitle(Resource.String.openDrawer); } else{ SupportActionBar.SetTitle(Resource.String.closeDrawer); } } else{ //This is the first the time the activity is ran SupportActionBar.SetTitle(Resource.String.closeDrawer); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); base.OnCreateView (inflater, container, savedInstanceState); dates = SyncQueueManager.GetAvailableDates (); View view = inflater.Inflate (Resource.Layout.SyncFragment, container, false); SavedInflater = inflater; spnDates = view.FindViewById<Spinner> (Resource.Id.sfSelectedDateSpinner); spnDates.Adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, SyncQueueManager.DatesToString(dates)); spnDates.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { // TextView tv = (TextView) e.View; selectedDate = dates[e.Position]; Toast.MakeText(Activity, selectedDate.ToString(@"d"), ToastLength.Short).Show(); queue = (List<SyncQueue>) SyncQueueManager.GetSyncQueue(dates[e.Position]); RefreshContent(); }; llSyncItems = view.FindViewById<LinearLayout> (Resource.Id.sfList); ivSync = view.FindViewById<ImageView> (Resource.Id.sfSyncImage); ivSync.Click += (object sender, EventArgs e) => { progressDialog = ProgressDialog.Show(Activity, "", "Loading rooms...", true); progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); new Thread(new ThreadStart(delegate { //LOAD METHOD TO GET ACCOUNT INFO Activity.RunOnUiThread(() => progressDialog.SetMessage(@"Начало загрузки информации о посещениях")); UpLoadAttendances(); UpLoadAttendanceResults(); UpLoadAttendancePhotos(); //HIDE PROGRESS DIALOG Activity.RunOnUiThread(() => { progressDialog.SetMessage(@"Обновление данных"); RefreshContent(); progressDialog.Dismiss(); }); //progressBar.Visibility = ViewStates.Gone); })).Start(); }; Activity.Window.AddFlags (WindowManagerFlags.KeepScreenOn); return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); Parse.Initialize (this, ParseCredentials.ApplicationID, ParseCredentials.ClientKey); DensityExtensions.Initialize (this); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); var signInBtn = FindViewById<Button> (Resource.Id.SignInButton); var signUpBtn = FindViewById<Button> (Resource.Id.SignUpButton); var userEntry = FindViewById<EditText> (Resource.Id.EmailEntry); var passwordEntry = FindViewById<EditText> (Resource.Id.PasswordEntry); /* If the user is already logged in, we show a blank landing page * (as there is a bit of delay when acquiring the TabPerson * so this activity content is still shown). */ if (ParseUser.CurrentUser != null) { signInBtn.Visibility = signUpBtn.Visibility = userEntry.Visibility = passwordEntry.Visibility = ViewStates.Invisible; ParseUser.CurrentUser.RefreshInBackground (null); LaunchApp (this, ParseUser.CurrentUser, null); } profile = UserProfile.Instantiate (this); SignupTimer timer = null; userEntry.AfterTextChanged += (sender, e) => { var login = userEntry.Text; if (string.IsNullOrEmpty (login)) return; if (timer != null) timer.Cancel (); timer = new SignupTimer (1000, 1000, () => { var usernameChecker = CheckLoginDisponibility (login); usernameChecker.ContinueWith (t => { if (userEntry.Text == login) signUpBtn.Enabled = t.Result; }, TaskContinuationOptions.ExecuteSynchronously); }); timer.Start (); }; var initialEmail = profile.PrimayAddress ?? (profile.Emails == null ? null : profile.Emails.FirstOrDefault ()) ?? null; if (!string.IsNullOrEmpty (initialEmail)) userEntry.Text = initialEmail; if (!string.IsNullOrEmpty (userEntry.Text)) passwordEntry.RequestFocus (); ProgressDialog spinDialog = new ProgressDialog (this) { Indeterminate = true }; spinDialog.SetCancelable (false); Action<ParseUser, ParseException> callback = (user, err) => { if (user == null || err != null) { Android.Util.Log.Debug ("Login", "User not recognized: {0}", (err != null) ? err.Message : string.Empty); spinDialog.Dismiss (); var builder = new AlertDialog.Builder (this); builder.SetMessage (Resource.String.login_error); builder.SetPositiveButton ("OK", (a, b) => passwordEntry.Text = string.Empty); builder.Create ().Show (); return; } Android.Util.Log.Debug ("Login", "User {0} successfully logged. New? {1}", user.Username, user.IsNew); LaunchApp (this, user, spinDialog.Dismiss); }; signInBtn.Click += (sender, e) => { spinDialog.SetMessage ("Signing in..."); spinDialog.Show (); ParseUser.LogInInBackground (userEntry.Text, passwordEntry.Text, new TabLoginCallback (callback)); }; signUpBtn.Click += (sender, e) => { spinDialog.SetMessage ("Signing up..."); spinDialog.Show (); var user = new ParseUser () { Username = userEntry.Text, Email = userEntry.Text }; user.SetPassword (passwordEntry.Text); user.SignUpInBackground (new TabSignUpCallback (user, callback)); }; }
private void SendInvites(List<Contact> toContactsList) { int count = 0; RunOnUiThread(delegate { dialog = new ProgressDialog(context); dialog.SetMessage(Application.Context.GetString(Resource.String.invitePBMessage)); dialog.SetTitle(Application.Context.GetString(Resource.String.invitePBTitle)); dialog.SetProgressStyle(ProgressDialogStyle.Horizontal); dialog.Max = toContactsList.Count; dialog.Progress = 0; dialog.Show(); }); switch (this.networkType) { case AccountOAuth.OAuthTypes.FaceBook: foreach (Contact eachContact in toContactsList) { try { string oauthID = string.Empty; for (int i = 0; i < eachContact.ContactOAuths.Count; i++) { if (eachContact.ContactOAuths [i].OAuthType == AccountOAuth.OAuthTypes.FaceBook) { oauthID = eachContact.ContactOAuths [i].OAuthID; break; } } #if(DEBUG) this.Provider.PostToFeed("Testing, nevermind. http://www.example.com", oauthID); #else this.Provider.PostToFeed (string.Format ( Application.Context.GetString (Resource.String.inviteFacebookPostMessageFormat), LOLConstants.LinkLOLAppWebsiteUrl), oauthID); #endif RunOnUiThread(delegate { dialog.Progress = (int)(++count / toContactsList.Count); }); } catch (Exception ex) { #if(DEBUG) System.Diagnostics.Debug.WriteLine("Exception inviting user: {0} {1}\n{2}--{3}", eachContact.ContactUser.FirstName, eachContact.ContactUser.LastName, ex.Message, ex.StackTrace); #endif } } break; case AccountOAuth.OAuthTypes.Google: case AccountOAuth.OAuthTypes.YouTube: if (toContactsList.Count > 0) { List<LOLConnectInviteEmail> emailInvites = new List<LOLConnectInviteEmail>(); emailInvites = toContactsList .Select(s => { return new LOLConnectInviteEmail() { ContactName = string.Format("{0} {1}", s.ContactUser.FirstName, s.ContactUser.LastName), EmailAddress = s.ContactUser.EmailAddress, OAuthType = this.networkType }; }) .ToList(); //RunOnUiThread(delegate { dialog.Progress = (int)(++count / toContactsList.Count); }); RunOnUiThread(() => Toast.MakeText(context, Application.Context.GetString(Resource.String.commonSendInvite), ToastLength.Short).Show()); LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.ContactsSendInviteEmailCompleted += Service_ContactsSendInviteEmailCompleted; service.ContactsSendInviteEmailAsync(emailInvites); }//end if break; case AccountOAuth.OAuthTypes.LinkedIn: if (toContactsList.Count > 0) { try { LLinkedInManager lMan = (LLinkedInManager)this.Provider; lMan.PostToFeed( StringUtils.CreateLinkedInXMLMessage(Application.Context.GetString(Resource.String.inviteLinkedInPostMessage), LOLConstants.LinkLOLAppWebsiteUrl, AndroidData.CurrentUser, lMan.GetUserProfileUrl()), string.Empty); RunOnUiThread(delegate { dialog.Progress = (int)(++count / toContactsList.Count); }); } catch (Exception ex) { #if(DEBUG) System.Diagnostics.Debug.WriteLine("Exception creating LinkedIn activity: {0}--{1}", ex.Message, ex.StackTrace); #endif } } break; } RunOnUiThread(delegate { if (dialog != null) dialog.Dismiss(); }); }
private void GetGooglePlusFriends() { LGooglePlusManager gMan = (LGooglePlusManager)this.Provider; RunOnUiThread(delegate { dialog = ProgressDialog.Show(context, Application.Context.GetString(Resource.String.contactsGetGoogle), Application.Context.GetString(Resource.String.contactsFinding), true); }); if (DateTime.Now.CompareTo(AndroidData.GoogleAccessTokenExpiration) > -1) { try { if (gMan.RefreshAccessToken()) { AndroidData.GooglePlusAccessToken = gMan.AccessToken; AndroidData.GoogleAccessTokenExpiration = gMan.AccessTokenExpirationTime.Value; } } catch (Exception ex) { string m = string.Format("{0} {1}", string.Format(Application.Context.GetString(Resource.String.errorRefreshingAccessTokenFormat), this.Provider.ProviderType), ex.Message); RunOnUiThread(delegate { if (dialog != null) dialog.Dismiss(); GeneralUtils.Alert(context, Application.Context.GetString(Resource.String.commonError), m); }); return; } } if (string.IsNullOrEmpty(gMan.AccessToken)) { #if DEBUG System.Diagnostics.Debug.WriteLine("AccessToken is null"); #endif return; } string responseXml = gMan.GetAllUserFriends(); if (string.IsNullOrEmpty(responseXml)) noFriends(); this.contacts = Parsers.ParseFriendsResponseGoogle(responseXml, out this.totalFriendCount); contacts = sortList(contacts); propogateListView(contacts); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); sounds = new List <MicSound>(); var tempSound1 = new MicSound(); tempSound1.sound_name = "..."; tempSound1.sound_settings = SoundsManager.NewSoundSettings(); //tempSound1.settings.Add("Push", true.ToString()); //tempSound1.settings.Add("ShowMessage", false.ToString()); //tempSound1.settings.Add("Vibrate", true.ToString()); //sounds.Add(tempSound1); SetContentView(Resource.Layout.page_sounds); var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); mRegistrationBroadcastReceiver = new Shared.BroadcastReceiver(); mRegistrationBroadcastReceiver.Receive += (sender, e) => { //progressDialog.Dismiss();5 var result = e.Intent.GetStringExtra("reply_error"); if (result == Shared.ServerResponsecode.STARTED_RECORDING.ToString()) { if (progressDialog != null) { progressDialog.Dismiss(); } //if (awaitingResponse == ExpectedResponse.NowRecording) { //progressDialog = Android.App.ProgressDialog.Show(this, "RECORDING...", "Play your sound...", true); Acr.UserDialogs.UserDialogs.Instance.Loading("RECORDING, Play your sound!"); awaitingResponse = ExpectedResponse.DoneRecording; } } else if (result == Shared.ServerResponsecode.DONE_RECORDING.ToString()) { if (progressDialog != null) { progressDialog.Dismiss(); } //if (awaitingResponse == ExpectedResponse.DoneRecording) { var progress = Acr.UserDialogs.UserDialogs.Instance.Progress(""); progress.Hide(); Acr.UserDialogs.UserDialogs.Instance.HideLoading(); Acr.UserDialogs.UserDialogs.Instance.ShowSuccess("Recording complete."); GetSoundList(); } } }; listView = FindViewById <ListView>(Resource.Id.soundsListView); listView.ItemClick += OnListItemClick; adapter = new SoundAdapter(this, sounds); listView.Adapter = adapter; LocalBroadcastManager.GetInstance(this).RegisterReceiver(mRegistrationBroadcastReceiver, new IntentFilter("reply_error")); //wavioId = savedInstanceState.GetString("id", ""); var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); wavioId = prefs.GetString("edit_mic_id", ""); GetSoundList(); }
async Task ParseAndDisplay(JsonValue json, String login_Id) { ISharedPreferencesEditor editor = prefs.Edit(); if (json != null && json != "") { List <LoginModel> lst = JsonConvert.DeserializeObject <List <LoginModel> >(json); for (int i = 0; i < lst.Count; i++) { try { detail = new LoginModel { OrganizationId = lst[i].OrganizationId, Organization = lst[i].Organization, OfficeId = lst[i].OfficeId, OfficeName = lst[i].OfficeName, NaturalPersonId = lst[i].NaturalPersonId, UserName = lst[i].UserName, NpToOrgRelationID = lst[i].NpToOrgRelationID, DesignationId = lst[i].DesignationId, NPPhoto = lst[i].NPPhoto, Designation = lst[i].Designation, MobileNumber = lst[i].MobileNumber, Message = lst[i].Message, ProjectArea = lst[i].ProjectArea, Controller = lst[i].Controller, ControllerAction = lst[i].ControllerAction, IsActive = lst[i].IsActive.ToString(), EmailAddress = lst[i].EmailAddress }; db.insertIntoTable(detail); //User_List.Add(detail); } catch (Exception e) { Log.Error("Error", e.Message); } } if (lst.Count == 1) { for (int i = 0; i < lst.Count; i++) { editor.PutString("OrganizationId", lst[0].OrganizationId); editor.PutString("Organization", lst[0].Organization); editor.PutString("OfficeId", lst[0].OfficeId); editor.PutString("OfficeName", lst[0].OfficeName); editor.PutString("NaturalPersonId", lst[0].NaturalPersonId); editor.PutString("UserName", lst[0].UserName); editor.PutString("NpToOrgRelationID", lst[0].NpToOrgRelationID); editor.PutString("DesignationId", lst[0].DesignationId); editor.PutString("Designation", lst[0].Designation); editor.PutString("MobileNumber", lst[0].MobileNumber); editor.PutString("NPPhoto", lst[0].NPPhoto); editor.PutString("EmailAddress", lst[0].EmailAddress); editor.PutString("LoginIdentity", lst[0].LoginIdentity); editor.Apply(); } username = prefs.GetString("UserName", ""); mobile = prefs.GetString("MobileNumber", ""); npid = prefs.GetString("NaturalPersonId", ""); //userid = prefs.GetString("") if (username != null && username != "") { register_data = new RegisterModel(); register_data.EmailID = email_id; register_data.selfiePath = selfie_path; register_data.ProvideId = provider_id; register_data.ProviderName = provider_name; register_data.MobileNumber = register_mobile; register_data.NPID = npid; register_data.Name = username; register_data.IsUpdate = update; string register_json = JsonConvert.SerializeObject(register_data); try { string isRegistered = await restService.RegisterUser(this, licenceid, geolocation, version, register_json).ConfigureAwait(false); progress.Dismiss(); if (isRegistered.Contains("Success")) { editor.PutBoolean("IsRegistered", true); editor.Commit(); Intent intent = new Intent(this, typeof(MainActivity)); intent.AddFlags(ActivityFlags.NewTask); StartActivity(intent); Finish(); } else { progress.Dismiss(); Toast.MakeText(this, "Try after some time", ToastLength.Short).Show(); } } catch (Exception ex) { progress.Dismiss(); Toast.MakeText(this, "Try after some time", ToastLength.Short).Show(); } } else { progress.Dismiss(); Toast.MakeText(this, "Invalid User name or Password", ToastLength.Short).Show(); } } else if (lst.Count > 1) { //editor.PutString("NaturalPersonId", lst[0].NaturalPersonId); Intent intent = new Intent(this, typeof(Switch_User)); intent.AddFlags(ActivityFlags.NewTask); StartActivity(intent); Finish(); } else { progress.Dismiss(); Toast.MakeText(this, "Invalid User name or Password", ToastLength.Short).Show(); } } else { progress.Dismiss(); Toast.MakeText(this, "Invalid User name or Password", ToastLength.Short).Show(); } }
private void AddNewCustomer() { RunOnUiThread(() => { mError.Visibility = ViewStates.Invisible; }); // get shared preferences ISharedPreferences pref = Application.Context.GetSharedPreferences("PREFERENCE_NAME", FileCreationMode.Private); // read exisiting value var customersJsonString = pref.GetString("Customers", null); // if preferences return null, initialize listOfCustomers if (customersJsonString == null || customersJsonString == "[]") { this.mCustomers = new List <Customer>(); } else { this.mCustomers = JsonConvert.DeserializeObject <List <Customer> >(customersJsonString); } // if deserialization return null, initialize listOfCustomers if (this.mCustomers == null) { this.mCustomers = new List <Customer>(); } #region add your object to list of customers string billNumber = mBillNumber.Text.ToString(); string egn = mEgn.Text.ToString(); if (mCustomers.Count < 5) { if (billNumber.ToString().Trim().Length > 3 && egn.ToString().Trim().Length > 9) { // there is customers in phone if (mCustomers.Count > 0) { AddNewCustomerWhenTheCollectionInNotEmpty(pref); } // there is no customers in phone else { AddOneCustomer(pref, ref billNumber, ref egn); } } // Incorrect egn or billNumber else { RunOnUiThread(() => RefreshProgressDialogAndToastWhenInputForEgnAndBillNumberIsIncorrect()); } } else { RunOnUiThread(() => { mError.Text = "Можете да добавяте до пет абоната"; mError.Visibility = ViewStates.Visible; progress.Dismiss(); } ); } #endregion }
public void RequestAddMic() { var progress = Acr.UserDialogs.UserDialogs.Instance.Progress("Registering mic..."); string hwid = Android.OS.Build.Serial; var SharedSettings = new Dictionary <String, String>(); var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); String gcmID = prefs.GetString("GCMID", ""); var wavioId = prefs.GetString("NewWavoID", ""); var wavioName = prefs.GetString("NewWavioName", ""); try { if (string.IsNullOrEmpty(wavioId)) { if (progressDialog != null) { progressDialog.Dismiss(); } Acr.UserDialogs.UserDialogs.Instance.ErrorToast("Error: No ID given!"); return; } if (string.IsNullOrEmpty(gcmID)) { if (progressDialog != null) { progressDialog.Dismiss(); } Acr.UserDialogs.UserDialogs.Instance.ErrorToast("Error: No GCM ID!"); return; } var client = new RestClient(Shared.SERVERURL); var request = new RestRequest("resource/{id}", Method.POST); var parameters = new Dictionary <string, string>(); parameters.Add(Shared.ParamType.REQUEST_CODE, Shared.RequestCode.REGISTER_MIC.ToString()); parameters.Add(Shared.ParamType.WAVIO_ID, wavioId); parameters.Add(Shared.ParamType.GCM_ID, gcmID); parameters.Add(Shared.ParamType.HWID, hwid); string requestJson = JsonConvert.SerializeObject(parameters); request.AddParameter(Shared.ParamType.REQUEST, requestJson); Console.WriteLine("Waiting for response"); client.ExecuteAsync(request, response => { ServerResponse serverResponse = JsonConvert.DeserializeObject <ServerResponse>(response.Content); if (serverResponse == null) { if (progressDialog != null) { progressDialog.Dismiss(); } Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!"); return; } progress.Hide(); if (serverResponse.error == Shared.ServerResponsecode.OK) { if (progressDialog != null) { progressDialog.Dismiss(); } var saveSuccess = MicsManager.AddMicToPreferences(wavioId, wavioName); if (saveSuccess) { } editor.PutBoolean("settings_changed", true); editor.PutBoolean("mic_added", true); editor.Apply(); NavUtils.NavigateUpFromSameTask(this); } else if (serverResponse.error == Shared.ServerResponsecode.DATABASE_ERROR) { if (progressDialog != null) { progressDialog.Dismiss(); } Acr.UserDialogs.UserDialogs.Instance.ShowError("Server error!"); } else { if (serverResponse.request != Shared.RequestCode.REGISTER_MIC) { if (progressDialog != null) { progressDialog.Dismiss(); } Acr.UserDialogs.UserDialogs.Instance.ShowError("Request type mismatch!"); return; } if (progressDialog != null) { progressDialog.Dismiss(); } Acr.UserDialogs.UserDialogs.Instance.ShowError("Unknown error!"); } return; }); } catch (WebException ex) { string _exception = ex.ToString(); if (progressDialog != null) { progressDialog.Dismiss(); } Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!"); Console.WriteLine("--->" + _exception); } }
void HideDialog() { progress.Dismiss(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Create your application here RequestWindowFeature (WindowFeatures.NoTitle); Window.AddFlags (WindowManagerFlags.KeepScreenOn); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Sync); // dates = SyncQueueManager.GetAvailableDatesDesc (); spnDates = FindViewById<Spinner> (Resource.Id.sfSelectedDateSpinner); // spnDates.Adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, SyncQueueManager.DatesToString(dates)); ArrayAdapter adapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleSpinnerItem, SyncQueueManager.DatesToString(dates)); adapter.SetDropDownViewResource (Resource.Layout.Spinner); spnDates.Adapter = adapter; spnDates.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { // TextView tv = (TextView) e.View; selectedDate = dates[e.Position]; Toast.MakeText(this, selectedDate.ToString(@"d"), ToastLength.Short).Show(); queue = (List<SyncQueue>) SyncQueueManager.GetSyncQueue(dates[e.Position]); RefreshContent(); }; llSyncItems = FindViewById<LinearLayout> (Resource.Id.sfList); ivSync = FindViewById<ImageView> (Resource.Id.sfSyncImage); ivSync.Click += (object sender, EventArgs e) => { //progressDialog = ProgressDialog.Show(this, "", "Загрузка информации на сервер", true); //progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); //int i = 0; // foreach (var item in queue) { // if (!item.isSync) { // File.Delete(item.fileLoacation); // SyncQueueManager.DeleteSyncQueue(item); // progressDialog.SetMessage(String.Format(@"Удалено id:{0}", item.id)); // i++; // } // } //SyncQueueManager.AddToQueue( new Attendance{ // progressDialog.SetMessage(String.Format(@"Удалено всего:{0}", i)); // Thread.Sleep(3000); // progressDialog.Dismiss(); progressDialog = ProgressDialog.Show(this, "", "Загрузка информации на сервер", true); progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); new Thread(new ThreadStart(delegate { //LOAD METHOD TO GET ACCOUNT INFO RunOnUiThread(() => progressDialog.SetMessage(@"Начало загрузки информации о посещениях")); UpLoadAttendances(); UpLoadAttendanceResults(); UpLoadAttendanceGPSPoints(); UpLoadAttendancePhotos(); SyncQueueManager.SaveSyncQueueToDisk(); //HIDE PROGRESS DIALOG RunOnUiThread(() => { progressDialog.SetMessage(@"Обновление данных"); RefreshContent(); progressDialog.Dismiss(); }); //progressBar.Visibility = ViewStates.Gone); })).Start(); }; }
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"; } }
public static void DismissProgressBar(Context context) { progress.Dismiss(); }
async void DeleteAllNotifications() { ProgressDialog progress = new ProgressDialog(Context); progress.Indeterminate = true; progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetMessage(Strings.clearing_notifications); progress.SetCancelable(false); progress.Show(); bool result = false; try { await System.Threading.Tasks.Task.Run(() => { result = TenServices.MarkAllNotificatiosAsRead(NotificationFragment.TableItems).Result; }); } catch (Exception) { } finally { if (result) { NotificationFragment.TableItems.Clear(); NotificationFragment.ListViewAdapater.NotifyDataSetChanged(); NotificationFragment.ifFeedEmpty(); await NotificationFragment.FetchTableData(); ViewUtils.RemoveNotificaionBubble(); TenServiceHelper.CheckForNewNotifications(); toolbarImageFarLeft.Visibility = ViewStates.Invisible; } progress.Dismiss(); } }
protected void Save() { progress = ProgressDialog.Show(this, "Обработка...", "Пожалуйста, подождите.", true); doctor.SecondName = SNameTextEdit.Text; doctor.FirstName = FNameTextEdit.Text; doctor.ThirdName = TNameTextEdit.Text; doctor.IsChosen = false; doctor.Tel = TelTextEdit.Text; doctor.Email = EmailTextEdit.Text; doctor.Cabinet = CabinetTextEdit.Text; doctor.Speciality = SpecTextEdit.Text; doctor.Position = PosTextEdit.Text; DoctorManager.SaveDoctor(doctor); DoctorSpecialitys.SaveSpeciality (doctor.Speciality); DoctorPositions.SavePosition (doctor.Position); progress.Dismiss(); Finish(); }
async public void setMapImage(String url,int c,int u,int s) { _dialogDownload = new ProgressDialog (context); _dialogDownload.SetCancelable (false); _dialogDownload.SetMessage ("Descargando Mapa"); _dialogDownload.Show (); CacheService cache = CacheService.Init(SessionService.GetCredentialFileName(), "user_pref", "cache.db"); var bytesAndPath = await cache.tryGetResource(url); _currentCurso = c; _currentUnidad = u; _currentSection = s; currentMap = bytesToBitmap(bytesAndPath.Item1); mapImage.SetImageBitmap (currentMap); _dialogDownload.Dismiss (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.SetContentView(IslamicHadithAND.Resource.Layout.Book); //ActionBar ActionBar.NavigationMode = ActionBarNavigationMode.Standard; progress = ProgressDialog.Show(this, "انتظر من فضلك", "يتم تحميل الأحاديث ...", true); new Thread(new ThreadStart(() => { Thread.Sleep(1); this.RunOnUiThread(() => { try { string content; using (StreamReader streamReader = new StreamReader(Assets.Open("hadeeth.sqlite"))) { content = streamReader.ReadToEnd(); } string dbName = "hadeeth.sqlite"; string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), dbName); if (!File.Exists(dbPath)) { using (Stream source = new StreamReader(Assets.Open("hadeeth.sqlite")).BaseStream) { using (var destination = System.IO.File.Create(dbPath)) { source.CopyTo(destination); } } } DataTable dataTableBook = new DataTable(); var connectionString = string.Format("Data Source={0};Version=3;", dbPath); using (var conn = new SqliteConnection((connectionString))) { using (var command = conn.CreateCommand()) { conn.Open(); command.CommandText = @"SELECT hadeeth.*" + "FROM Books INNER JOIN hadeeth ON Books.ID = hadeeth.BID" + " where hadeeth.hadeeth like '%<%' and " + "books.title like '%سنن الدارمي%'"; command.CommandType = CommandType.Text; SqliteDataAdapter dataAdapter = new SqliteDataAdapter(); dataAdapter.SelectCommand = command; dataAdapter.Fill(dataTableBook); } } var data = new List<string>(); for (int i = 0; i < dataTableBook.Rows.Count; i++) { data.Add(unBold((dataTableBook.Rows[i]["hadeeth"].ToString()))); if (dataTableBook.Rows.Count == 0) { new AlertDialog.Builder(this) .SetTitle("خطأ") .SetMessage("لا يوجد نتائج") .SetPositiveButton("عودة", (senderaa, args) => { // Back }) .Show(); } } var listView = FindViewById<ListView>(IslamicHadithAND.Resource.Id.listBook); listView.Adapter = new ArrayAdapter(this, Resource.Layout.ListViewContents, data); listView.ItemClick += (sender, e) => { var position = e.Position; var HadithBrowser = new Intent(this, typeof(HadithBrowser)); HadithBrowser.PutExtra("Hadith", listView.GetItemAtPosition(position).ToString()); if (!listView.GetItemAtPosition(position + 1).Equals(null)) { position++; HadithBrowser.PutExtra("HadithNext1", listView.GetItemAtPosition(position).ToString()); } if (!listView.GetItemAtPosition(position - 1).Equals(null)) { position--; HadithBrowser.PutExtra("HadithPrevious1", listView.GetItemAtPosition(position).ToString()); } StartActivity(HadithBrowser); }; } catch (Exception ex) { new AlertDialog.Builder(this) .SetPositiveButton("عودة", (sendera, args) => { // Back }) .SetTitle("خطأ") .SetMessage("خطأ في قاعدة البيانات ( " + ex.ToString() + " )") .Show(); } progress.Dismiss(); }); })).Start(); }
public void buscaryabrir(string termino) { RunOnUiThread(() => { #pragma warning disable CS0618 // El tipo o el miembro est�n obsoletos alerta = new ProgressDialog(this); #pragma warning restore CS0618 // El tipo o el miembro est�n obsoletos #pragma warning restore CS0618 // El tipo o el miembro est�n obsoletos alerta.SetCanceledOnTouchOutside(false); alerta.SetCancelable(false); alerta.SetTitle("Buscando resultados..."); alerta.SetMessage("Por favor espere"); alerta.Show(); }); try { // RunOnUiThread(() => progreso.Progress = 50); VideoSearch src = new VideoSearch(); var results = src.SearchQuery(termino, 1); if (results.Count > 0) { var listatitulos = results.Select(ax => WebUtility.HtmlDecode(RemoveIllegalPathCharacters(ax.Title.Replace(""", "").Replace("&", "")))).ToList(); var listalinks = results.Select(ax => ax.Url).ToList(); RunOnUiThread(() => { ListView lista = new ListView(this); lista.ItemClick += (o, e) => { var posicion = 0; posicion = e.Position; Intent intentoo = new Intent(this, typeof(customdialogact)); intentoo.PutExtra("index", posicion.ToString()); intentoo.PutExtra("color", "DarkGray"); intentoo.PutExtra("titulo", listatitulos[posicion]); if (!isserver) { intentoo.PutExtra("ipadress", Mainmenu.gettearinstancia().ip); } else { intentoo.PutExtra("ipadress", "localhost"); } intentoo.PutExtra("url", listalinks[posicion]); intentoo.PutExtra("imagen", @"https://i.ytimg.com/vi/" + listalinks[posicion].Split('=')[1] + "/mqdefault.jpg"); StartActivity(intentoo); }; adapterlistaremoto adapt = new adapterlistaremoto(this, listatitulos, listalinks); lista.Adapter = adapt; new Android.App.AlertDialog.Builder(this) .SetTitle("Resultados de la busqueda") .SetView(lista).SetPositiveButton("Cerrar", (dd, fgf) => { }) .Create() .Show(); }); } RunOnUiThread(() => { alerta.Dismiss(); }); } catch (Exception) { RunOnUiThread(() => Toast.MakeText(this, "No se encotraron resultados", ToastLength.Long).Show()); alerta.Dismiss(); } }