Exemplo n.º 1
0
        public static UrbanSpotsWcfClient InitializeWcfServiceClient()
        {
            BasicHttpBinding binding = WCFFunctions.CreateBasicHttp();

            UrbanSpotsWcfClient client = new UrbanSpotsWcfClient(binding, EndPoint);

            return(client);
        }
Exemplo n.º 2
0
        private void BtnSignUp_Click(object sender, EventArgs e)
        {
            client = WCFFunctions.InitializeWcfServiceClient();

            FragmentTransaction ftrans    = FragmentManager.BeginTransaction();
            DialogSignUp        dlgSignUp = new DialogSignUp();

            dlgSignUp.Show(ftrans, "dialog fragment");

            dlgSignUp.onSignUpComplete += dlgSignUp_onSignUpComplete;
        }
Exemplo n.º 3
0
        private void BtnAddLocation_Click(object sender, EventArgs e)
        {
            if (currentPhoto != null)
            {
                System.IO.MemoryStream ms = null;
                try
                {
                    txtName        = FindViewById <TextView>(Resource.Id.txtSpotName);
                    txtDescription = FindViewById <TextView>(Resource.Id.txtSpotDescription);

                    client = WCFFunctions.InitializeWcfServiceClient();

                    int        bytes  = currentPhoto.ByteCount;
                    ByteBuffer buffer = ByteBuffer.Allocate(bytes);
                    currentPhoto.CopyPixelsToBuffer(buffer);

                    buffer.Position(0);
                    byte[] photo = new byte[buffer.Remaining()];
                    buffer.Get(photo);

                    ms = new System.IO.MemoryStream();
                    currentPhoto.Compress(Android.Graphics.Bitmap.CompressFormat.Jpeg, 100, ms);

                    string result = client.AddLocation(this.userGuid.ToString(), txtName.Text, txtDescription.Text, double.Parse(lng), double.Parse(lat), ms.ToArray());

                    if (result == "0")
                    {
                        txtMessage.Text     = "Točka je bila uspešno dodana!";
                        txtName.Text        = "";
                        txtDescription.Text = "";
                        txtCoordinates.Text = "Koordinate:";
                        imgView.SetImageBitmap(null);
                    }
                    else
                    {
                        txtMessage.Text = result;
                    }
                }
                catch (Exception ex)
                {
                    txtMessage.Text = ms.Length + "" + ex.Message;
                }
            }
            else
            {
                // Tell the user to load the image!
            }
        }
Exemplo n.º 4
0
        private void dlgSignUp_onSignUpComplete(object sender, OnSignUpEventArgs e)
        {
            string errorMsg = "";

            try
            {
                // Check login
                client = WCFFunctions.InitializeWcfServiceClient();
                if (client != null)
                {
                    //var user = client.LoginUser(e.EMail, e.Password);
                    var user = client.LoginUser("*****@*****.**", "Test01.");

                    errorMsg += "8";
                    if (user.UserGuid != Guid.Empty)
                    {
                        var mainActivity = new Intent(this, typeof(MainActivity));
                        mainActivity.PutExtra("UserName", user.UserName);
                        mainActivity.PutExtra("UserGuid", user.UserGuid.ToString());
                        StartActivity(mainActivity);
                    }
                    else
                    {
                        this.txtNotSuccessful.Visibility = Android.Views.ViewStates.Visible;
                        this.txtNotSuccessful.Text       = user.UserName;
                    }
                }
                else
                {
                    this.txtNotSuccessful.Visibility = Android.Views.ViewStates.Visible;
                    this.txtNotSuccessful.Text       = "Povezava ni bila vzpostavljena!";
                }
            }
            catch (Exception ex)
            {
                this.txtNotSuccessful.Visibility = Android.Views.ViewStates.Visible;
                this.txtNotSuccessful.Text       = errorMsg + " - " + ex.Message + " -- " + ex.StackTrace;
            }
        }