private async Task ParseAndReturnAsync() { // Extract the array of name/value results for the field name "weatherObservation". Models.Company c = await DbConnection.FetchCompanyAsync(this.Intent.GetStringExtra("Email")); // ID=Long.ParseLong(jsonR["ID"]), TextView CompanyName = FindViewById <TextView>(Resource.Id.company_name); CompanyName.Text = c.CompanyName; TextView CompanyFullName = FindViewById <TextView>(Resource.Id.company_fullname); CompanyFullName.Text = c.CompanyFullName; TextView CompanyAbout = FindViewById <TextView>(Resource.Id.company_about); CompanyAbout.Text = c.CompanyAbout; TextView ProductsAbout = FindViewById <TextView>(Resource.Id.company_product); ProductsAbout.Text = c.ProductsAbout; TextView ContactEmail = FindViewById <TextView>(Resource.Id.company_email); ContactEmail.Text = c.ContactEmail; ContactEmail.Click += (s, e) => { var uri = Android.Net.Uri.Parse("mailto:" + c.ContactEmail); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }; TextView Phone = FindViewById <TextView>(Resource.Id.company_phone); Phone.Text = c.Phone.ToString(); TextView Adress = FindViewById <TextView>(Resource.Id.company_adres); Adress.Text = c.Adress; TextView WWW = FindViewById <TextView>(Resource.Id.company_www); WWW.Text = c.www; WWW.Click += (s, e) => { var uri = Android.Net.Uri.Parse(c.www); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }; WebView Youtube = FindViewById <WebView>(Resource.Id.company_youtube); WebSettings set = Youtube.Settings; set.JavaScriptEnabled = true; Youtube.SetWebChromeClient(new WebChromeClient()); Youtube.LoadUrl("https://www.youtube.com/embed/" + c.Youtube); ImageButton fb = FindViewById <ImageButton>(Resource.Id.company_facebook); fb.Click += (s, e) => { String uri = "fb://facewebmodal/f?href=" + c.Facebook; Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri)); StartActivity(intent); }; if (c.Facebook == null) { fb.Visibility = ViewStates.Invisible; fb.SetMaxHeight(0); } ImageButton insta = FindViewById <ImageButton>(Resource.Id.company_instagram); insta.Click += (s, e) => { String[] tab = c.Instagram.ToString().Split('/'); String uri = "instagram://user?username="******"http://expotest.somee.com/Images/Company/" + c.CompanyLogo)); ImageView StandPhoto = FindViewById <ImageView>(Resource.Id.company_standphoto); StandPhoto.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.StandPhoto)); ImageView Photo1 = FindViewById <ImageView>(Resource.Id.company_photo1); Photo1.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo1)); ImageView Photo2 = FindViewById <ImageView>(Resource.Id.company_photo2); Photo2.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo2)); ImageView Photo3 = FindViewById <ImageView>(Resource.Id.company_photo3); Photo3.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo3)); ImageView Photo4 = FindViewById <ImageView>(Resource.Id.company_photo4); Photo4.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo4)); ImageView Photo5 = FindViewById <ImageView>(Resource.Id.company_photo5); Photo5.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo5)); LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this); View popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null); Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertDialogbuilder.SetView(popup); var userContent = popup.FindViewById <EditText>(Resource.Id.History_description); alertDialogbuilder.SetCancelable(false) .SetPositiveButton("Dodaj", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = userContent.Text; h.User = LDbConnection.GetUser().ID; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = userContent.Text; h.User = LDbConnection.GetCompany().Id; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } Toast.MakeText(this, "Wysłano", ToastLength.Long).Show(); } ).SetNegativeButton("Zamknij", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetUser().ID; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetCompany().Id; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } alertDialogbuilder.Dispose(); }); Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create(); if (this.Intent.GetBooleanExtra("Show", true)) { alertDialogAndroid.Show(); } }
protected async void LoadDAtaAsync() { User u = await DbConnection.FetchUserAsync(this.Intent.GetStringExtra("Email")); TextView ForName = FindViewById <TextView>(Resource.Id.user_forname); ForName.Text = u.ForName; TextView SurName = FindViewById <TextView>(Resource.Id.user_surname); SurName.Text = u.SurName; TextView Email = FindViewById <TextView>(Resource.Id.user_email); Email.Text = u.Email; TextView Phone = FindViewById <TextView>(Resource.Id.user_phone); Phone.Text = u.Phone.ToString(); TextView Nationality = FindViewById <TextView>(Resource.Id.user_Nationality); Nationality.Text = u.Nationality; ImageView photo = FindViewById <ImageView>(Resource.Id.user_photo); photo.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/User/" + u.Photo)); LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this); View popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null); Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertDialogbuilder.SetView(popup); var userContent = popup.FindViewById <EditText>(Resource.Id.History_description); alertDialogbuilder.SetCancelable(false) .SetPositiveButton("Dodaj", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = userContent.Text; h.User = LDbConnection.GetUser().ID; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = userContent.Text; h.User = LDbConnection.GetCompany().Id; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } Toast.MakeText(this, "Wysłano", ToastLength.Long).Show(); } ).SetNegativeButton("Zamknij", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetUser().ID; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetCompany().Id; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } alertDialogbuilder.Dispose(); }); Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create(); if (this.Intent.GetBooleanExtra("Show", true)) { alertDialogAndroid.Show(); } }
private async Task ParseAndReturnAsync() { Models.Expo e = new Models.Expo(); e.Id = this.Intent.GetIntExtra("eid", 0); e.Name_Expo = this.Intent.GetStringExtra("ename"); e.Photo = this.Intent.GetStringExtra("ephoto"); e.MapPhoto = this.Intent.GetStringExtra("emapphoto"); e.Description = this.Intent.GetStringExtra("eopis"); e.DataTargowStart = DateTime.Parse(this.Intent.GetStringExtra("eDS")); e.DataTargowEnd = DateTime.Parse(this.Intent.GetStringExtra("eDE")); e.Adres = this.Intent.GetStringExtra("eadres"); TextView ExpoName = FindViewById <TextView>(Resource.Id.expo_name); ExpoName.Text = e.Name_Expo; TextView ProductsAbout = FindViewById <TextView>(Resource.Id.expo_adres); ProductsAbout.Text = e.Adres; TextView ExpoDescription = FindViewById <TextView>(Resource.Id.expo_description); ExpoDescription.Text = e.Description; TextView ExpoStart = FindViewById <TextView>(Resource.Id.expo_data_start); ExpoStart.Text = e.DataTargowStart.ToString(); TextView ExpoEnd = FindViewById <TextView>(Resource.Id.expo_data_end); ExpoEnd.Text = e.DataTargowEnd.ToString(); ImageView ExpoPhoto = FindViewById <ImageView>(Resource.Id.expo_image); ExpoPhoto.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Expo/" + e.Photo)); Button btn = FindViewById <Button>(Resource.Id.expo_join); btn.Click += async delegate { LDbConnection.InsertUExpo(e); if (LDbConnection.getUserType() == "Uczestnik") { if (await DbConnection.FetchUserJoinExpoAsync(LDbConnection.GetUser(), e)) { Toast.MakeText(this, "Dołączono", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Brak połączenia", ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { if (await DbConnection.FetchCompanyJoinExpoAsync(LDbConnection.GetCompany(), e)) { Toast.MakeText(this, "Dołączono", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Brak połączenia", ToastLength.Short).Show(); } } }; Button btn1 = FindViewById <Button>(Resource.Id.ExpoMap); btn1.Click += async delegate { var NxtAct = new Intent(this, typeof(MapActivity)); NxtAct.PutExtra("mapphoto", e.MapPhoto); StartActivity(NxtAct); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Start); lista = LDbConnection.GetActualUserExpo(); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); drawerLayout = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawer_layout); navigationView = FindViewById <Android.Support.Design.Widget.NavigationView>(Resource.Id.nav_view); navigationView.NavigationItemSelected += HomeNavigationView_NavigationItemSelected; var qrcode = FindViewById <Android.Widget.ImageView>(Resource.Id.Start_qrcode); var writer = new ZXing.QrCode.QRCodeWriter(); String s = ""; if (LDbConnection.getUserType() == "Uczestnik") { s = "Uczestnik:" + LDbConnection.GetUser().Email; } else if (LDbConnection.getUserType() == "Wystawca") { s = "Wystawca:" + LDbConnection.GetCompany().Email; } ZXing.Common.BitMatrix bm = writer.encode(s, ZXing.BarcodeFormat.QR_CODE, 500, 500); Android.Graphics.Bitmap ImageBitmap = Android.Graphics.Bitmap.CreateBitmap(500, 500, Config.Argb8888); for (int i = 0; i < 500; i++) { //width for (int j = 0; j < 500; j++) { //height ImageBitmap.SetPixel(i, j, bm[i, j] ? Color.Black : Color.White); } } if (ImageBitmap != null) { qrcode.SetImageBitmap(ImageBitmap); } var expo_list = FindViewById <Android.Widget.Spinner>(Resource.Id.Start_targi); expo_list.ItemSelected += new System.EventHandler <Android.Widget.AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); var adapter = new MyExpoSingleListViewAdapter(lista, this); expo_list.Adapter = adapter; var btn1 = (Button)FindViewById(Resource.Id.Start_join); btn1.Visibility = Android.Views.ViewStates.Invisible; btn1.Click += delegate { var NxtAct = new Android.Content.Intent(this, typeof(UserActivity)); StartActivity(NxtAct); }; var button = FindViewById <Android.Widget.Button>(Resource.Id.Start_scan); button.Click += async delegate { ZXing.Mobile.MobileBarcodeScanner scanner; ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); scanner = new ZXing.Mobile.MobileBarcodeScanner(); scanner.UseCustomOverlay = false; //We can customize the top and bottom text of the default overlay scanner.BottomText = "Poczekaj, aż kod kreskowy będzie automatycznie zeskanowany!"; //Start scanning var result = await scanner.Scan(); scanner.Cancel(); if (result == null) { scanner.Cancel(); } else { scanner.Cancel(); string[] scan = result.Text.Split(':'); if (scan[0] == "Wystawca") { var NxtAct = new Android.Content.Intent(this, typeof(CompanyActivity)); NxtAct.PutExtra("Email", scan[1]); NxtAct.PutExtra("expo_id", lista[select].Id); NxtAct.PutExtra("Search", result.Text); NxtAct.PutExtra("Show", true); StartActivity(NxtAct); } else if (scan[0].Contains("Uczestnik")) { System.Console.WriteLine("Uczestnik"); var NxtAct = new Android.Content.Intent(this, typeof(UserActivity)); NxtAct.PutExtra("Email", scan[1]); NxtAct.PutExtra("expo_id", lista[select].Id); NxtAct.PutExtra("Search", result.Text); NxtAct.PutExtra("Show", true); StartActivity(NxtAct); } } }; if (lista == null) { button.Visibility = Android.Views.ViewStates.Invisible; btn1.Visibility = Android.Views.ViewStates.Visible; } }