public 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 { cpd = new CustomProgressDialog(this); cpd.SetCancelable(false); cpd.Show(); DoLogin(user.Text, pass.Text); } }
private async void GetCrmNotesList() { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); responseList = await WebServiceMethods.ShowNotes(_selectedCurrentEntitysItem.EXTRA_TEXT, _selectedAccountCodeItem.SECOND_EXTRA_TEXT, txt_from_date.Text, txt_to_date.Text); InitailizeNotesListAdapter(responseList); CustomProgressDialog.HideProgressDialog(); } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_error), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } }
private async void ShowUserCurrency(string countryCode) { try { ShowUserCurrencyResponse userCurrencyResponseObj = null; if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); userCurrencyResponseObj = await WebServiceMethods.GetUserCurrencyFromCountryCode(countryCode); if (userCurrencyResponseObj != null && !string.IsNullOrEmpty(userCurrencyResponseObj.CurrencyName)) { edt_currency.Text = userCurrencyResponseObj.CurrencyName; } CustomProgressDialog.HideProgressDialog(); } } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR); } }
private async void GetInboxList(int emailTypeId) { try { List <EmailResponse> responseList = null; if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); responseList = await WebServiceMethods.InboxEmails( mSharedPreferencesManager.GetString(ConstantsDroid.USER_ID_PREFERENCE, ""), emailTypeId); SetInboxList(responseList); CustomProgressDialog.HideProgressDialog(); } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } refresher.Refreshing = false; } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_error), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); //create a new dialog dialog = CustomProgressDialog.CreateDialog(this); dialog.OnWindowFocusChanged(true); Button btnGO = FindViewById <Button>(Resource.Id.go); btnGO.Click += (s, e) => { int result = 0; //show the dialog dialog.Show(); //do some things Task task = new Task(() => { for (int i = 0; i < 100; i++) { result += i; } }); task.ContinueWith(t => { Intent intent = new Intent(this, typeof(LastActivity)); intent.PutExtra("name", result.ToString()); StartActivity(intent); }); task.Start(); }; }
public async void CallWebserviceForOrdersList() { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); ledgerOrderList = await WebServiceMethods.GetOrders(mSharedPreferencesManager.GetString(ConstantsDroid.USER_ID_PREFERENCE, ""), txt_from_date.Text, txt_to_date.Text); InitailizeOrderListAdapter(ledgerOrderList); CustomProgressDialog.HideProgressDialog(); } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_error), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } }
private async void Btn_save_Click(object sender, EventArgs e) { try { if (ValidateForm()) { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, GetString(Resource.String.saving_message)); AddCalendarEventsAPIParams addEventsParam = new AddCalendarEventsAPIParams { entryId = (!isAddEvent) ? (eventObj.EntryId) : "0", compCode = "84451", accCode = "1718904", notesTypeId = _selectedCalendarTypeItem.EXTRA_TEXT, entryTypeId = 0, startDate = txt_start_date_val.Text + " " + txt_start_time_val.Text, endDate = txt_end_date_val.Text + " " + txt_end_time_val.Text, subject = txt_subject_val.Text, details = txt_description_val.Text, assignedTo = _selectedUsersItem.EXTRA_TEXT, summaryItemId = "999999999", isCompleted = false, isPublic = false, accountId = "216", connectionName = WebserviceConstants.CONNECTION_NAME }; bool isUpdated = await WebServiceMethods.AddCalendarEvents(addEventsParam); CustomProgressDialog.HideProgressDialog(); CallBackScreen(); } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_fill_all_Details), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); } }
private async void Btn_save_Click(object sender, EventArgs e) { try { if (ValidateForm()) { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, GetString(Resource.String.saving_message)); AddNotesAPIParams addNotesParam = new AddNotesAPIParams { entityCode = _selectedCurrentEntitysItem.EXTRA_TEXT, accountCode = _selectedAccountCodeItem.SECOND_EXTRA_TEXT, notesHeader = txt_notes_header_val.Text, notesDetail = txt_notes_val.Text, notesDetail_Add = "", userId = Convert.ToInt32(mSharedPreferencesManager.GetString( ConstantsDroid.USER_ID_PREFERENCE, "")), actionTypeId = 3, sendTo = "", privacyId = Convert.ToInt32(privacyId), accountId = Convert.ToInt32(_selectedAccountCodeItem.EXTRA_TEXT), notesId = Convert.ToInt32((!isAddNote) ? (noteObj.NotesId) : "0"), connectionName = WebserviceConstants.CONNECTION_NAME }; int notesId = await WebServiceMethods.AddCrmNotes(addNotesParam); CustomProgressDialog.HideProgressDialog(); CallBackScreen(); } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_fill_all_Details), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); } }
private async void GetEmailDetails(string mailId, string userId) { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, null); string emailDetail = await WebServiceMethods.EmailDetail(mailId, userId); if (emailDetail != null) { //WebView webview = FindViewById<WebView>(Resource.Id.webview); // webview.Settings.JavaScriptEnabled = true; // webview.LoadData(emailDetail, "text/html; charset=utf-8", "UTF-8"); TextView textview = FindViewById <TextView>(Resource.Id.webview); textview.SetText(Html.FromHtml(emailDetail), TextView.BufferType.Spannable); CustomProgressDialog.HideProgressDialog(); } else { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_error), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_invalid_credentials), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } }
/// <summary> /// Init values for Customerspinner /// </summary> private async void InitAccountOrderSpinnerValues(string accountCode) { try { //string[] items = Resources.GetStringArray(Resource.Array.customer_entries); if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); accountOrderResponseList = await WebServiceMethods.GetAccountForOrders(); CustomProgressDialog.HideProgressDialog(); } _accountCodeSpinnerItemModelList = new List <SpinnerItemModel>(); for (int i = 0; i < accountOrderResponseList.Count; i++) { SpinnerItemModel item = new SpinnerItemModel { Id = (i + 1) + "", TEXT = accountOrderResponseList[i].AccountName, STATE = false, EXTRA_TEXT = accountOrderResponseList[i].AccountId + "" }; if (!string.IsNullOrEmpty(accountCode)) { if (accountOrderResponseList[i].AccountCode == accountCode) { _selectedAccountCodeItemPosition = i; } } _accountCodeSpinnerItemModelList.Add(item); } SetCustomerSpinnerAdapter(); } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR); } }
/// <summary> /// Init values for Revenue Account Spinner /// </summary> private async void InitRevenueAccountSpinnerValues(int compCode) { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); revenueAccOrderResponseList = await WebServiceMethods.GetRevenueOrders(compCode); CustomProgressDialog.HideProgressDialog(); } _revenueAccountSpinnerItemModelList = new List <SpinnerItemModel>(); for (int i = 0; i < revenueAccOrderResponseList.Count; i++) { SpinnerItemModel item = new SpinnerItemModel { Id = (i + 1) + "", TEXT = revenueAccOrderResponseList[i].AccountName, STATE = false, EXTRA_TEXT = revenueAccOrderResponseList[i].CountryCode }; if (ledgerOrderItemObj != null) { if (revenueAccOrderResponseList[i].AccountId == ledgerOrderItemObj.AccountId) { _selectedRevenueAccountItemPosition = i; } } _revenueAccountSpinnerItemModelList.Add(item); } SetRevenueAccountSpinnerAdapter(); } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR); } }
private async Task <bool> DeleteCRMNotes() { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, GetString(Resource.String.processing_message)); bool isDelete = await WebServiceMethods.DeleteCrmNotes(noteObj.NotesId); CustomProgressDialog.HideProgressDialog(); return(isDelete); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); } return(false); }
/// <summary> /// Init values for Current Entity spinner /// </summary> private async void InitEntitySpinnerValues() { try { List <EntityCodesResponse> responseList = null; if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); responseList = await WebServiceMethods.GetEntityCode(Convert.ToInt32(objLoginResponse.UserId), objLoginResponse.UserCompCode); CustomProgressDialog.HideProgressDialog(); } _entitySpinnerItemModelList = new List <SpinnerItemModel>(); for (int i = 0; i < responseList.Count; i++) { SpinnerItemModel item = new SpinnerItemModel { Id = (i + 1) + "", TEXT = responseList[i].CompName, EXTRA_TEXT = responseList[i].CompCode, STATE = false }; if (entityCode != null && entityCode.Equals(responseList[i].CompCode + "")) { _selectedCurrentEntitysItemPosition = i; } _entitySpinnerItemModelList.Add(item); } SetEntitySpinnerAdapter(); } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); } }
private async Task <bool> DeleteEmails() { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, GetString(Resource.String.processing_message)); bool isDelete = await WebServiceMethods.DeleteEmail(emailResponseObj.MailId, mSharedPreferencesManager.GetString(ConstantsDroid.USER_ID_PREFERENCE, "")); CustomProgressDialog.HideProgressDialog(); return(isDelete); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); } return(false); }
private async void GetLedgerItems(int compCode, int journalNo) { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); List <LedgerOrderItem> ledgerOrderItem = await WebServiceMethods.GetLedgerOrderItems(compCode, journalNo); LedgerOrderObj.LedgerOrderItems = ledgerOrderItem; CustomProgressDialog.HideProgressDialog(); } } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); } }
/// <summary> /// Init values for Account Code spinner /// </summary> private async void InitAccountCodeSpinnerValues() { try { List <AccountCodesResponse> responseList = null; if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); responseList = await WebServiceMethods.GetAccountCodes(_selectedCurrentEntitysItem.EXTRA_TEXT); CustomProgressDialog.HideProgressDialog(); } _accountCodeSpinnerItemModelList = new List <SpinnerItemModel>(); for (int i = 0; i < responseList.Count; i++) { SpinnerItemModel item = new SpinnerItemModel { Id = (i + 1) + "", TEXT = responseList[i].AccountName, EXTRA_TEXT = responseList[i].AccountId, SECOND_EXTRA_TEXT = responseList[i].AccountCode, STATE = false }; if (accountCode != null && accountCode.Equals(responseList[i].AccountCode + "")) { _selectedAccountCodeItemPosition = i; } _accountCodeSpinnerItemModelList.Add(item); } SetAccountCodeSpinnerAdapter(); } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); } }
private async void GetCalendarEventsList() { try { if (CrossConnectivity.Current.IsConnected) { List <NotesTypeResponse> selectedNotesList = _notesTypeList.Where(x => x.IsSelected == true).ToList(); string calendarTypeString = ""; foreach (NotesTypeResponse notesType in selectedNotesList) { calendarTypeString += notesType.NotesTypeId + ","; } string calendarType = calendarTypeString.Substring(0, calendarTypeString.Length - 1); CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); _calendarList = await WebServiceMethods.GetCalendarEvents(_selectedUsersItem.EXTRA_TEXT, calendarType, txt_from_date.Text, txt_to_date.Text); InitailizeCalendarEventListAdapter(_calendarList); CustomProgressDialog.HideProgressDialog(); } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_error), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } }
/// <summary> /// Init values for Calendar Type spinner /// </summary> private async void InitCalendarTypeSpinnerValues() { try { List <NotesTypeResponse> responseList = null; if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); responseList = await WebServiceMethods.ShowNotesType(); CustomProgressDialog.HideProgressDialog(); } _calendarTypeSpinnerItemModelList = new List <SpinnerItemModel>(); for (int i = 0; i < responseList.Count; i++) { SpinnerItemModel item = new SpinnerItemModel { Id = (i + 1) + "", TEXT = responseList[i].NotesTypeName, STATE = false, EXTRA_TEXT = responseList[i].NotesTypeId + "", }; if (eventObj != null && eventObj.NotesTypeId.Equals(responseList[i].NotesTypeId + "")) { _selectedCalendarTypeItemPosition = i; } _calendarTypeSpinnerItemModelList.Add(item); } SetCalendarTypeSpinnerAdapter(); } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); } }
///// <summary> ///// Init values for User spinner ///// </summary> //private async void GetNotesTypes() //{ // try // { // if (CrossConnectivity.Current.IsConnected) // { // CustomProgressDialog.ShowProgDialog(mActivity, // mActivity.Resources.GetString(Resource.String.loading)); // CustomProgressDialog.HideProgressDialog(); // } // } // catch (Exception e) // { // CustomProgressDialog.HideProgressDialog(); // } //} /// <summary> /// Init values for User spinner /// </summary> private async void InitUserSpinnerValues() { try { List <RefUsersResponse> responseList = null; if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); responseList = await WebServiceMethods.ShowRefUsers(loginResponse.UserCompCode); _notesTypeList = await WebServiceMethods.ShowNotesType(); GetNotesTypeResult(_notesTypeList); CustomProgressDialog.HideProgressDialog(); } _userSpinnerItemModelList = new List <SpinnerItemModel>(); for (int i = 0; i < responseList.Count; i++) { SpinnerItemModel item = new SpinnerItemModel { Id = (i + 1) + "", TEXT = responseList[i].UserName, STATE = false, EXTRA_TEXT = responseList[i].UserID }; _userSpinnerItemModelList.Add(item); } SetUserSpinnerAdapter(); } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); } }
private async void Btn_ok_Click(object sender, EventArgs e) { try { if (ValidateForm()) { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); BeforeCallingSaveLedgerOrders(); bool isLedgerSaved = await WebServiceMethods.SaveLedgerOrdersNew(ledgerOrderObj); CustomProgressDialog.HideProgressDialog(); if (isLedgerSaved) { CallBackScreen(); } } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_fill_all_details), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception ex) { CustomProgressDialog.HideProgressDialog(); } }
/// <summary> /// Init values for Revenue Account Spinner /// </summary> private async void InitTaxRatesSpinnerValues() { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, mActivity.Resources.GetString(Resource.String.loading)); string countryCode = string.IsNullOrEmpty(revAccOrderResponseObj.CountryCode) ? ledgerObj.CountryCode : revAccOrderResponseObj.CountryCode; showTaxRatesResponseList = await WebServiceMethods.ShowTaxRates(countryCode); CustomProgressDialog.HideProgressDialog(); } _taxRatesSpinnerItemModelList = new List <SpinnerItemModel>(); for (int i = 0; i < showTaxRatesResponseList.Count; i++) { SpinnerItemModel item = new SpinnerItemModel { Id = (i + 1) + "", TEXT = showTaxRatesResponseList[i].TaxRatePercent + "", STATE = false, EXTRA_TEXT = showTaxRatesResponseList[i].TaxID + "" }; _taxRatesSpinnerItemModelList.Add(item); } SetTaxRatesSpinnerAdapter(); } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR); } }
private async Task GetEmailCounts() { try { if (CrossConnectivity.Current.IsConnected) { EmailCountResponse emailCount = await WebServiceMethods. EmailCount(mSharedPreferencesManager.GetString( ConstantsDroid.USER_ID_PREFERENCE, "")); if (emailCount != null) { mSharedPreferencesManager.PutCountResponse(emailCount); } } } catch (Exception e) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_error), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } }
private async void Button_Click(object sender, System.EventArgs e) { try { if (CrossConnectivity.Current.IsConnected) { CustomProgressDialog.ShowProgDialog(mActivity, Resources.GetString(Resource.String.loading)); username = edt_username.Text; password = edt_password.Text; int selectedRadioBtnId = radio_group.CheckedRadioButtonId; RadioButton radioBtn = FindViewById <RadioButton>(selectedRadioBtnId); if (ValidateForm()) { if (chk_remember_me.Checked) { mSharedPreferencesManager.PutString(ConstantsDroid.USERNAME_PREFERENCE, username); mSharedPreferencesManager.PutString(ConstantsDroid.PASSWORD_PREFERENCE, password); mSharedPreferencesManager.PutString(ConstantsDroid.DATABASE_PREFERENCE, radioBtn.Text); } else { mSharedPreferencesManager.PutString(ConstantsDroid.USERNAME_PREFERENCE, ""); mSharedPreferencesManager.PutString(ConstantsDroid.PASSWORD_PREFERENCE, ""); } //UtilityDroid.GetInstance().ShowToast(mActivity, "Before Print", ToastLength.Long); LoginResponse loginResponse = await WebServiceMethods.Login(username, password); //UtilityDroid.GetInstance().ShowToast(mActivity, "After Print"+ finalResponse.StatusCode, ToastLength.Long); if (loginResponse != null) { if (loginResponse.IsAuthenticate) { mSharedPreferencesManager.PutLoginResponse(loginResponse); mSharedPreferencesManager.PutString(ConstantsDroid.USER_ID_PREFERENCE, loginResponse.UserId); CustomProgressDialog.HideProgressDialog(); StartActivity(new Intent(this, typeof(HomeActivity))); OverridePendingTransition(Resource.Animation.animation_enter, Resource.Animation.animation_leave); Finish(); } else { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_invalid_credentials), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } else { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_invalid_credentials), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } else { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_enter_username_and_password), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } else { UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_no_network_connection), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } } catch (Exception) { CustomProgressDialog.HideProgressDialog(); UtilityDroid.GetInstance().ShowAlertDialog(mActivity, Resources.GetString(Resource.String.error_alert_title), Resources.GetString(Resource.String.alert_message_invalid_credentials), Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn)); } }
public MyWebViewClientrail(Android.App.Activity ac) { this.ac = ac; cpd = new CustomProgressDialog(ac); cpd.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); progress = new ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetCancelable(false); progress.SetMessage("Please wait..."); con = new InternetConnection(); dba = new DBHelper(); restService = new ServiceHelper(); SetContentView(Resource.Layout.Registration_Layout); other_email = Intent.GetStringExtra("email"); other_user = Intent.GetStringExtra("username"); pref = GetSharedPreferences("login", FileCreationMode.Private); edit = pref.Edit(); U_Name = FindViewById <TextView>(Resource.Id.user); M_obile = FindViewById <TextInputEditText>(Resource.Id.mobile); email_add = FindViewById <TextView>(Resource.Id.email); pass_word = FindViewById <TextInputEditText>(Resource.Id.pass); confrirm_password = FindViewById <TextInputEditText>(Resource.Id.confirmpassword); Registration = FindViewById <Button>(Resource.Id.submit); U_Name.Text = other_user; email_add.Text = other_email; Dateofbirth = FindViewById <TextInputEditText>(Resource.Id.birth); Gender = FindViewById <TextInputEditText>(Resource.Id.gender); //U_Name.Text = GoogleAuth_Activity.user_Name; //U_Name.SetCursorVisible(false); //U_Name.SetFadingEdgeLength(10); //U_Name.Enabled = false; //email_add.Text = GoogleAuth_Activity.alreadyregistered; //email_add.SetCursorVisible(false); //email_add.SetFadingEdgeLength(10); //email_add.Enabled = false; Dateofbirth.Click += DateSelect_OnClick;; Registration.Click += async delegate { other_user = U_Name.Text.ToString(); other_mobile = M_obile.Text.ToString(); other_email = email_add.Text.ToString(); other_pass = pass_word.Text.ToString(); otherconfirm_pass = confrirm_password.Text.ToString(); var hasNumber = new Regex(@"[0-9]+"); var hasUpperChar = new Regex(@"[A-Z]+"); var hasMiniMaxChars = new Regex(@".{6,25}"); var hasLowerChar = new Regex(@"[a-z]+"); var hasSymbols = new Regex(@"[!@#$%^&*()_+=\[{\]};:<>|./?,-]"); if (other_user.Equals("")) { Toast.MakeText(this, "Please Enter UserName", ToastLength.Short).Show(); return; } if (other_mobile.Equals("") || other_mobile.Length < 10) { Toast.MakeText(this, "Please Enter 10 digit Mobile Number", ToastLength.Short).Show(); return; } if (other_email.Equals("") || !other_email.Contains("@")) { Toast.MakeText(this, "Please Enter valid email address", ToastLength.Short).Show(); return; } if (other_pass.Equals("") || !hasNumber.IsMatch(other_pass) || !hasUpperChar.IsMatch(other_pass) || !hasMiniMaxChars.IsMatch(other_pass) || !hasLowerChar.IsMatch(other_pass) || !hasSymbols.IsMatch(other_pass)) { Toast.MakeText(this, "Password Should have minimum 6 character, minumum one special char, one uppercase letter,one lowercase letter", ToastLength.Short).Show(); return; } if (other_mobile.Length < 6) { Toast.MakeText(this, "Please Enter minimum 6 digit password", ToastLength.Short).Show(); return; } if (!other_pass.Equals(otherconfirm_pass)) { Toast.MakeText(this, "Password and confirm password should be same", ToastLength.Short).Show(); return; } //if (con.connectivity()) //{ // RegistrationData(); //} else { cpd = new CustomProgressDialog(this); cpd.SetCancelable(false); cpd.Show(); DoRegistration(other_user, other_pass, other_mobile, other_email); } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here //使用加载等待页面 dialog = CustomProgressDialog.CreateDialog(this); dialog.OnWindowFocusChanged(true); LoginSystemType = Intent.GetStringExtra("LoginSystemType"); username = Intent.GetStringExtra("username"); EditText sampCount = FindViewById <EditText>(Resource.Id.sampCount); readIc = FindViewById <ToggleButton>(Resource.Id.btReadic); readIc.Click += icRead; dialog.Show(); //地点下拉菜单 sampAdressName = bsinf.selectAdress(); sp_adresssname = FindViewById <Spinner>(Resource.Id.sampAdress); //填充数据库数据 ArrayAdapter <string> adapter_adressName = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, sampAdressName); adapter_adressName.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); sp_adresssname.Adapter = adapter_adressName; sp_adresssname.ItemSelected += adress_ItemSelected; //业务类型 samp_mode = FindViewById <Spinner>(Resource.Id.sampMode); //填充xml文件数据 ArrayAdapter adapter_mode = ArrayAdapter.CreateFromResource(this, Resource.Array.SampMode, Android.Resource.Layout.SimpleSpinnerItem); adapter_mode.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); samp_mode.Adapter = adapter_mode; samp_mode.Prompt = "请选择"; samp_mode.ItemSelected += selectMode_ItemSelected; //数量 samp_weight = FindViewById <EditText>(Resource.Id.sampCount); if (samp_weight.Text == "") { samp_weight.Text = "0.00"; } else { sampWeight = Convert.ToDouble(samp_weight.Text); } //单位 samp_util = FindViewById <Spinner>(Resource.Id.sampunilt); sampUtile = bsinf.selectUtil(); //填充数据 ArrayAdapter adapter_utile = ArrayAdapter.CreateFromResource(this, Resource.Array.SampUtile, Android.Resource.Layout.SimpleSpinnerItem); adapter_utile.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); samp_util.Adapter = adapter_utile; //sp_goodsname.ItemSelected += TargetSpinner_ItemSelected; //萤石取样位置 samp_yshi = FindViewById <Spinner>(Resource.Id.sampYshi); ArrayAdapter adpter_yshi = ArrayAdapter.CreateFromResource(this, Resource.Array.SampYshi, Android.Resource.Layout.SimpleSpinnerItem); adpter_yshi.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); samp_yshi.Adapter = adpter_yshi; }