private void InitializetypefaceandClickevents() { Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); TextView lblmember = FindViewById <TextView>(Resource.Id.lblmember); lblmember.Typeface = tf; lblmember.Invalidate(); EditText txtusername = FindViewById <EditText>(Resource.Id.txtUserName); txtusername.Typeface = tf; txtusername.Invalidate(); EditText txtpassword = FindViewById <EditText>(Resource.Id.txtPassword); txtpassword.Typeface = tf; txtpassword.Invalidate(); TextView lblprojectname = FindViewById <TextView>(Resource.Id.lblprojectname); lblprojectname.Typeface = tf; lblprojectname.Invalidate(); // Get our button from the layout resource, // and attach an event to it ImageView button = FindViewById <ImageView>(Resource.Id.btnsignin); button.Click += Button_Click; ImageView buttonRedirectSignup = FindViewById <ImageView>(Resource.Id.btnRedirectSignup); buttonRedirectSignup.Click += buttonRedirectSignup_Click; TextView lblforgotpassword = FindViewById <TextView>(Resource.Id.lblforgotpassword); lblforgotpassword.Click += lblforgotpassword_Click; }
private void showcreateprojectdialog() { dialog = new Dialog(this); dialog.RequestWindowFeature((int)WindowFeatures.NoTitle); dialog.SetContentView(Resource.Layout.CreateProject); ImageView btnCreateProject = (ImageView)dialog.FindViewById(Resource.Id.btnCreateProject); ImageView btnCancelCreateProject = (ImageView)dialog.FindViewById(Resource.Id.btnCancelCreateProject); Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); EditText txtCreateProjectName = (EditText)dialog.FindViewById(Resource.Id.txtCreateProjectName); txtCreateProjectName.Typeface = tf; txtCreateProjectName.Invalidate(); EditText txtCreateProjectClientName = (EditText)dialog.FindViewById(Resource.Id.txtCreateProjectClientName); txtCreateProjectClientName.Typeface = tf; txtCreateProjectClientName.Invalidate(); btnCreateProject.Click += delegate { CreateProject(); }; btnCancelCreateProject.Click += delegate { dialog.Dismiss(); }; dialog.Show(); }
void lblforgotpassword_Click(object sender, EventArgs e) { forgotpassword = new Dialog(this); forgotpassword.RequestWindowFeature((int)WindowFeatures.NoTitle); forgotpassword.SetContentView(Resource.Layout.ForgotPassword); ImageView btnSendForgetPassword = (ImageView)forgotpassword.FindViewById(Resource.Id.btnSendForgetPassword); ImageView btnCancelSendForgetPassword = (ImageView)forgotpassword.FindViewById(Resource.Id.btnCancelSendForgetPassword); Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); EditText txtPopUpForgotpasswordEmailID = (EditText)forgotpassword.FindViewById(Resource.Id.txtPopUpForgotpasswordEmailID); txtPopUpForgotpasswordEmailID.Typeface = tf; txtPopUpForgotpasswordEmailID.Invalidate(); btnSendForgetPassword.Click += delegate { WebService objWebService = new WebService(); if (!isValidEmail(txtPopUpForgotpasswordEmailID.Text.Trim())) { Toast.MakeText(this, "Please give proper email", ToastLength.Long).Show(); } else { objWebService.ForgotPasswordAsync(txtPopUpForgotpasswordEmailID.Text.Trim()); objWebService.ForgotPasswordCompleted += objWebService_ForgotPasswordCompleted; } }; btnCancelSendForgetPassword.Click += delegate { forgotpassword.Dismiss(); }; forgotpassword.Show(); }
private void getexternalcreateprojectxml(object sender, ExternalCreateProjectCompletedEventArgs e) { try { DataSet ds = new DataSet(); string innerxml = e.Result.InnerXml.ToString(); innerxml = "<ds><table1>" + innerxml + "</table1></ds>"; DataTable dataTable = new DataTable("table1"); dataTable.Columns.Add("ProjectID", typeof(string)); ds.Tables.Add(dataTable); System.IO.StringReader xmlSR = new System.IO.StringReader(innerxml); ds.ReadXml(xmlSR, XmlReadMode.IgnoreSchema); dataTable = ds.Tables [0]; if (dataTable.Rows.Count > 0) { int projectid = Convert.ToInt16(dataTable.Rows [0] ["ProjectID"]); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editor = prefs.Edit(); editor.PutLong("ProjectID", projectid); editor.PutString("ProjectName", projectname); editor.PutString("ClientName", clientname); //editor.PutLong ("InventoryType", inventorytype); editor.Commit(); // applies changes synchronously on older APIs editor.Apply(); dialog.Dismiss(); //StartActivity (typeof(EntryTab)); //ISharedPreferencesEditor editor = prefs.Edit (); locationdialog = new Dialog(this); locationdialog.RequestWindowFeature((int)WindowFeatures.NoTitle); locationdialog.SetContentView(Resource.Layout.CreateLocation); ImageView btnCreateLocation = (ImageView)locationdialog.FindViewById(Resource.Id.btnCreateLocation); ImageView btnCancelCreateLocation = (ImageView)locationdialog.FindViewById(Resource.Id.btnCancelCreateLocation); Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); EditText txtPopUpLocationName = (EditText)locationdialog.FindViewById(Resource.Id.txtPopUpLocationName); txtPopUpLocationName.Typeface = tf; txtPopUpLocationName.Invalidate(); btnCreateLocation.Click += delegate { editor.PutString("LocationName", txtPopUpLocationName.Text); editor.Commit(); editor.Apply(); this.Finish(); StartActivity(typeof(EntryTab)); }; btnCancelCreateLocation.Click += delegate { this.Finish(); StartActivity(typeof(EntryTab)); }; //dialog.Dismiss (); locationdialog.SetCanceledOnTouchOutside(false); locationdialog.Show(); } } catch { } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.ManualEntry); // ========================= Get Global Shared Data prefs = PreferenceManager.GetDefaultSharedPreferences(this); empid = prefs.GetLong("EmpID", 0); projectid = prefs.GetLong("ProjectID", 0); if (projectid == 0) { projectid = IMApplication.projectid; } projectname = prefs.GetString("ProjectName", ""); if (projectname == "") { projectname = IMApplication.projectname; } clientname = prefs.GetString("ClientName", ""); if (clientname == "") { clientname = IMApplication.clientname; } ISharedPreferencesEditor editor = prefs.Edit(); editor.PutLong("ProjectID", projectid); editor.PutString("ProjectName", projectname); editor.PutString("ClientName", clientname); editor.Commit(); // applies changes synchronously on older APIs editor.Apply(); locationname = prefs.GetString("LocationName", ""); EditInventoryID = prefs.GetString("EditFromItemList", ""); if (IMApplication.player != null) { IMApplication.player.Stop(); IMApplication.player = null; } // ========================= Get Global Shared Data // ========================= Rounded Button _fab = FindViewById <Fab>(Resource.Id.btnSave); _fab.FabColor = Color.Blue; _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.icon_save2x); _fab.Show(); _fab.Click += delegate { SaveDataToLocalDataBase(); }; // ========================= Rounded Button // ========================= Button Event ImageView _backtolist = FindViewById <ImageView>(Resource.Id.btnManualBacktolist); _backtolist.Click += delegate { ClearAll(); try { StartActivity(typeof(LocationList)); } catch { Toast.MakeText(this, "Oops…something happened, Please try again", ToastLength.Short).Show(); } }; // ========================= Button Event // ========================= Set Font Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); EditText txtprojectname = FindViewById <EditText>(Resource.Id.txtProjectName); txtprojectname.Typeface = tf; txtprojectname.Invalidate(); EditText txtclientname = FindViewById <EditText>(Resource.Id.txtClientName); txtclientname.Typeface = tf; txtclientname.Invalidate(); EditText txtlocation = FindViewById <EditText>(Resource.Id.txtLocation); txtlocation.Typeface = tf; txtlocation.Invalidate(); EditText txtItemDescription = FindViewById <EditText>(Resource.Id.txtItemDescription); txtItemDescription.Typeface = tf; txtItemDescription.Invalidate(); EditText txtbrand = FindViewById <EditText>(Resource.Id.txtBrand); txtbrand.Typeface = tf; txtbrand.Invalidate(); EditText txtquantity = FindViewById <EditText>(Resource.Id.txtQuantity); txtquantity.Typeface = tf; txtquantity.Invalidate(); EditText txtModelNumber = FindViewById <EditText>(Resource.Id.txtModelNumber); txtModelNumber.Typeface = tf; txtModelNumber.Invalidate(); EditText txtUnitCost = FindViewById <EditText>(Resource.Id.txtUnitCost); txtUnitCost.Typeface = tf; txtUnitCost.Invalidate(); EditText txtNotes = FindViewById <EditText>(Resource.Id.txtNotes); txtNotes.Typeface = tf; txtNotes.Invalidate(); // ========================= Set Font txtlocation.SetText(locationname, TextView.BufferType.Editable); editor = prefs.Edit(); txtlocation.TextChanged += delegate { editor.PutString("LocationName", txtlocation.Text); editor.Commit(); }; txtprojectname.SetText(projectname, TextView.BufferType.Editable); txtclientname.SetText(clientname, TextView.BufferType.Editable); Cam1 = FindViewById <ImageView>(Resource.Id.cam1); TextView Cam1Path = FindViewById <TextView>(Resource.Id.cam1path); Cam1.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam1Path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); intent.PutExtra("height", 100); capturedimagename = picname; StartActivityForResult(intent, 1); } else { string picname = CreateDirectoryForPictures() + "/" + Cam1Path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 1; } }; Cam2 = FindViewById <ImageView>(Resource.Id.cam2); TextView Cam2path = FindViewById <TextView>(Resource.Id.cam2path); Cam2.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam2path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); capturedimagename = picname; StartActivityForResult(intent, 2); } else { string picname = CreateDirectoryForPictures() + "/" + Cam2path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 2; } }; Cam3 = FindViewById <ImageView>(Resource.Id.cam3); TextView Cam3path = FindViewById <TextView>(Resource.Id.cam3path); Cam3.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam3path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); intent.PutExtra(Android.Provider.MediaStore.ExtraSizeLimit, 300); capturedimagename = picname; StartActivityForResult(intent, 3); } else { string picname = CreateDirectoryForPictures() + "/" + Cam3path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 3; } }; Cam4 = FindViewById <ImageView>(Resource.Id.cam4); TextView Cam4path = FindViewById <TextView>(Resource.Id.cam4path); Cam4.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam4path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); capturedimagename = picname; StartActivityForResult(intent, 4); } else { string picname = CreateDirectoryForPictures() + "/" + Cam4path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 4; } }; Button btnSavePreview = FindViewById <Button>(Resource.Id.btnSavePreview); btnSavePreview.Click += delegate { LinearLayout LayoutManualEntry = FindViewById <LinearLayout>(Resource.Id.LayoutManualEntry); LinearLayout LayoutManualPreview = FindViewById <LinearLayout>(Resource.Id.LayoutManualPreview); LayoutManualEntry.Visibility = ViewStates.Visible; LayoutManualPreview.Visibility = ViewStates.Gone; }; Button btnDiscardPreview = FindViewById <Button>(Resource.Id.btnDiscardPreview); btnDiscardPreview.Click += delegate { if (currentPreviewcount != 0) { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); capturedimagename = picname; StartActivityForResult(intent, currentPreviewcount); currentPreviewcount = 0; } }; if (EditInventoryID.Trim() != "") { PopulateDataFromDatabase(EditInventoryID); } }
private void SetTypeFace() { Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); EditText txtclientname = FindViewById <EditText>(Resource.Id.txtbarClientName); txtclientname.Typeface = tf; txtclientname.Invalidate(); EditText txtprojectname = FindViewById <EditText>(Resource.Id.txtbarProjectname); txtprojectname.Typeface = tf; txtprojectname.Invalidate(); EditText txtlocation = FindViewById <EditText>(Resource.Id.txtbarLocation); txtlocation.Typeface = tf; txtlocation.Invalidate(); txtlocation.SetText(locationname, TextView.BufferType.Editable); EditText txtquantity = FindViewById <EditText>(Resource.Id.txtbarquantity); txtquantity.Typeface = tf; txtquantity.Invalidate(); EditText txtUnitCost = FindViewById <EditText>(Resource.Id.txtbarunitcost); txtUnitCost.Typeface = tf; txtUnitCost.Invalidate(); TextView lblbluetoothscan = FindViewById <TextView>(Resource.Id.lblbluetoothscan); lblbluetoothscan.Typeface = tf; lblbluetoothscan.Invalidate(); TextView lblscanbarcode = FindViewById <TextView>(Resource.Id.lblscanbarcode); lblscanbarcode.Typeface = tf; lblscanbarcode.Invalidate(); TextView txtbaritemname = FindViewById <TextView>(Resource.Id.txtbaritemname); txtbaritemname.Typeface = tf; txtbaritemname.Invalidate(); //Typeface tfArial = Typeface.CreateFromAsset (Assets, "Fonts/ARIALBOLD.TTF"); EditText txtbarcodenumber = FindViewById <EditText>(Resource.Id.txtbarbarcodenumber); //txtbarcodenumber.Typeface = tfArial; //txtbarcodenumber.Invalidate (); txtlocation.TextChanged += delegate { editor.PutString("LocationName", txtlocation.Text); editor.Commit(); }; txtprojectname.SetText(projectname, TextView.BufferType.Editable); txtclientname.SetText(clientname, TextView.BufferType.Editable); Switch swscanbluetooth = FindViewById <Switch>(Resource.Id.swscanbluetooth); ImageView imgscanbarcode = FindViewById <ImageView>(Resource.Id.imgScanBarcode); LinearLayout llscanbarcode = FindViewById <LinearLayout>(Resource.Id.llscanbarcode); LinearLayout llafterscanbarcode = FindViewById <LinearLayout>(Resource.Id.llafterscan); imgscanbarcode.Click += async(sender, e) => { try { // if (AccessBarCodeScan.Trim() == "1") // { // var options = new ZXing.Mobile.MobileBarcodeScanningOptions(); scanner = new ZXing.Mobile.MobileBarcodeScanner(this); // scanner.FlashButtonText = "On Flash"; // scanner.Torch(true); if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } var result = await scanner.Scan(); if (result != null) { llafterscanbarcode.Visibility = ViewStates.Visible; llscanbarcode.Visibility = ViewStates.Gone; txtbarcodenumber.SetText(result.Text, TextView.BufferType.Editable); AlertVibrate = prefs.GetInt("AlertVibrate", 0); AlertTone = prefs.GetInt("AlertTone", 0); // Vibrate Device if (AlertVibrate == 1) { VibrateDevice(); } // Play tone if (AlertTone == 1) { PlayNitificationTone(); } } // } // else { // OpenInAppPurchasePopUp(); // } } catch (Exception ex) { Toast.MakeText(this, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; ImageView imgScanBarcodeSmall = FindViewById <ImageView>(Resource.Id.imgScanBarcodeSmall); imgScanBarcodeSmall.Click += delegate { try { llafterscanbarcode.Visibility = ViewStates.Gone; llscanbarcode.Visibility = ViewStates.Visible; txtbarcodenumber.SetText("", TextView.BufferType.Editable); } catch (Exception ex) { Toast.MakeText(this, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; swscanbluetooth.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e) { try { bool boolchecked = e.IsChecked; if (boolchecked) { BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter; if (adapter == null) { Toast.MakeText(this, "No Bluetooth adapter found.", ToastLength.Long).Show(); } if (!adapter.IsEnabled) { //throw new Exception("Bluetooth adapter is not enabled."); Toast.MakeText(this, "Bluetooth adapter is not enabled. TurningOn Bluetooth ", ToastLength.Long).Show(); adapter.Enable(); llafterscanbarcode.Visibility = ViewStates.Visible; llscanbarcode.Visibility = ViewStates.Gone; txtbarcodenumber.RequestFocus(); } else { llafterscanbarcode.Visibility = ViewStates.Visible; llscanbarcode.Visibility = ViewStates.Gone; txtbarcodenumber.RequestFocus(); } } else { llafterscanbarcode.Visibility = ViewStates.Gone; llscanbarcode.Visibility = ViewStates.Visible; } } catch (Exception ex) { Toast.MakeText(this, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; _fab.Click += delegate { try { SaveDataToLocalDataBase(); } catch (Exception ex) { Toast.MakeText(this, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; _fabbacktolist.Click += delegate { try { txtquantity = FindViewById <EditText>(Resource.Id.txtbarquantity); txtUnitCost = FindViewById <EditText>(Resource.Id.txtbarunitcost); txtbarcodenumber = FindViewById <EditText>(Resource.Id.txtbarbarcodenumber); txtbaritemname = FindViewById <EditText>(Resource.Id.txtbaritemname); llscanbarcode = FindViewById <LinearLayout>(Resource.Id.llscanbarcode); llafterscanbarcode = FindViewById <LinearLayout>(Resource.Id.llafterscan); txtquantity.SetText("", TextView.BufferType.Editable); txtUnitCost.SetText("", TextView.BufferType.Editable); txtbarcodenumber.SetText("", TextView.BufferType.Editable); txtbaritemname.SetText("", TextView.BufferType.Editable); llafterscanbarcode.Visibility = ViewStates.Gone; llscanbarcode.Visibility = ViewStates.Visible; EditInventoryID = ""; editor.PutString("EditFromItemListForBarcode", ""); editor.Commit(); editor.Apply(); StartActivity(typeof(LocationList)); } catch (Exception ex) { Toast.MakeText(this, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; if (EditInventoryID.Trim() != "") { PopulateDataFromDatabase(EditInventoryID); } }
private void Bt_register_Click(object sender, EventArgs e) { valid.Text = "123456"; valid.Invalidate(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.Signup); this.Window.SetSoftInputMode(SoftInput.AdjustPan); // Define the font face Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); EditText txtfirstname = FindViewById <EditText>(Resource.Id.txtSignUpFirstName); txtfirstname.Typeface = tf; txtfirstname.Invalidate(); EditText txtlastname = FindViewById <EditText>(Resource.Id.txtSignUpLastName); txtlastname.Typeface = tf; txtlastname.Invalidate(); EditText txtusername = FindViewById <EditText>(Resource.Id.txtSignUpUserName); txtusername.Typeface = tf; txtusername.Invalidate(); EditText txtemail = FindViewById <EditText>(Resource.Id.txtSignUpEmail); txtemail.Typeface = tf; txtemail.Invalidate(); EditText txtpassword = FindViewById <EditText>(Resource.Id.txtSignUpPassword); txtpassword.Typeface = tf; txtpassword.Invalidate(); EditText txtrepassword = FindViewById <EditText>(Resource.Id.txtSignUpRePassword); txtrepassword.Typeface = tf; txtrepassword.Invalidate(); TextView lblaccept = FindViewById <TextView>(Resource.Id.lblaccept); lblaccept.Typeface = tf; lblaccept.Invalidate(); TextView lblterms = FindViewById <TextView>(Resource.Id.lblterm); lblterms.Typeface = tf; lblterms.Invalidate(); RadioButton rdbFreeUse = FindViewById <RadioButton>(Resource.Id.rdbFreeUse); rdbFreeUse.Typeface = tf; rdbFreeUse.Invalidate(); RadioButton rdbBusinessUse = FindViewById <RadioButton>(Resource.Id.rdbBusinessUse); rdbBusinessUse.Typeface = tf; rdbBusinessUse.Invalidate(); if (IMApplication.player != null) { IMApplication.player.Stop(); IMApplication.player = null; } //lblterms.Text=Html.FromHtml("<h2>Title</h2><br><p>Description here</p>").ToString(); //WebService objime = new WebService(); // Free User Checked rdbFreeUse.Click += delegate { if (rdbFreeUse.Checked) { objime = new WebService(); rdbBusinessUse.Checked = false; objime.SignupPlanAsync("1"); objime.SignupPlanCompleted += getSubscriptionxml; IsBusinessUser = false; } }; // Business User Checked rdbBusinessUse.Click += delegate { EditText txtuserusername = FindViewById <EditText>(Resource.Id.txtSignUpUserName); string username = txtuserusername.Text; EditText txtuserpassword = FindViewById <EditText>(Resource.Id.txtSignUpPassword); string password = txtuserpassword.Text; WifiManager wifiManager = (WifiManager)GetSystemService(Context.WifiService); WifiInfo wInfo = wifiManager.ConnectionInfo; String MACAdress = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); objime = new WebService(); objime.EmpLoginAsync(username, password, MACAdress, "Android"); objime.EmpLoginCompleted += delegate(object psender, EmpLoginCompletedEventArgs pe) { DataSet ds = new DataSet(); string innerxml = pe.Result.InnerXml.ToString(); innerxml = "<ds><table1>" + innerxml + "</table1></ds>"; DataTable dataTable = new DataTable("table1"); dataTable.Columns.Add("EmpID", typeof(string)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Email", typeof(string)); dataTable.Columns.Add("Company", typeof(string)); dataTable.Columns.Add("IsInternal", typeof(string)); dataTable.Columns.Add("UserType", typeof(string)); dataTable.Columns.Add("Device", typeof(string)); dataTable.Columns.Add("UserPlan", typeof(string)); dataTable.Columns.Add("StripeSubscriptionID", typeof(string)); ds.Tables.Add(dataTable); System.IO.StringReader xmlSR = new System.IO.StringReader(innerxml); ds.ReadXml(xmlSR, XmlReadMode.IgnoreSchema); dataTable = ds.Tables[0]; int empid = Convert.ToInt16(dataTable.Rows[0]["EmpID"]); if (empid == 0) { if (rdbBusinessUse.Checked) { EditText txtuserfirstname = FindViewById <EditText>(Resource.Id.txtSignUpFirstName); string firstname = txtuserfirstname.Text; EditText txtuserlastname = FindViewById <EditText>(Resource.Id.txtSignUpLastName); string lastname = txtuserlastname.Text; EditText txtuseremail = FindViewById <EditText>(Resource.Id.txtSignUpEmail); string email = txtuseremail.Text; EditText txtuserrepassword = FindViewById <EditText>(Resource.Id.txtSignUpRePassword); string repassword = txtuserrepassword.Text; if (isAllInputOk(firstname, lastname, username, email, password, repassword)) { rdbFreeUse.Checked = false; objime.SignupPlanAsync("2"); objime.SignupPlanCompleted += getSubscriptionxml; } else { RadioButton rdbFreeUser = FindViewById <RadioButton>(Resource.Id.rdbFreeUse); RadioButton rdbBusinessUser = FindViewById <RadioButton>(Resource.Id.rdbBusinessUse); rdbFreeUser.Checked = false; rdbBusinessUser.Checked = false; } } rdbFreeUse.Enabled = true; rdbBusinessUse.Enabled = true; } else { rdbFreeUse.Enabled = false; rdbBusinessUse.Enabled = false; Toast.MakeText(this, "You are already subscribed", ToastLength.Short).Show(); } }; }; ImageView button = FindViewById <ImageView>(Resource.Id.btnsignup); button.Click += btnSignup_Click; ImageView btnback = FindViewById <ImageView>(Resource.Id.imgsignupback); btnback.Click += delegate { StartActivity(typeof(Login)); }; TextView lblterm = FindViewById <TextView>(Resource.Id.lblterm); lblterm.Click += delegate { StartActivity(typeof(Term)); }; }
private void findposition(int position, string locationname, string inventorytype, string id) { if (i > 0) { dialog.Dismiss(); ISharedPreferences prefs; // context.StartActivity(typeof(Main)); prefs = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor editor = prefs.Edit(); Dialog locationeditdialog = new Dialog(context); dialog = new Dialog(context); dialog.RequestWindowFeature((int)WindowFeatures.NoTitle); dialog.SetContentView(Resource.Layout.LocationEditPopUp); ImageView imgCloseLocationEditPopUp = dialog.FindViewById <ImageView>(Resource.Id.imgCloseLocationEditPopUp); RelativeLayout rlAddLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlAddLocation); RelativeLayout rlRenameLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlRenameLocation); RelativeLayout rlDeleteLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlDeleteLocation); RelativeLayout rlDetailsLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlDetailsLocation); RelativeLayout rlListLocationItem = dialog.FindViewById <RelativeLayout>(Resource.Id.rlListLocationItem); if (inventorytype.Trim() == "Manual" || inventorytype.Trim() == "Barcode") { rlListLocationItem.Visibility = ViewStates.Visible; } else { rlListLocationItem.Visibility = ViewStates.Gone; } imgCloseLocationEditPopUp.Click += delegate { dialog.Dismiss(); }; rlAddLocation.Click += delegate { try { if (inventorytype.Trim() == "Manual") { editor.PutLong("InventoryType", 1); editor.PutString("LocationName", locationname); context.StartActivity(typeof(EntryTab)); } if (inventorytype.Trim() == "Barcode") { editor.PutLong("InventoryType", 3); editor.PutString("LocationName", locationname); context.StartActivity(typeof(EntryTab)); } if (inventorytype.Trim() == "Voice") { editor.PutLong("InventoryType", 2); editor.PutString("LocationName", locationname); editor.PutInt("FromVoiceEdit", 1); context.StartActivity(typeof(EntryTab)); } editor.Commit(); // applies changes synchronously on older APIs editor.Apply(); dialog.Dismiss(); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlListLocationItem.Click += delegate { try { editor.PutString("LocationNameFromLocationList", locationname); if (inventorytype.Trim() == "Manual") { editor.PutString("InventoryTypeFromLocationList", "1"); } if (inventorytype.Trim() == "Barcode") { editor.PutString("InventoryTypeFromLocationList", "3"); } editor.Commit(); // applies changes synchronously on older APIs editor.Apply(); try { context.Finish(); } catch { } context.StartActivity(typeof(LocationListItem)); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlDeleteLocation.Click += delegate { try { db = context.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetMessage("Are you sure want to delete this location?"); builder.SetCancelable(false); //builder .SetIcon (Resource.Drawable.Icon); builder.SetPositiveButton("Yes", (object sender, DialogClickEventArgs e) => { string locationnamefromsession = prefs.GetString("LocationName", ""); if (locationname.Trim() == locationnamefromsession.Trim()) { editor.PutString("LocationName", ""); editor.Commit(); editor.Apply(); } if (inventorytype.Trim() == "Manual") { try { db.ExecSQL("delete from " + "tbl_Inventory where ID='" + id + "'"); context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location deleted successfully", ToastLength.Long).Show(); } catch { // Toast.MakeText(context, "An error occured. Pls try again later", ToastLength.Long).Show(); } } if (inventorytype.Trim() == "Barcode") { try { db.ExecSQL("delete from " + "tbl_Inventory where ID='" + id + "'"); context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location deleted successfully", ToastLength.Long).Show(); } catch { // Toast.MakeText(context, "An error occured. Pls try again later", ToastLength.Long).Show(); } } if (inventorytype.Trim() == "Voice") { try { db.ExecSQL("delete from " + "tbl_Inventory where ID='" + id + "'"); context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location deleted successfully", ToastLength.Long).Show(); } catch { //Toast.MakeText(context, "An error occured. Pls try again later", ToastLength.Long).Show(); } } }); builder.SetNegativeButton("No", (object sender, DialogClickEventArgs e) => { }); AlertDialog alertdialog = builder.Create(); alertdialog.Show(); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlRenameLocation.Click += delegate { try { locationeditdialog = new Dialog(context); locationeditdialog.RequestWindowFeature((int)WindowFeatures.NoTitle); locationeditdialog.SetContentView(Resource.Layout.EditLocationFromPopUp); ImageView btnEditLocationFromPopUp = locationeditdialog.FindViewById <ImageView>(Resource.Id.btnEditLocationFromPopUp); EditText txtEditPopUpLocationName = locationeditdialog.FindViewById <EditText>(Resource.Id.txtEditPopUpLocationName); ImageView btnCancelEditLocationFromPopUp = locationeditdialog.FindViewById <ImageView>(Resource.Id.btnCancelEditLocationFromPopUp); Typeface tf = Typeface.CreateFromAsset(context.Assets, "Fonts/ROBOTO-LIGHT.TTF"); txtEditPopUpLocationName.Typeface = tf; txtEditPopUpLocationName.Invalidate(); txtEditPopUpLocationName.Text = locationname; locationeditdialog.SetCanceledOnTouchOutside(false); locationeditdialog.Show(); btnCancelEditLocationFromPopUp.Click += delegate { locationeditdialog.Dismiss(); }; btnEditLocationFromPopUp.Click += delegate { try { string updatequery = ""; ContentValues values = new ContentValues(); values.Put("Location", txtEditPopUpLocationName.Text); db = context.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null); if (inventorytype.Trim() == "Manual") { updatequery = "update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where Location='" + locationname + "'"; db.Update("tbl_Inventory", values, "ID = " + id, null); //db.ExecSQL ("update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where ID = " + id); } if (inventorytype.Trim() == "Barcode") { //updatequery = "update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where Location='" + locationname + "'"; db.Update("tbl_Inventory", values, "ID = " + id, null); //db.ExecSQL ("update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where ID = " + id); } if (inventorytype.Trim() == "Voice") { //db.Update("tbl_Inventory",values,"ID = " + id,null); //db.ExecSQL ("update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where ID = " + id); } context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location updated successfully", ToastLength.Long).Show(); } catch (Exception ex) { Toast.MakeText(context, "Location updation failed", ToastLength.Long).Show(); } }; } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlDetailsLocation.Click += delegate { try { db = context.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null); int manualcount = 0; int voicecount = 0; int barcodecount = 0; ICursor c1 = db.RawQuery("SELECT * FROM " + "tbl_Inventory Where InventoryType=1 AND Location='" + locationname + "'", null); manualcount = c1.Count; c1 = db.RawQuery("SELECT * FROM " + "tbl_Inventory Where InventoryType=3 AND Location='" + locationname + "'", null); barcodecount = c1.Count; c1 = db.RawQuery("SELECT * FROM " + "tbl_Inventory Where InventoryType=2 AND Location='" + locationname + "'", null); voicecount = c1.Count; Dialog locationdetailsdialog = new Dialog(context); locationdetailsdialog.RequestWindowFeature((int)WindowFeatures.NoTitle); locationdetailsdialog.SetContentView(Resource.Layout.LocationDetails); TextView txtManualEntryCount = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtManualEntryCount); TextView txtVoiceLength = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtVoiceLength); TextView txtBarcodeEntryCount = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtBarcodeEntryCount); TextView txtManualEntryCountText = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtManualEntryCountText); TextView txtVoiceLengthText = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtVoiceLengthText); TextView txtBarcodeEntryCountText = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtBarcodeEntryCountText); ImageView imgCloseLocationCountPopUp = locationdetailsdialog.FindViewById <ImageView>(Resource.Id.imgCloseLocationCountPopUp); imgCloseLocationCountPopUp.Click += delegate { locationdetailsdialog.Dismiss(); }; string audiopath = CreateDirectoryForAudio(); String duration = ""; Int32 totalduration = 0; string timeduration = ""; int hourcount = 0; int mincount = 0; int seccount = 0; string hour = ""; string min = ""; string sec = ""; c1.MoveToFirst(); if (voicecount > 0) { //locationnamecolumn = c1.GetColumnIndex("Location"); //addeddate = c1.GetColumnIndex("Addeddate"); int voicecolumn = c1.GetColumnIndex("AudioFileName"); do { String AudioFileName = c1.GetString(voicecolumn); if (AudioFileName != "") { if (AudioFileName.Contains("|")) { string[] ArrAudioFileName = AudioFileName.Split('|'); foreach (var item in ArrAudioFileName) { if (item.ToString() != "") { string AudioFilePath = ""; AudioFilePath = audiopath + "/" + item.ToString(); MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.SetDataSource(AudioFilePath); duration = mmr.ExtractMetadata(MetadataKey.Duration); totalduration = totalduration + Convert.ToInt32(duration); TimeSpan ts = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(duration)); ts = TimeSpan.FromMilliseconds(Convert.ToDouble(totalduration)); hourcount = hourcount + ts.Hours; mincount = mincount + ts.Minutes; seccount = seccount + ts.Seconds; } } } else { MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.SetDataSource(audiopath + "/" + AudioFileName); duration = mmr.ExtractMetadata(MetadataKey.Duration); totalduration = totalduration + Convert.ToInt32(duration); TimeSpan ts = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(duration)); ts = TimeSpan.FromMilliseconds(Convert.ToDouble(totalduration)); hourcount = hourcount + ts.Hours; mincount = mincount + ts.Minutes; seccount = seccount + ts.Seconds; } } //mmr.SetDataSource( }while (c1.MoveToNext()); } if (hourcount < 10) { hour = "0" + hourcount.ToString(); } else { hour = hourcount.ToString(); } if (mincount < 10) { min = "0" + mincount.ToString(); } else { min = mincount.ToString(); } if (seccount < 10) { sec = "0" + seccount.ToString(); } else { sec = seccount.ToString(); } timeduration = string.Format("{0}:{1}:{2}", hour, min, sec); Typeface tf = Typeface.CreateFromAsset(context.Assets, "Fonts/ROBOTO-LIGHT.TTF"); txtBarcodeEntryCount.Typeface = tf; txtBarcodeEntryCount.Invalidate(); txtManualEntryCount.Text = manualcount.ToString();; txtVoiceLength.Typeface = tf; txtVoiceLength.Invalidate(); txtVoiceLength.Text = timeduration; txtBarcodeEntryCount.Typeface = tf; txtBarcodeEntryCount.Invalidate(); txtBarcodeEntryCount.Text = barcodecount.ToString(); txtManualEntryCountText.Typeface = tf; txtManualEntryCountText.Invalidate(); txtVoiceLengthText.Typeface = tf; txtVoiceLengthText.Invalidate(); txtBarcodeEntryCountText.Typeface = tf; txtBarcodeEntryCountText.Invalidate(); locationdetailsdialog.SetCanceledOnTouchOutside(false); locationdetailsdialog.Show(); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; dialog.SetCanceledOnTouchOutside(false); dialog.Show(); i = i + 1; } else { ISharedPreferences prefs; // context.StartActivity(typeof(Main)); prefs = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor editor = prefs.Edit(); Dialog locationeditdialog = new Dialog(context); dialog = new Dialog(context); dialog.RequestWindowFeature((int)WindowFeatures.NoTitle); dialog.SetContentView(Resource.Layout.LocationEditPopUp); ImageView imgCloseLocationEditPopUp = dialog.FindViewById <ImageView>(Resource.Id.imgCloseLocationEditPopUp); RelativeLayout rlAddLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlAddLocation); RelativeLayout rlRenameLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlRenameLocation); RelativeLayout rlDeleteLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlDeleteLocation); RelativeLayout rlDetailsLocation = dialog.FindViewById <RelativeLayout>(Resource.Id.rlDetailsLocation); RelativeLayout rlListLocationItem = dialog.FindViewById <RelativeLayout>(Resource.Id.rlListLocationItem); if (inventorytype.Trim() == "Manual" || inventorytype.Trim() == "Barcode") { rlListLocationItem.Visibility = ViewStates.Visible; } else { rlListLocationItem.Visibility = ViewStates.Gone; } imgCloseLocationEditPopUp.Click += delegate { dialog.Dismiss(); }; rlListLocationItem.Click += delegate { try { editor.PutString("LocationNameFromLocationList", locationname); if (inventorytype.Trim() == "Manual") { editor.PutString("InventoryTypeFromLocationList", "1"); } if (inventorytype.Trim() == "Barcode") { editor.PutString("InventoryTypeFromLocationList", "3"); } editor.Commit(); // applies changes synchronously on older APIs editor.Apply(); try { context.Finish(); } catch { } context.StartActivity(typeof(LocationListItem)); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlAddLocation.Click += delegate { try { if (inventorytype.Trim() == "Manual") { editor.PutLong("InventoryType", 1); editor.PutString("LocationName", locationname); context.StartActivity(typeof(EntryTab)); } if (inventorytype.Trim() == "Barcode") { editor.PutLong("InventoryType", 3); editor.PutString("LocationName", locationname); context.StartActivity(typeof(EntryTab)); } if (inventorytype.Trim() == "Voice") { editor.PutLong("InventoryType", 2); editor.PutString("LocationName", locationname); editor.PutInt("FromVoiceEdit", 1); context.StartActivity(typeof(EntryTab)); } editor.Commit(); // applies changes synchronously on older APIs editor.Apply(); dialog.Dismiss(); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlDeleteLocation.Click += delegate { try { db = context.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetMessage("Are you sure want to delete this location?"); builder.SetCancelable(false); //builder .SetIcon (Resource.Drawable.Icon); builder.SetPositiveButton("Yes", (object sender, DialogClickEventArgs e) => { if (inventorytype.Trim() == "Manual") { try { db.ExecSQL("delete from " + "tbl_Inventory where ID='" + id + "'"); context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location deleted successfully", ToastLength.Long).Show(); } catch { // Toast.MakeText(context, "An error occured. Pls try again later", ToastLength.Long).Show(); } } if (inventorytype.Trim() == "Barcode") { try { db.ExecSQL("delete from " + "tbl_Inventory where ID='" + id + "'"); context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location deleted successfully", ToastLength.Long).Show(); } catch { // Toast.MakeText(context, "An error occured. Pls try again later", ToastLength.Long).Show(); } } if (inventorytype.Trim() == "Voice") { try { db.ExecSQL("delete from " + "tbl_Inventory where ID='" + id + "'"); context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location deleted successfully", ToastLength.Long).Show(); } catch { //Toast.MakeText(context, "An error occured. Pls try again later", ToastLength.Long).Show(); } } }); builder.SetNegativeButton("No", (object sender, DialogClickEventArgs e) => { }); AlertDialog alertdialog = builder.Create(); alertdialog.Show(); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlRenameLocation.Click += delegate { try { locationeditdialog = new Dialog(context); locationeditdialog.RequestWindowFeature((int)WindowFeatures.NoTitle); locationeditdialog.SetContentView(Resource.Layout.EditLocationFromPopUp); ImageView btnEditLocationFromPopUp = locationeditdialog.FindViewById <ImageView>(Resource.Id.btnEditLocationFromPopUp); EditText txtEditPopUpLocationName = locationeditdialog.FindViewById <EditText>(Resource.Id.txtEditPopUpLocationName); ImageView btnCancelEditLocationFromPopUp = locationeditdialog.FindViewById <ImageView>(Resource.Id.btnCancelEditLocationFromPopUp); Typeface tf = Typeface.CreateFromAsset(context.Assets, "Fonts/ROBOTO-LIGHT.TTF"); txtEditPopUpLocationName.Typeface = tf; txtEditPopUpLocationName.Invalidate(); txtEditPopUpLocationName.Text = locationname; locationeditdialog.Show(); btnCancelEditLocationFromPopUp.Click += delegate { locationeditdialog.Dismiss(); }; btnEditLocationFromPopUp.Click += delegate { try { string updatequery = ""; ContentValues values = new ContentValues(); values.Put("Location", locationname); db = context.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null); if (inventorytype.Trim() == "Manual") { updatequery = "update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where Location='" + locationname + "'"; db.ExecSQL("update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where ID = " + id); } if (inventorytype.Trim() == "Barcode") { updatequery = "update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where Location='" + locationname + "'"; db.ExecSQL("update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where ID = " + id); } if (inventorytype.Trim() == "Voice") { db.ExecSQL("update" + " tbl_Inventory set Location='" + txtEditPopUpLocationName.Text + "' where ID = " + id); } context.Finish(); context.StartActivity(typeof(LocationList)); Toast.MakeText(context, "Location updated successfully", ToastLength.Long).Show(); } catch (Exception ex) { Toast.MakeText(context, "Location updation failed", ToastLength.Long).Show(); } }; } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; rlDetailsLocation.Click += delegate { try { db = context.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null); int manualcount = 0; int voicecount = 0; int barcodecount = 0; ICursor c1 = db.RawQuery("SELECT * FROM " + "tbl_Inventory Where InventoryType=1 AND Location='" + locationname + "'", null); manualcount = c1.Count; c1 = db.RawQuery("SELECT * FROM " + "tbl_Inventory Where InventoryType=3 AND Location='" + locationname + "'", null); barcodecount = c1.Count; c1 = db.RawQuery("SELECT * FROM " + "tbl_Inventory Where InventoryType=2 AND Location='" + locationname + "'", null); voicecount = c1.Count; Dialog locationdetailsdialog = new Dialog(context); locationdetailsdialog.RequestWindowFeature((int)WindowFeatures.NoTitle); locationdetailsdialog.SetContentView(Resource.Layout.LocationDetails); TextView txtManualEntryCount = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtManualEntryCount); TextView txtVoiceLength = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtVoiceLength); TextView txtBarcodeEntryCount = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtBarcodeEntryCount); TextView txtManualEntryCountText = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtManualEntryCountText); TextView txtVoiceLengthText = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtVoiceLengthText); TextView txtBarcodeEntryCountText = locationdetailsdialog.FindViewById <TextView>(Resource.Id.txtBarcodeEntryCountText); ImageView imgCloseLocationCountPopUp = locationdetailsdialog.FindViewById <ImageView>(Resource.Id.imgCloseLocationCountPopUp); imgCloseLocationCountPopUp.Click += delegate { locationdetailsdialog.Dismiss(); }; string audiopath = CreateDirectoryForAudio(); String duration = ""; Int32 totalduration = 0; string timeduration = ""; int hourcount = 0; int mincount = 0; int seccount = 0; string hour = ""; string min = ""; string sec = ""; c1.MoveToFirst(); if (voicecount > 0) { //locationnamecolumn = c1.GetColumnIndex("Location"); //addeddate = c1.GetColumnIndex("Addeddate"); int voicecolumn = c1.GetColumnIndex("AudioFileName"); do { String AudioFileName = c1.GetString(voicecolumn); if (AudioFileName != "") { if (AudioFileName.Contains("|")) { string[] ArrAudioFileName = AudioFileName.Split('|'); foreach (var item in ArrAudioFileName) { if (item.ToString() != "") { string AudioFilePath = ""; AudioFilePath = audiopath + "/" + item.ToString(); MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.SetDataSource(AudioFilePath); duration = mmr.ExtractMetadata(MetadataKey.Duration); totalduration = totalduration + Convert.ToInt32(duration); TimeSpan ts = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(duration)); ts = TimeSpan.FromMilliseconds(Convert.ToDouble(totalduration)); hourcount = hourcount + ts.Hours; mincount = mincount + ts.Minutes; seccount = seccount + ts.Seconds; } } } else { MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.SetDataSource(audiopath + "/" + AudioFileName); duration = mmr.ExtractMetadata(MetadataKey.Duration); totalduration = totalduration + Convert.ToInt32(duration); TimeSpan ts = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(duration)); ts = TimeSpan.FromMilliseconds(Convert.ToDouble(totalduration)); hourcount = hourcount + ts.Hours; mincount = mincount + ts.Minutes; seccount = seccount + ts.Seconds; } } //mmr.SetDataSource( }while (c1.MoveToNext()); } if (hourcount < 10) { hour = "0" + hourcount.ToString(); } else { hour = hourcount.ToString(); } if (mincount < 10) { min = "0" + mincount.ToString(); } else { min = mincount.ToString(); } if (seccount < 10) { sec = "0" + seccount.ToString(); } else { sec = seccount.ToString(); } timeduration = string.Format("{0}:{1}:{2}", hour, min, sec); Typeface tf = Typeface.CreateFromAsset(context.Assets, "Fonts/ROBOTO-LIGHT.TTF"); txtBarcodeEntryCount.Typeface = tf; txtBarcodeEntryCount.Invalidate(); txtManualEntryCount.Text = manualcount.ToString();; txtVoiceLength.Typeface = tf; txtVoiceLength.Invalidate(); txtVoiceLength.Text = timeduration; txtBarcodeEntryCount.Typeface = tf; txtBarcodeEntryCount.Invalidate(); txtBarcodeEntryCount.Text = barcodecount.ToString(); txtManualEntryCountText.Typeface = tf; txtManualEntryCountText.Invalidate(); txtVoiceLengthText.Typeface = tf; txtVoiceLengthText.Invalidate(); txtBarcodeEntryCountText.Typeface = tf; txtBarcodeEntryCountText.Invalidate(); locationdetailsdialog.SetCanceledOnTouchOutside(false); locationdetailsdialog.Show(); } catch (Exception ex) { Toast.MakeText(context, "Something went wrong. Please try back in few minutes.", ToastLength.Short).Show(); } }; dialog.SetCanceledOnTouchOutside(false); dialog.Show(); i = i + 1; } }