Exemple #1
0
        private void imageUpload_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            doingAction.Visibility = Visibility.Collapsed;

            if (_imageID == null || (_imageID.Length < 5 && _imageID.Length > 9))
            {
                MetroMessageBox.Show("Error", _imageID ?? "Error uploading image.");

                _imageID = null;
            }
            else
            {
                MetroImgurUpload.Show(_imageID);
            }
        }
Exemple #2
0
        private void btnUploadImage_Click(object sender, RoutedEventArgs e)
        {
            if (_imageID == null)
            {
                doingAction.Visibility = Visibility.Visible;

                var imageUpload = new BackgroundWorker();
                imageUpload.RunWorkerCompleted += imageUpload_RunWorkerCompleted;
                imageUpload.DoWork             += imageUpload_DoWork;
                imageUpload.RunWorkerAsync();
            }
            else
            {
                MetroImgurUpload.Show(_imageID);
            }
        }
Exemple #3
0
        private void imageUpload_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            doingAction.Visibility = Visibility.Collapsed;

            if (_imageID == null || (_imageID.Length < 5 && _imageID.Length > 9))
            {
                MetroMessageBox.Show("Error", _imageID ?? "Error uploading image.");

                _imageID = null;
            }
            else
            {
                MetroImgurUpload.Show(_imageID);

                string _thumburl = string.Format("http://i.imgur.com/{0}b.jpg", _imageID);
                string _url      = string.Format("http://i.imgur.com/{0}.jpg", _imageID);

                Dispatcher.Invoke(new Action(delegate
                {
                    ImgurHistory.AddNewEntry(_datetime_long, _thumburl, _url);
                }));
            }
        }