示例#1
0
        //Upload byte[] to imgur and give user a response
        private async Task UploadImageToImgur(byte[] cimg, string WindowName)
        {
            string link = await UploadImgur(cimg, WindowName);

            if (link.StartsWith("http://"))
            {
                Clipboard.SetText(link);
                PlayBlop();

                //Catch internal toast exceptions & process start exception
                try {
                    if (FileIO.OpenAfterUpload)
                    {
                        Process.Start(link);
                    }

                    await SuccessToast.ShowAsync(Properties.strings.linkclipboard,
                                                 TimeSpan.FromSeconds(5));
                } catch { }
            }
            else
            {
                //Catch internal toast exceptions
                try {
                    await ErrorToast.ShowAsync(string.Format(Properties.strings.uploadingError, link),
                                               TimeSpan.FromSeconds(5));
                } catch { }
            }
        }