public void DragCallback(DragCallback callback) { switch (callback.Type) { case DragCallbackType.Image: UploadImage(callback.Image); break; } }
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; } }
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; } }
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(); }
public void DragCallbackSecondary(DragCallback callback) { callback.CustomFilename = true; DragCallback(callback); }
/// <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"); } }
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(); }