private void AddFrag_ProductHandler(object sender, OnCreateProductEvent e) { var client = new RestClient("http://10.0.2.2:60408"); RestReader reader = new RestReader(); RestInserter inserter = new RestInserter(); // Toast.MakeText(this, "Userprices might be null " + userPrices.Length, ToastLength.Short).Show(); Prices price = new Prices { Id = CurrentUserSignedInId, ProductId = (userPrices.Length == 0) ? 0 : userPrices[userPrices.Length - 1].ProductId + 1, Name = e.Name, Price = e.Price, Picture = "none", IdNavigation = null, Ingredients = null }; try { inserter.InsertPrice(price, client, CurrentUserSignedInId); } catch (Exception) { Toast.MakeText(this.ApplicationContext, "Exception at insertion attempt! (activity)", ToastLength.Short).Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(Android.Views.WindowFeatures.NoTitle); SetContentView(Resource.Layout.Main); usernameEdit = FindViewById <EditText>(Resource.Id.userNameTextEdit); passwordEdit = FindViewById <EditText>(Resource.Id.passwordTextEdit); signIn = FindViewById <Button>(Resource.Id.signInButton); createProfile = FindViewById <Button>(Resource.Id.createProfileButton); signInGuest = FindViewById <Button>(Resource.Id.signInAsGuestButton); bar = FindViewById <ProgressBar>(Resource.Id.loadingBarMain); bar.Visibility = Android.Views.ViewStates.Invisible; reader = new RestReader(); inserter = new RestInserter(); signIn.Click += SignIn_Click; createProfile.Click += CreateProfileClick; signInGuest.Click += SignInGuest_Click; }