Title="SnapShooter" Height="300" Width="600"
Loaded="Window_Loaded">
<Grid>
- <ListBox Name="SnapShots" />
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <StackPanel Name="Menu" HorizontalAlignment="Right" Orientation="Horizontal">
+ <CheckBox Margin="4" Name="Enabled" Checked="Enabled_Checked" Unchecked="Enabled_Unchecked" IsChecked="True">Enabled</CheckBox>
+ <TextBlock Margin="4">
+ <Hyperlink>Help</Hyperlink>
+ </TextBlock>
+ </StackPanel>
+ <ListBox Name="SnapShots" Grid.Row="1" HorizontalContentAlignment="Stretch" />
</Grid>
</Window>
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));
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();
}
}
}
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
- <Reference Include="WindowsBase" />
- <Reference Include="PresentationCore" />
- <Reference Include="PresentationFramework" />
+ <Reference Include="UIAutomationProvider">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="PresentationCore">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="PresentationFramework">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="SnapShotItem.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
+ <Compile Include="SnapShotItem.xaml.cs">
+ <DependentUpon>SnapShotItem.xaml</DependentUpon>
+ </Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
--- /dev/null
+<UserControl x:Class="SnapShooter.SnapShotItem"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Loaded="UserControl_Loaded" Margin="0,4,4,4">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="140"/>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <TextBlock Name="DateTimeLabel" Grid.Column="0" Margin="4">
+ 12/7/2009 00:55:32 AM
+ </TextBlock>
+ <TextBlock Grid.Column="1" Margin="4">
+ <Hyperlink Name="TransitLink" Click="Hyperlink_Click">Transit Link</Hyperlink>
+ </TextBlock>
+ <Button Grid.Column="2" Click="Button_Click">Copy Link</Button>
+ </Grid>
+</UserControl>
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace SnapShooter {
+ /// <summary>
+ /// Interaction logic for SnapShotItem.xaml
+ /// </summary>
+ public partial class SnapShotItem : UserControl {
+ public string TransitURL;
+
+ public SnapShotItem() {
+ InitializeComponent();
+ }
+
+ private void UserControl_Loaded(object sender, RoutedEventArgs e) {
+ DateTimeLabel.Text = DateTime.Now.ToString();
+ }
+
+ private void Hyperlink_Click(object sender, RoutedEventArgs e) {
+ System.Diagnostics.Process.Start(TransitURL);
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e) {
+ Clipboard.SetText(TransitURL);
+ }
+ }
+}