Beispiel #1
0
        public override Task <ThumbnailInfo> GetThumbnailInfoAsync(PostClass.StatusGeo geo)
        {
            var thumb = new ThumbnailInfo
            {
                MediaPageUrl      = this.CreateMapLinkUrl(geo.Latitude, geo.Longitude),
                ThumbnailImageUrl = this.CreateStaticMapUrl(geo.Latitude, geo.Longitude),
                TooltipText       = null,
            };

            return(Task.FromResult(thumb));
        }
Beispiel #2
0
        public override Task<ThumbnailInfo> GetThumbnailInfoAsync(PostClass.StatusGeo geo)
        {
            var thumb = new ThumbnailInfo
            {
                MediaPageUrl = this.CreateMapLinkUrl(geo.Latitude, geo.Longitude),
                ThumbnailImageUrl = this.CreateStaticMapUrl(geo.Latitude, geo.Longitude),
                TooltipText = null,
            };

            return Task.FromResult(thumb);
        }
Beispiel #3
0
 public ThumbnailDoubleClickEventArgs(ThumbnailInfo thumbnail)
 {
     this.Thumbnail = thumbnail;
 }
Beispiel #4
0
 private void OpenThumbnailPicture(ThumbnailInfo thumbnail)
 {
     this.OpenUriAsync(Uri.EscapeUriString(thumbnail.ImageUrl));
 }
Beispiel #5
0
        private async Task SetThumbnailImageAsync(OTPictureBox picbox, ThumbnailInfo thumbInfo,
            CancellationToken cancelToken)
        {
            try
            {
                picbox.ShowInitialImage();

                picbox.MouseDown += this.pictureBox_MouseDown;
                picbox.MouseUp += this.pictureBox_MouseUp;

                picbox.Image = await thumbInfo.LoadThumbnailImageAsync(cancelToken);

                cancelToken.ThrowIfCancellationRequested();

                picbox.MouseMove += this.pictureBox_MouseMove;

                if (this.ThumbnailLoadCompleted != null)
                    this.ThumbnailLoadCompleted(picbox, EventArgs.Empty);
            }
            catch (Exception)
            {
                picbox.ShowErrorImage();
                try
                {
                    throw;
                }
                catch (HttpRequestException) { }
                catch (InvalidImageException) { }
                catch (TaskCanceledException) { }
                catch (WebException) { }
            }
        }
Beispiel #6
0
        protected ThumbnailZoomWindow(MemoryImage thumbnail, ThumbnailInfo thumbInfo, Rectangle startupBounds, Point originPos)
        {
            this.startupBounds = startupBounds;
            this.originPos = originPos;

            using (ControlTransaction.Layout(this, false))
            {
                this.DoubleBuffered = true;

                this.TopMost = true;
                this.FormBorderStyle = FormBorderStyle.None;
                this.ShowInTaskbar = false;

                this.StartPosition = FormStartPosition.Manual;
                this.Bounds = startupBounds;

                this.Capture = true;

                this.MouseMove += ThumbnailZoomWindow_MouseMove;
                this.MouseUp += ThumbnailZoomWindow_MouseUp;

                var picbox = new OTPictureBox()
                {
                    Name = "picbox",
                    Image = thumbnail,
                    Tag = thumbInfo,
                    SizeMode = PictureBoxSizeMode.Zoom,
                    WaitOnLoad = false,
                    Dock = DockStyle.Fill,
                };
                this.Controls.Add(picbox);

                picbox.MouseMove += ThumbnailZoomWindow_MouseMove;
                picbox.MouseUp += ThumbnailZoomWindow_MouseUp;
            }
        }
Beispiel #7
0
 private ContextMenu CreateContextMenu(ThumbnailInfo thumb)
 {
     var contextMenu = new ContextMenu();
     contextMenu.MenuItems.Add(CreateImageSearchMenuItem(thumb));
     return contextMenu;
 }
Beispiel #8
0
        private MenuItem CreateImageSearchMenuItem(ThumbnailInfo thumb)
        {
            var item = new MenuItem();
            item.Text = Properties.Resources.SearchSimilarImageText;
            string search_targe_url =
                thumb.FullSizeImageUrl != null
                    ? thumb.FullSizeImageUrl
                    : thumb.ThumbnailUrl != null
                        ? thumb.ThumbnailUrl
                        : null;

            if (search_targe_url != null)
            {
                item.Click += (sender, e) =>
                {
                    string uri = GetImageSearchUri(search_targe_url);
                    if (this.ThumbnailImageSearchClick != null)
                    {
                        this.ThumbnailImageSearchClick(this, new ThumbnailImageSearchEventArgs(uri));
                    }
                };
            }
            else
            {
                item.Enabled = false;
            }

            return item;
        }
Beispiel #9
0
 private void OpenThumbnailPicture(ThumbnailInfo thumbnail)
 {
     this.OpenUriAsync(thumbnail.ImageUrl);
 }
Beispiel #10
0
 private async Task SetThumbnailImageAsync(OTPictureBox picbox, ThumbnailInfo thumbInfo,
     CancellationToken cancelToken)
 {
     try
     {
         picbox.ShowInitialImage();
         picbox.Image = await thumbInfo.LoadThumbnailImageAsync(cancelToken);
     }
     catch (Exception)
     {
         picbox.ShowErrorImage();
         try
         {
             throw;
         }
         catch (HttpRequestException) { }
         catch (InvalidImageException) { }
         catch (TaskCanceledException) { }
     }
 }
Beispiel #11
0
        private async Task OpenThumbnailPicture(ThumbnailInfo thumbnail)
        {
            var url = thumbnail.FullSizeImageUrl ?? thumbnail.ImageUrl;
            url = url.Replace(" ", "%20");

            await this.OpenUriInBrowserAsync(url);
        }
Beispiel #12
0
        private async Task OpenThumbnailPicture(ThumbnailInfo thumbnail)
        {
            var url = thumbnail.FullSizeImageUrl ?? thumbnail.MediaPageUrl;

            await this.OpenUriInBrowserAsync(url);
        }
Beispiel #13
0
 private void OpenThumbnailPicture(ThumbnailInfo thumbnail)
 {
     string url = thumbnail.ImageUrl;
     url = url.Replace(" ", "%20");
     this.OpenUriAsync(url);
 }