Beispiel #1
0
        public HistoryUpdate(string taskName, int updateNumber, int checkerid, string image)
        {
            this.taskName     = taskName.Substring(1, taskName.Length - 2);
            this.updateNumber = updateNumber;
            this.checkerName  = Constants.Friend.getNameOf(checkerid);
            string acturalImage = image.Substring(1, image.Length - 2);

            address = ImageConvertors.Base64ToImage(acturalImage, updateNumber);
        }
Beispiel #2
0
        public FriendUpdate(int taskID, int updateNumber, string image, int userid)
        {
            this.taskID   = taskID;
            this.updateNo = updateNumber;
            this.task     = Constants.FriendTasks.Find((obj) => obj.taskid == taskID);
            this.userid   = userid;
            this.username = Constants.getUsername(userid);
            string acturalImage = image.Substring(1, image.Length - 2);

            imageAddress     = ImageConvertors.Base64ToImage(acturalImage, updateNumber);
            tapRecog         = new TapGestureRecognizer();
            tapRecog.Tapped += (sender, e) => { Constants.mainPage.FriendTaskChecker(this); };
        }
        private async void OnClicked(object sender, EventArgs args)
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DisplayAlert("No Camera", ":( No camera available.", "OK");

                return;
            }

            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                Directory          = "Photos",
                Name               = "thisphoto.jpg",
                CompressionQuality = 10
            });

            if (file != null)
            {
                var    stream      = file.GetStream();
                string base64Image = ImageConvertors.ImageToBase64(stream);
                loadingPage = new LoadingPage();
                await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(
                    loadingPage);

                int updateNo = await Communications.sendMyNewUpdate(task.taskid, base64Image);

                await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopAsync();

                if (updateNo == -1)
                {
                    await DisplayAlert("Update failed due to server error", "Please try again", "ok");
                }
                else
                {
                    await DisplayAlert("+。:.゚ヽ(*´∀`) ノ゚.:。+゚", "Your progress has b een sent to your friends. Update number: "
                                       + updateNo, "ok");
                }
            }
        }