Add more detailed and useful listing of output
[SnapShooter.git] / SnapShooter / MainWindow.xaml.cs
index c01c051..ea5aca5 100644 (file)
@@ -41,9 +41,14 @@ namespace SnapShooter {
             if (Clipboard.ContainsImage()) {
                 TaskbarManager.Instance.SetOverlayIcon(foundstuff.Icon, "Found Image");
 
+                string filename = System.IO.Path.Combine(
+                    Environment.GetEnvironmentVariable("TEMP"),
+                    "SnapShoot.jpg"
+                );
+
                 BitmapSource b = Clipboard.GetImage();
                 System.Console.WriteLine(b.GetHashCode());
-                FileStream s = new FileStream("clipboard.jpg", FileMode.Create);
+                FileStream s = new FileStream(filename, FileMode.Create);
                 JpegBitmapEncoder j = new JpegBitmapEncoder();
                 j.QualityLevel = 85;
                 j.Frames.Add(BitmapFrame.Create(b));
@@ -58,20 +63,35 @@ namespace SnapShooter {
                 t.TransferComplete += delegate {
                     TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
                     Dispatcher.Invoke(new Action(delegate {
+                        File.Delete(filename);
+
                         Clipboard.SetText(t.Url);
-                        SnapShots.Items.Add(String.Format("Processed {0}x{1}\nUploaded to {2}", b.Width, b.Height, t.Url));
+
+                        SnapShotItem i = new SnapShotItem();
+                        i.TransitURL = t.Url;
+                        SnapShots.Items.Add(i);
+
                         TaskbarManager.Instance.SetOverlayIcon(null, "");
                     }), null);
                 };
-                t.UploadAsync("clipboard.jpg");
+                t.UploadAsync(filename);
 
                 Clipboard.Clear();
             }
-            return;
+        }
+
+        private void Enabled_Checked(object sender, RoutedEventArgs e) {
+            if (dt == null) return;
+
+            System.Console.WriteLine("Enabled");
+            dt.Start();
+        }
+
+        private void Enabled_Unchecked(object sender, RoutedEventArgs e) {
+            if (dt == null) return;
 
-            throw new NotImplementedException();
-            TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);
-            TaskbarManager.Instance.SetProgressValue(50, 100);
+            System.Console.WriteLine("Disabled");
+            dt.Stop();
         }
     }
 }