Пример #1
0
 public void DragCallback(DragCallback callback)
 {
     switch (callback.Type) {
     case DragCallbackType.Image:
       UploadImage(callback.Image);
       break;
       }
 }
Пример #2
0
        public void DragCallback(DragCallback callback)
        {
            switch (callback.Type) {
                case DragCallbackType.Image:
                    UploadImage(callback.Image);
                    break;

                case DragCallbackType.Animation:
                    MessageBox.Show("Snaggy doesn't support gif animations.");
                    break;
            }
        }
Пример #3
0
        public void DragCallback(DragCallback callback)
        {
            switch (callback.Type) {
            case DragCallbackType.Image:
              UploadImage(callback.Image, callback.CustomFilename);
              break;

            case DragCallbackType.Animation:
              UploadAnimation(callback.Animation, callback.CustomFilename);
              break;
              }
        }
Пример #4
0
        private void buttonStop_Click(object sender, EventArgs e)
        {
            this.timerFrame.Enabled = false;

            this.Hide();
            this.animBox.Hide();

            DragCallback callback = new DragCallback()
            {
                Type = DragCallbackType.Animation, Animation = new MemoryStream()
            };

            AnimatedGifEncoder encoder = new AnimatedGifEncoder();

            encoder.Start(callback.Animation);
            encoder.SetDelay(this.timerFrame.Interval);
            encoder.SetRepeat(0);

            this.addon.ProgressBar.Start("Encoding Gif", this.frames.Count, false);

            for (int i = 0; i < this.frames.Count; i++)
            {
                if (this.addon.ProgressBar.Canceled)
                {
                    this.Close();
                    return;
                }

                encoder.AddFrame(this.frames[i]);
                this.addon.ProgressBar.Set(i);
            }

            encoder.Finish();

            this.addon.ProgressBar.Done();

            this.doneDragging(callback);
            this.Close();
        }
Пример #5
0
 public void DragCallbackSecondary(DragCallback callback)
 {
     callback.CustomFilename = true;
       DragCallback(callback);
 }
Пример #6
0
        /// <summary>
        /// Function referenced as the callback function for dragging a screesnhot
        /// and animation.
        /// </summary>
        void DragFinished(DragCallback cb)
        {
            if (cb.Type == DragCallbackType.Animation) {
            //TODO: Do something with cb.Animation (System.IO.MemoryStream)

            Uploaded("Image", "http://example.com/image.gif", "Dragged animation");

              } else if (cb.Type == DragCallbackType.Image) {
            //TODO: Do something with cb.Image (System.Drawing.Image)

            Uploaded("Image", "http://example.com/image.png", "Dragged image");

              }
        }
Пример #7
0
        private void buttonStop_Click(object sender, EventArgs e)
        {
            this.timerFrame.Enabled = false;

            this.Hide();
            this.animBox.Hide();

            DragCallback callback = new DragCallback() { Type = DragCallbackType.Animation, Animation = new MemoryStream() };

            AnimatedGifEncoder encoder = new AnimatedGifEncoder();
            encoder.Start(callback.Animation);
            encoder.SetDelay(this.timerFrame.Interval);
            encoder.SetRepeat(0);

            this.addon.ProgressBar.Start("Encoding Gif", this.frames.Count, false);

            for(int i = 0; i < this.frames.Count; i++) {
                if(this.addon.ProgressBar.Canceled) {
                    this.Close();
                    return;
                }

                encoder.AddFrame(this.frames[i]);
                this.addon.ProgressBar.Set(i);
            }

            encoder.Finish();

            this.addon.ProgressBar.Done();

            this.doneDragging(callback);
            this.Close();
        }