GIT: perform LF normalization

This commit is contained in:
Gary Sharp
2013-02-28 17:15:46 +11:00
parent 989f08a24d
commit 7d9be5620d
729 changed files with 300734 additions and 300712 deletions
+13 -13
View File
@@ -1,14 +1,14 @@
<Application
x:Class="Disco.Silverlight.AttachmentUpload.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Assets/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Application
x:Class="Disco.Silverlight.AttachmentUpload.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Assets/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
+37 -37
View File
@@ -1,37 +1,37 @@
Partial Public Class App
Inherits Application
Public Shared Property UploadUrl As Uri
Public Shared Property MainPage As MainPage
Public Sub New()
InitializeComponent()
End Sub
Private Sub Application_Startup(ByVal o As Object, ByVal e As StartupEventArgs) Handles Me.Startup
MainPage = New MainPage
Me.RootVisual = MainPage
UploadUrl = New Uri(Application.Current.Host.Source.AbsoluteUri.Substring(0, Application.Current.Host.Source.AbsoluteUri.IndexOf("/", 8)) & e.InitParams.Item("UploadUrl"))
End Sub
Private Sub Application_UnhandledException(ByVal sender As Object, ByVal e As ApplicationUnhandledExceptionEventArgs) Handles Me.UnhandledException
' If the app is running outside of the debugger then report the exception using
' the browser's exception mechanism. On IE this will display it a yellow alert
' icon in the status bar and Firefox will display a script error.
If Not System.Diagnostics.Debugger.IsAttached Then
' NOTE: This will allow the application to continue running after an exception has been thrown
' but not handled.
' For production applications this error handling should be replaced with something that will
' report the error to the website and stop the application.
e.Handled = True
Dim errorWindow As ChildWindow = New ErrorWindow(e.ExceptionObject)
errorWindow.Show()
End If
End Sub
End Class
Partial Public Class App
Inherits Application
Public Shared Property UploadUrl As Uri
Public Shared Property MainPage As MainPage
Public Sub New()
InitializeComponent()
End Sub
Private Sub Application_Startup(ByVal o As Object, ByVal e As StartupEventArgs) Handles Me.Startup
MainPage = New MainPage
Me.RootVisual = MainPage
UploadUrl = New Uri(Application.Current.Host.Source.AbsoluteUri.Substring(0, Application.Current.Host.Source.AbsoluteUri.IndexOf("/", 8)) & e.InitParams.Item("UploadUrl"))
End Sub
Private Sub Application_UnhandledException(ByVal sender As Object, ByVal e As ApplicationUnhandledExceptionEventArgs) Handles Me.UnhandledException
' If the app is running outside of the debugger then report the exception using
' the browser's exception mechanism. On IE this will display it a yellow alert
' icon in the status bar and Firefox will display a script error.
If Not System.Diagnostics.Debugger.IsAttached Then
' NOTE: This will allow the application to continue running after an exception has been thrown
' but not handled.
' For production applications this error handling should be replaced with something that will
' report the error to the website and stop the application.
e.Handled = True
Dim errorWindow As ChildWindow = New ErrorWindow(e.ExceptionObject)
errorWindow.Show()
End If
End Sub
End Class
@@ -1,350 +1,350 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation">
<!-- ******MAIN PAGE STYLES****** -->
<!-- **************************** -->
<!-- Primary Color Brushes -->
<SolidColorBrush x:Key="NavigationBackgroundColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="NavigationForegroundColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="HighLightColorBrush" Color="#FF0097FC"/>
<SolidColorBrush x:Key="HoverHyperlinkForegroundColorBrush" Color="#FFEBF7FF"/>
<SolidColorBrush x:Key="HoverHyperLinkBackgroundColorBrush" Color="#FF747474"/>
<SolidColorBrush x:Key="BodyTextColorBrush" Color="#FF313131"/>
<Style TargetType="Button">
<Setter Property="Background" Value="#FFDB761D"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
<Setter Property="Padding" Value="14, 8"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#FF875A33" />
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FF9e9e9e"/>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF696969"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FF9e9e9e"/>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF696969"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" To=".55"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused" />
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Background" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
</Border>
<ContentPresenter
x:Name="contentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
<Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Opacity="0" IsHitTestVisible="false" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- LayoutRoot Grid Style -->
<Style x:Key="LayoutRootGridStyle" TargetType="Grid">
<Setter Property="Background" Value="#FFFFFFFF"/>
</Style>
<!-- Content Border Style -->
<Style x:Key="ContentBorderStyle" TargetType="Border">
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="BorderThickness" Value="0,3,0,0"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
<!-- Content Frame Style -->
<Style x:Key="ContentFrameStyle" TargetType="navigation:Frame">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="58,15,58,15"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
<!-- Navigation Grid Style -->
<Style x:Key="NavigationGridStyle" TargetType="Grid">
<Setter Property="Background" Value="{StaticResource NavigationBackgroundColorBrush}"/>
<Setter Property="Height" Value="22"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<!-- Branding Border Style -->
<Style x:Key="BrandingBorderStyle" TargetType="Border">
<Setter Property="Height" Value="22"/>
<Setter Property="Margin" Value="25,0,25,0"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<!-- Branding StackPanel Style -->
<Style x:Key="BrandingStackPanelStyle" TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Orientation" Value="Horizontal"/>
</Style>
<!-- Links Border Style -->
<Style x:Key="LinksBorderStyle" TargetType="Border">
<Setter Property="Height" Value="42"/>
<Setter Property="Margin" Value="25,0,25,0"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<!-- Links StackPanel Style -->
<Style x:Key="LinksStackPanelStyle" TargetType="StackPanel">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Orientation" Value="Horizontal"/>
</Style>
<!-- Link Style -->
<Style x:Key="LinkStyle" TargetType="HyperlinkButton">
<Setter Property="Background" Value="{StaticResource HighLightColorBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#FF9D9492"/>
<Setter Property="Foreground" Value="{StaticResource NavigationForegroundColorBrush}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="MinHeight" Value="28"/>
<Setter Property="MinWidth" Value="78"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="8,4,8,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="HyperlinkButton">
<Grid x:Name="ButtonGrid" Cursor="{TemplateBinding Cursor}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.95"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="10"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.8"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="5"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<HorizontalAlignment>Center</HorizontalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(FrameworkElement.VerticalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<VerticalAlignment>Center</VerticalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<HorizontalAlignment>Center</HorizontalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="(FrameworkElement.VerticalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<VerticalAlignment>Center</VerticalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="LinkStates">
<VisualState x:Name="ActiveLink">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ActiveBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="InactiveLink"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="0" Value="0.35"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="(Rectangle.RadiusX)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="(Rectangle.RadiusY)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle x:Name="FocusVisualElement" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" Opacity="0" Margin="-1" RadiusX="1" RadiusY="1"/>
<Border x:Name="ActiveBorder" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1" Opacity="0"/>
<Border x:Name="ContentBorder" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" Opacity="1">
<ContentPresenter x:Name="ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Opacity="1">
<ContentPresenter.Effect>
<DropShadowEffect ShadowDepth="0" Color="#FF484848" Opacity="0.65" BlurRadius="0"/>
</ContentPresenter.Effect>
</ContentPresenter>
</Border>
<Border x:Name="InteractiveBorder" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" Background="{StaticResource HoverHyperLinkBackgroundColorBrush}" BorderThickness="1,1,1,1" Opacity="0" BorderBrush="{StaticResource HoverHyperLinkBackgroundColorBrush}" CornerRadius="1,1,1,1"/>
<Border x:Name="InteractiveElementBorder" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed">
<TextBlock x:Name="InteractiveElement" Foreground="{StaticResource HoverHyperlinkForegroundColorBrush}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}"/>
</Border>
<TextBlock x:Name="DisabledOverlay" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}" Foreground="#FFAAAAAA" Visibility="Collapsed"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Divider Style -->
<Style x:Key="DividerStyle" TargetType="Rectangle">
<Setter Property="Fill" Value="#1FFFFFFF"/>
<Setter Property="Stroke" Value="Transparent"/>
<Setter Property="Width" Value="1"/>
<Setter Property="Margin" Value="2,4,2,4"/>
</Style>
<!-- ******CONTENT PAGE STYLES****** -->
<!-- ******************************* -->
<!-- Page Style -->
<Style x:Key="PageStyle" TargetType="navigation:Page">
<Setter Property="FontFamily" Value="Segoe UI,Arial" />
</Style>
<!-- Page ScrollViewer Style -->
<Style x:Key="PageScrollViewerStyle" TargetType="ScrollViewer">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0,1,0,1"/>
<Setter Property="Margin" Value="-58,-15,-58,-15"/>
<Setter Property="Padding" Value="58,0,58,0"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
</Style>
<!-- Content Panel Style -->
<Style x:Key="ContentPanelStyle" TargetType="StackPanel"/>
<!-- Header Text Style -->
<Style x:Key="HeaderTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource BodyTextColorBrush}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Margin" Value="0,15,0,4"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<!-- Content Text Style -->
<Style x:Key="ContentTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource BodyTextColorBrush}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Margin" Value="0,2,0,2"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<!-- Page HyperlinkButton Style -->
<Style x:Key="PageHyperlinkButtonStyle" TargetType="HyperlinkButton">
<Setter Property="TargetName" Value="_new"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation">
<!-- ******MAIN PAGE STYLES****** -->
<!-- **************************** -->
<!-- Primary Color Brushes -->
<SolidColorBrush x:Key="NavigationBackgroundColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="NavigationForegroundColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="HighLightColorBrush" Color="#FF0097FC"/>
<SolidColorBrush x:Key="HoverHyperlinkForegroundColorBrush" Color="#FFEBF7FF"/>
<SolidColorBrush x:Key="HoverHyperLinkBackgroundColorBrush" Color="#FF747474"/>
<SolidColorBrush x:Key="BodyTextColorBrush" Color="#FF313131"/>
<Style TargetType="Button">
<Setter Property="Background" Value="#FFDB761D"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
<Setter Property="Padding" Value="14, 8"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#FF875A33" />
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FF9e9e9e"/>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF696969"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FF9e9e9e"/>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF696969"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" To=".55"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused" />
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Background" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
</Border>
<ContentPresenter
x:Name="contentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
<Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Opacity="0" IsHitTestVisible="false" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- LayoutRoot Grid Style -->
<Style x:Key="LayoutRootGridStyle" TargetType="Grid">
<Setter Property="Background" Value="#FFFFFFFF"/>
</Style>
<!-- Content Border Style -->
<Style x:Key="ContentBorderStyle" TargetType="Border">
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="BorderThickness" Value="0,3,0,0"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
<!-- Content Frame Style -->
<Style x:Key="ContentFrameStyle" TargetType="navigation:Frame">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="58,15,58,15"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
<!-- Navigation Grid Style -->
<Style x:Key="NavigationGridStyle" TargetType="Grid">
<Setter Property="Background" Value="{StaticResource NavigationBackgroundColorBrush}"/>
<Setter Property="Height" Value="22"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<!-- Branding Border Style -->
<Style x:Key="BrandingBorderStyle" TargetType="Border">
<Setter Property="Height" Value="22"/>
<Setter Property="Margin" Value="25,0,25,0"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<!-- Branding StackPanel Style -->
<Style x:Key="BrandingStackPanelStyle" TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Orientation" Value="Horizontal"/>
</Style>
<!-- Links Border Style -->
<Style x:Key="LinksBorderStyle" TargetType="Border">
<Setter Property="Height" Value="42"/>
<Setter Property="Margin" Value="25,0,25,0"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<!-- Links StackPanel Style -->
<Style x:Key="LinksStackPanelStyle" TargetType="StackPanel">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Orientation" Value="Horizontal"/>
</Style>
<!-- Link Style -->
<Style x:Key="LinkStyle" TargetType="HyperlinkButton">
<Setter Property="Background" Value="{StaticResource HighLightColorBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#FF9D9492"/>
<Setter Property="Foreground" Value="{StaticResource NavigationForegroundColorBrush}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="MinHeight" Value="28"/>
<Setter Property="MinWidth" Value="78"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="8,4,8,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="HyperlinkButton">
<Grid x:Name="ButtonGrid" Cursor="{TemplateBinding Cursor}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.95"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="10"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveElementBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.8"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="5"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="InteractiveBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<HorizontalAlignment>Center</HorizontalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(FrameworkElement.VerticalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<VerticalAlignment>Center</VerticalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<HorizontalAlignment>Center</HorizontalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="(FrameworkElement.VerticalAlignment)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<VerticalAlignment>Center</VerticalAlignment>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="LinkStates">
<VisualState x:Name="ActiveLink">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ActiveBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="InactiveLink"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="0" Value="0.35"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="(Rectangle.RadiusX)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="(Rectangle.RadiusY)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle x:Name="FocusVisualElement" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" Opacity="0" Margin="-1" RadiusX="1" RadiusY="1"/>
<Border x:Name="ActiveBorder" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1" Opacity="0"/>
<Border x:Name="ContentBorder" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" Opacity="1">
<ContentPresenter x:Name="ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Opacity="1">
<ContentPresenter.Effect>
<DropShadowEffect ShadowDepth="0" Color="#FF484848" Opacity="0.65" BlurRadius="0"/>
</ContentPresenter.Effect>
</ContentPresenter>
</Border>
<Border x:Name="InteractiveBorder" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" Background="{StaticResource HoverHyperLinkBackgroundColorBrush}" BorderThickness="1,1,1,1" Opacity="0" BorderBrush="{StaticResource HoverHyperLinkBackgroundColorBrush}" CornerRadius="1,1,1,1"/>
<Border x:Name="InteractiveElementBorder" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed">
<TextBlock x:Name="InteractiveElement" Foreground="{StaticResource HoverHyperlinkForegroundColorBrush}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}"/>
</Border>
<TextBlock x:Name="DisabledOverlay" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}" Foreground="#FFAAAAAA" Visibility="Collapsed"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Divider Style -->
<Style x:Key="DividerStyle" TargetType="Rectangle">
<Setter Property="Fill" Value="#1FFFFFFF"/>
<Setter Property="Stroke" Value="Transparent"/>
<Setter Property="Width" Value="1"/>
<Setter Property="Margin" Value="2,4,2,4"/>
</Style>
<!-- ******CONTENT PAGE STYLES****** -->
<!-- ******************************* -->
<!-- Page Style -->
<Style x:Key="PageStyle" TargetType="navigation:Page">
<Setter Property="FontFamily" Value="Segoe UI,Arial" />
</Style>
<!-- Page ScrollViewer Style -->
<Style x:Key="PageScrollViewerStyle" TargetType="ScrollViewer">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0,1,0,1"/>
<Setter Property="Margin" Value="-58,-15,-58,-15"/>
<Setter Property="Padding" Value="58,0,58,0"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
</Style>
<!-- Content Panel Style -->
<Style x:Key="ContentPanelStyle" TargetType="StackPanel"/>
<!-- Header Text Style -->
<Style x:Key="HeaderTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource BodyTextColorBrush}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Margin" Value="0,15,0,4"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<!-- Content Text Style -->
<Style x:Key="ContentTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource BodyTextColorBrush}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Margin" Value="0,2,0,2"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<!-- Page HyperlinkButton Style -->
<Style x:Key="PageHyperlinkButtonStyle" TargetType="HyperlinkButton">
<Setter Property="TargetName" Value="_new"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</ResourceDictionary>
@@ -1,196 +1,196 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{85747DDC-1389-4A40-9AFC-F57E0992294E}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Disco.Silverlight.AttachmentUpload</RootNamespace>
<AssemblyName>Disco.Silverlight.AttachmentUpload</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>Disco.Silverlight.AttachmentUpload.xap</XapFilename>
<SilverlightManifestTemplate>My Project\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>Disco.Silverlight.AttachmentUpload.App</SilverlightAppEntry>
<TestPageFileName>Disco.Silverlight.AttachmentUploadTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>My Project\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<UsePlatformExtensions>false</UsePlatformExtensions>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<MyType>Empty</MyType>
<OutputPath>Bin\Debug</OutputPath>
<DocumentationFile>Disco.Silverlight.AttachmentUpload.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DefineConstants>SILVERLIGHT=1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DocumentationFile>Disco.Silverlight.AttachmentUpload.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DefineConstants>SILVERLIGHT=1</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="fastJSON-SL">
<HintPath>..\..\Resources\Libraries\fastJSON\fastJSON-SL.dll</HintPath>
</Reference>
<Reference Include="FJ.Core">
<HintPath>..\..\Resources\Libraries\FJ.Core\FJ.Core.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="System.Windows.Controls" />
<Reference Include="System.Windows.Controls.Navigation" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Linq" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Xml" />
<Import Include="System.Net" />
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Ink" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Animation" />
<Import Include="System.Windows.Shapes" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Disco.BI.VB\BI\Utilities.vb">
<Link>Utilities.vb</Link>
</Compile>
<Compile Include="App.xaml.vb">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="FileUploader.vb" />
<Compile Include="JavascriptNavigator.vb" />
<Compile Include="MainPage.xaml.vb">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="Views\FileWindow.xaml.vb">
<DependentUpon>FileWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ErrorWindow.xaml.vb">
<DependentUpon>ErrorWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\File.xaml.vb">
<DependentUpon>File.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Hidden.xaml.vb">
<DependentUpon>Hidden.xaml</DependentUpon>
</Compile>
<Compile Include="Views\WebCam.xaml.vb">
<DependentUpon>WebCam.xaml</DependentUpon>
</Compile>
<Compile Include="WriteableBitmapExtensions.vb" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Resource Include="Assets\Styles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Resource>
<Page Include="Views\FileWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ErrorWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\File.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Hidden.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\WebCam.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="My Project\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\dropTarget.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
<UserProperties BuildVersion_UseGlobalSettings="True" />
</VisualStudio>
</ProjectExtensions>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{85747DDC-1389-4A40-9AFC-F57E0992294E}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Disco.Silverlight.AttachmentUpload</RootNamespace>
<AssemblyName>Disco.Silverlight.AttachmentUpload</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>Disco.Silverlight.AttachmentUpload.xap</XapFilename>
<SilverlightManifestTemplate>My Project\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>Disco.Silverlight.AttachmentUpload.App</SilverlightAppEntry>
<TestPageFileName>Disco.Silverlight.AttachmentUploadTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>My Project\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<UsePlatformExtensions>false</UsePlatformExtensions>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<MyType>Empty</MyType>
<OutputPath>Bin\Debug</OutputPath>
<DocumentationFile>Disco.Silverlight.AttachmentUpload.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DefineConstants>SILVERLIGHT=1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DocumentationFile>Disco.Silverlight.AttachmentUpload.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DefineConstants>SILVERLIGHT=1</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="fastJSON-SL">
<HintPath>..\..\Resources\Libraries\fastJSON\fastJSON-SL.dll</HintPath>
</Reference>
<Reference Include="FJ.Core">
<HintPath>..\..\Resources\Libraries\FJ.Core\FJ.Core.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="System.Windows.Controls" />
<Reference Include="System.Windows.Controls.Navigation" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Linq" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Xml" />
<Import Include="System.Net" />
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Ink" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Animation" />
<Import Include="System.Windows.Shapes" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Disco.BI.VB\BI\Utilities.vb">
<Link>Utilities.vb</Link>
</Compile>
<Compile Include="App.xaml.vb">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="FileUploader.vb" />
<Compile Include="JavascriptNavigator.vb" />
<Compile Include="MainPage.xaml.vb">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="Views\FileWindow.xaml.vb">
<DependentUpon>FileWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ErrorWindow.xaml.vb">
<DependentUpon>ErrorWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\File.xaml.vb">
<DependentUpon>File.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Hidden.xaml.vb">
<DependentUpon>Hidden.xaml</DependentUpon>
</Compile>
<Compile Include="Views\WebCam.xaml.vb">
<DependentUpon>WebCam.xaml</DependentUpon>
</Compile>
<Compile Include="WriteableBitmapExtensions.vb" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Resource Include="Assets\Styles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Resource>
<Page Include="Views\FileWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ErrorWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\File.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Hidden.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\WebCam.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="My Project\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\dropTarget.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
<UserProperties BuildVersion_UseGlobalSettings="True" />
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -1,77 +1,77 @@
Imports System.Text
Imports Disco.Silverlight.AttachmentUpload.BI
Public Class FileUploader
Public Property Url As Uri
Public Property Stream As IO.Stream
Public Property StreamFilename As String
Public Property StreamMimeType As String
Public Property Form As Dictionary(Of String, String)
Private _HttpSend As HttpWebRequest
Private _UploadBoundaryValue As String
Private _Complete As UploadComplete
Public Delegate Sub UploadComplete(Sender As FileUploader, Success As Boolean, Id As Integer)
Public Sub New(Url As Uri, Stream As IO.Stream, StreamFilename As String, StreamMimeType As String, Form As Dictionary(Of String, String), Optional Complete As UploadComplete = Nothing)
Me.Url = Url
Me.Stream = Stream
Me.StreamFilename = StreamFilename
Me.StreamMimeType = StreamMimeType
Me.Form = Form
Me._Complete = Complete
Start()
End Sub
Public Sub Start()
Stream.Position = 0
Me._HttpSend = WebRequest.Create(App.UploadUrl)
Me._UploadBoundaryValue = ("----------------------------" & DateTime.Now.Ticks.ToString("x"))
Me._HttpSend.ContentType = "multipart/form-data; boundary=" & Me._UploadBoundaryValue
Me._HttpSend.Method = "POST"
Me._HttpSend.BeginGetRequestStream(New AsyncCallback(AddressOf Me.BeginSendRequest), Nothing)
End Sub
Private Sub BeginSendRequest(ByVal result As IAsyncResult)
Using requestStream As IO.Stream = _HttpSend.EndGetRequestStream(result)
Dim format As String = ("{0}--" & _UploadBoundaryValue & "{0}Content-Disposition: form-data; name=""{1}"";{0}{0}{2}")
Dim pair As KeyValuePair(Of String, String)
For Each pair In Form
Dim str4 As String = String.Format(format, Environment.NewLine, pair.Key, pair.Value)
Dim buffer3 As Byte() = Encoding.UTF8.GetBytes(str4)
requestStream.Write(buffer3, 0, buffer3.Length)
Next
Dim s As String = String.Format(("{0}--" & _UploadBoundaryValue & "{0}Content-Disposition: form-data; name=""{1}""; filename=""{2}""{0}Content-Type: {3}{0}{0}"), Environment.NewLine, "File", Me.StreamFilename, Me.StreamMimeType)
Dim bytes As Byte() = Encoding.UTF8.GetBytes(s)
requestStream.Write(bytes, 0, bytes.Length)
Me.Stream.CopyTo(requestStream)
Me.Stream.Close()
Me.Stream.Dispose()
Dim buffer As Byte() = Encoding.UTF8.GetBytes(String.Format("{0}--{1}{0}", Environment.NewLine, Me._UploadBoundaryValue))
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
requestStream.Close()
End Using
_HttpSend.BeginGetResponse(New AsyncCallback(AddressOf Me.BeginGetResponse), Nothing)
End Sub
Private Sub BeginGetResponse(ByVal result As IAsyncResult)
Dim response As HttpWebResponse = _HttpSend.EndGetResponse(result)
Dim responseId As Integer = -1
If response.StatusCode = 200 Then
Dim responseString = response.GetResponseStream.StreamToString()
Integer.TryParse(responseString, responseId)
End If
If _Complete IsNot Nothing Then
_Complete.Invoke(Me, (response.StatusCode = 200), responseId)
End If
End Sub
End Class
Imports System.Text
Imports Disco.Silverlight.AttachmentUpload.BI
Public Class FileUploader
Public Property Url As Uri
Public Property Stream As IO.Stream
Public Property StreamFilename As String
Public Property StreamMimeType As String
Public Property Form As Dictionary(Of String, String)
Private _HttpSend As HttpWebRequest
Private _UploadBoundaryValue As String
Private _Complete As UploadComplete
Public Delegate Sub UploadComplete(Sender As FileUploader, Success As Boolean, Id As Integer)
Public Sub New(Url As Uri, Stream As IO.Stream, StreamFilename As String, StreamMimeType As String, Form As Dictionary(Of String, String), Optional Complete As UploadComplete = Nothing)
Me.Url = Url
Me.Stream = Stream
Me.StreamFilename = StreamFilename
Me.StreamMimeType = StreamMimeType
Me.Form = Form
Me._Complete = Complete
Start()
End Sub
Public Sub Start()
Stream.Position = 0
Me._HttpSend = WebRequest.Create(App.UploadUrl)
Me._UploadBoundaryValue = ("----------------------------" & DateTime.Now.Ticks.ToString("x"))
Me._HttpSend.ContentType = "multipart/form-data; boundary=" & Me._UploadBoundaryValue
Me._HttpSend.Method = "POST"
Me._HttpSend.BeginGetRequestStream(New AsyncCallback(AddressOf Me.BeginSendRequest), Nothing)
End Sub
Private Sub BeginSendRequest(ByVal result As IAsyncResult)
Using requestStream As IO.Stream = _HttpSend.EndGetRequestStream(result)
Dim format As String = ("{0}--" & _UploadBoundaryValue & "{0}Content-Disposition: form-data; name=""{1}"";{0}{0}{2}")
Dim pair As KeyValuePair(Of String, String)
For Each pair In Form
Dim str4 As String = String.Format(format, Environment.NewLine, pair.Key, pair.Value)
Dim buffer3 As Byte() = Encoding.UTF8.GetBytes(str4)
requestStream.Write(buffer3, 0, buffer3.Length)
Next
Dim s As String = String.Format(("{0}--" & _UploadBoundaryValue & "{0}Content-Disposition: form-data; name=""{1}""; filename=""{2}""{0}Content-Type: {3}{0}{0}"), Environment.NewLine, "File", Me.StreamFilename, Me.StreamMimeType)
Dim bytes As Byte() = Encoding.UTF8.GetBytes(s)
requestStream.Write(bytes, 0, bytes.Length)
Me.Stream.CopyTo(requestStream)
Me.Stream.Close()
Me.Stream.Dispose()
Dim buffer As Byte() = Encoding.UTF8.GetBytes(String.Format("{0}--{1}{0}", Environment.NewLine, Me._UploadBoundaryValue))
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
requestStream.Close()
End Using
_HttpSend.BeginGetResponse(New AsyncCallback(AddressOf Me.BeginGetResponse), Nothing)
End Sub
Private Sub BeginGetResponse(ByVal result As IAsyncResult)
Dim response As HttpWebResponse = _HttpSend.EndGetResponse(result)
Dim responseId As Integer = -1
If response.StatusCode = 200 Then
Dim responseString = response.GetResponseStream.StreamToString()
Integer.TryParse(responseString, responseId)
End If
If _Complete IsNot Nothing Then
_Complete.Invoke(Me, (response.StatusCode = 200), responseId)
End If
End Sub
End Class
@@ -1,24 +1,24 @@
Imports System.Windows.Browser
<ScriptableType()>
Public Class JavascriptNavigator
Private _contentFrame As Controls.Frame
Public Sub New(contentFrame As Controls.Frame)
_contentFrame = contentFrame
End Sub
<ScriptableMember()>
Public Sub Navigate(uri As String)
_contentFrame.Navigate(New Uri(uri, UriKind.Relative))
End Sub
<ScriptableMember()>
Public ReadOnly Property Location As String
Get
Return _contentFrame.Source.ToString
End Get
End Property
End Class
Imports System.Windows.Browser
<ScriptableType()>
Public Class JavascriptNavigator
Private _contentFrame As Controls.Frame
Public Sub New(contentFrame As Controls.Frame)
_contentFrame = contentFrame
End Sub
<ScriptableMember()>
Public Sub Navigate(uri As String)
_contentFrame.Navigate(New Uri(uri, UriKind.Relative))
End Sub
<ScriptableMember()>
Public ReadOnly Property Location As String
Get
Return _contentFrame.Source.ToString
End Get
End Property
End Class
@@ -1,37 +1,37 @@
<UserControl
x:Class="Disco.Silverlight.AttachmentUpload.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}" Grid.Row="0">
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}"
Source="/Hidden" NavigationFailed="ContentFrame_NavigationFailed">
<navigation:Frame.UriMapper>
<uriMapper:UriMapper>
<uriMapper:UriMapping Uri="" MappedUri="/Views/Hidden.xaml"/>
<uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
</uriMapper:UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
</Border>
<Grid x:Name="NavigationGrid" Visibility="Collapsed" Style="{StaticResource NavigationGridStyle}" Grid.Row="1">
<Border x:Name="BrandingBorder" Style="{StaticResource BrandingBorderStyle}">
<StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}">
<TextBlock Text="Uploading..." VerticalAlignment="Center" Margin="0,0,10,0" />
<ProgressBar Width="150" Height="18" IsIndeterminate="True" />
</StackPanel>
</Border>
</Grid>
</Grid>
<UserControl
x:Class="Disco.Silverlight.AttachmentUpload.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}" Grid.Row="0">
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}"
Source="/Hidden" NavigationFailed="ContentFrame_NavigationFailed">
<navigation:Frame.UriMapper>
<uriMapper:UriMapper>
<uriMapper:UriMapping Uri="" MappedUri="/Views/Hidden.xaml"/>
<uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
</uriMapper:UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
</Border>
<Grid x:Name="NavigationGrid" Visibility="Collapsed" Style="{StaticResource NavigationGridStyle}" Grid.Row="1">
<Border x:Name="BrandingBorder" Style="{StaticResource BrandingBorderStyle}">
<StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}">
<TextBlock Text="Uploading..." VerticalAlignment="Center" Margin="0,0,10,0" />
<ProgressBar Width="150" Height="18" IsIndeterminate="True" />
</StackPanel>
</Border>
</Grid>
</Grid>
</UserControl>
@@ -1,60 +1,60 @@
Imports System.Windows.Navigation
Imports System.Windows.Browser
Partial Public Class MainPage
Inherits UserControl
Private _Navigator As JavascriptNavigator
Private _UploadingAttachments As New List(Of FileUploader)
Public Sub New()
InitializeComponent()
_Navigator = New JavascriptNavigator(Me.ContentFrame)
HtmlPage.RegisterScriptableObject("Navigator", _Navigator)
End Sub
Private Sub ContentFrame_NavigationFailed(ByVal sender As Object, ByVal e As NavigationFailedEventArgs) Handles ContentFrame.NavigationFailed
e.Handled = True
Dim errorWindow As ChildWindow = New ErrorWindow(e.Uri)
errorWindow.Show()
End Sub
Public Sub UploadAttachment(stream As IO.Stream, fileName As String, mimeType As String, comments As String)
Dim form As New Dictionary(Of String, String)
form.Add("comments", comments)
Dim ua As New FileUploader(App.UploadUrl, stream, fileName, mimeType, form, New FileUploader.UploadComplete(AddressOf UploadComplete))
_UploadingAttachments.Add(ua)
'Me.NavigationGrid.Visibility = Windows.Visibility.Visible
End Sub
Private Sub UploadComplete(Sender As FileUploader, Success As Boolean, Id As Integer)
If _UploadingAttachments.Contains(Sender) Then
_UploadingAttachments.Remove(Sender)
End If
'If _UploadingAttachments.Count = 0 Then
' Me.Dispatcher.BeginInvoke(Function()
' Me.NavigationGrid.Visibility = Windows.Visibility.Collapsed
' Return Nothing
' End Function)
'End If
If Id >= 0 Then
Me.Dispatcher.BeginInvoke(Function()
Dim discoFunctions = System.Windows.Browser.HtmlPage.Document.GetProperty("DiscoFunctions")
If discoFunctions IsNot Nothing Then
discoFunctions.addAttachment(Id)
End If
Return (Nothing)
End Function)
End If
End Sub
Imports System.Windows.Navigation
Imports System.Windows.Browser
Partial Public Class MainPage
Inherits UserControl
Private _Navigator As JavascriptNavigator
Private _UploadingAttachments As New List(Of FileUploader)
Public Sub New()
InitializeComponent()
_Navigator = New JavascriptNavigator(Me.ContentFrame)
HtmlPage.RegisterScriptableObject("Navigator", _Navigator)
End Sub
Private Sub ContentFrame_NavigationFailed(ByVal sender As Object, ByVal e As NavigationFailedEventArgs) Handles ContentFrame.NavigationFailed
e.Handled = True
Dim errorWindow As ChildWindow = New ErrorWindow(e.Uri)
errorWindow.Show()
End Sub
Public Sub UploadAttachment(stream As IO.Stream, fileName As String, mimeType As String, comments As String)
Dim form As New Dictionary(Of String, String)
form.Add("comments", comments)
Dim ua As New FileUploader(App.UploadUrl, stream, fileName, mimeType, form, New FileUploader.UploadComplete(AddressOf UploadComplete))
_UploadingAttachments.Add(ua)
'Me.NavigationGrid.Visibility = Windows.Visibility.Visible
End Sub
Private Sub UploadComplete(Sender As FileUploader, Success As Boolean, Id As Integer)
If _UploadingAttachments.Contains(Sender) Then
_UploadingAttachments.Remove(Sender)
End If
'If _UploadingAttachments.Count = 0 Then
' Me.Dispatcher.BeginInvoke(Function()
' Me.NavigationGrid.Visibility = Windows.Visibility.Collapsed
' Return Nothing
' End Function)
'End If
If Id >= 0 Then
Me.Dispatcher.BeginInvoke(Function()
Dim discoFunctions = System.Windows.Browser.HtmlPage.Document.GetProperty("DiscoFunctions")
If discoFunctions IsNot Nothing Then
discoFunctions.addAttachment(Id)
End If
Return (Nothing)
End Function)
End If
End Sub
End Class
@@ -1,7 +1,7 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
@@ -1,34 +1,34 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Disco.Silverlight.AttachmentUpload")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Disco.Silverlight.AttachmentUpload")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("c4face53-84f9-4c43-af73-5492c628dbe0")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2012.0423.1327")>
<Assembly: AssemblyFileVersion("1.2012.0423.1327")>
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Disco.Silverlight.AttachmentUpload")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Disco.Silverlight.AttachmentUpload")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("c4face53-84f9-4c43-af73-5492c628dbe0")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2012.0423.1327")>
<Assembly: AssemblyFileVersion("1.2012.0423.1327")>
@@ -1,34 +1,34 @@
<controls:ChildWindow
x:Class="Disco.Silverlight.AttachmentUpload.ErrorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Title="Error">
<Grid x:Name="LayoutRoot" Width="540">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock x:Name="IntroductoryText" Grid.Row="0" Margin="0"
Text="An unknown error was encountered. Please contact your administrator for more information."/>
<StackPanel x:Name="ContentStackPanel" Grid.Row="2" Margin="0,6,0,0">
<TextBlock x:Name="LabelText" TextWrapping="Wrap" Margin="0,0,0,2"
Text="Error details"/>
<TextBox x:Name="ErrorTextBox" Height="90" TextWrapping="Wrap" IsReadOnly="True"
VerticalScrollBarVisibility="Auto"/>
</StackPanel>
<Button x:Name="OKButton" Grid.Row="3" Click="OKButton_Click"
HorizontalAlignment="Right" Margin="0,10,0,0"
TabIndex="0" Content="OK"/>
</Grid>
<controls:ChildWindow
x:Class="Disco.Silverlight.AttachmentUpload.ErrorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Title="Error">
<Grid x:Name="LayoutRoot" Width="540">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock x:Name="IntroductoryText" Grid.Row="0" Margin="0"
Text="An unknown error was encountered. Please contact your administrator for more information."/>
<StackPanel x:Name="ContentStackPanel" Grid.Row="2" Margin="0,6,0,0">
<TextBlock x:Name="LabelText" TextWrapping="Wrap" Margin="0,0,0,2"
Text="Error details"/>
<TextBox x:Name="ErrorTextBox" Height="90" TextWrapping="Wrap" IsReadOnly="True"
VerticalScrollBarVisibility="Auto"/>
</StackPanel>
<Button x:Name="OKButton" Grid.Row="3" Click="OKButton_Click"
HorizontalAlignment="Right" Margin="0,10,0,0"
TabIndex="0" Content="OK"/>
</Grid>
</controls:ChildWindow>
@@ -1,27 +1,27 @@
Partial Public Class ErrorWindow
Inherits ChildWindow
Public Sub New(ByVal e As Exception)
InitializeComponent()
If e IsNot Nothing Then
ErrorTextBox.Text = e.Message + Environment.NewLine + Environment.NewLine + e.StackTrace
End If
End Sub
Public Sub New(ByVal uri As Uri)
InitializeComponent()
If uri IsNot Nothing Then
ErrorTextBox.Text = "Page not found: """ + uri.ToString() + """"""
End If
End Sub
Public Sub New(ByVal message As String, ByVal details As String)
InitializeComponent()
ErrorTextBox.Text = message + Environment.NewLine + Environment.NewLine + details
End Sub
Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Me.DialogResult = True
End Sub
End Class
Partial Public Class ErrorWindow
Inherits ChildWindow
Public Sub New(ByVal e As Exception)
InitializeComponent()
If e IsNot Nothing Then
ErrorTextBox.Text = e.Message + Environment.NewLine + Environment.NewLine + e.StackTrace
End If
End Sub
Public Sub New(ByVal uri As Uri)
InitializeComponent()
If uri IsNot Nothing Then
ErrorTextBox.Text = "Page not found: """ + uri.ToString() + """"""
End If
End Sub
Public Sub New(ByVal message As String, ByVal details As String)
InitializeComponent()
ErrorTextBox.Text = message + Environment.NewLine + Environment.NewLine + details
End Sub
Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Me.DialogResult = True
End Sub
End Class
@@ -1,24 +1,24 @@
<navigation:Page x:Class="Disco.Silverlight.AttachmentUpload.File"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
Title="File Upload"
Style="{StaticResource PageStyle}">
<Grid x:Name="LayoutRoot">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button x:Name="ButtonBrowseForFile" Content="BROWSE FOR FILES" HorizontalAlignment="Center" VerticalAlignment="Center" />
<StackPanel x:Name="DropTarget" Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" AllowDrop="True">
<Image Source="../Assets/dropTarget.png" Stretch="None" Width="128" Height="128" />
<TextBlock HorizontalAlignment="Center">Drop Files Here</TextBlock>
</StackPanel>
</Grid>
</navigation:Page>
<navigation:Page x:Class="Disco.Silverlight.AttachmentUpload.File"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
Title="File Upload"
Style="{StaticResource PageStyle}">
<Grid x:Name="LayoutRoot">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button x:Name="ButtonBrowseForFile" Content="BROWSE FOR FILES" HorizontalAlignment="Center" VerticalAlignment="Center" />
<StackPanel x:Name="DropTarget" Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" AllowDrop="True">
<Image Source="../Assets/dropTarget.png" Stretch="None" Width="128" Height="128" />
<TextBlock HorizontalAlignment="Center">Drop Files Here</TextBlock>
</StackPanel>
</Grid>
</navigation:Page>
@@ -1,62 +1,62 @@
Partial Public Class File
Inherits Page
Public Sub New()
InitializeComponent()
End Sub
Private _FileWindow As FileWindow
Private _ProcessFile As IO.FileInfo
Private _ProcessFiles As Queue(Of IO.FileInfo)
'Executes when the user navigates to this page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs)
_ProcessFiles = New Queue(Of IO.FileInfo)
End Sub
Private Sub ButtonBrowseForFile_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonBrowseForFile.Click
Dim ofd As New OpenFileDialog() With {.Multiselect = True}
If ofd.ShowDialog() Then
For Each f In ofd.Files
_ProcessFiles.Enqueue(f)
Next
StartProcessing()
End If
End Sub
Private Sub StartProcessing()
If _ProcessFiles.Count > 0 Then
_ProcessFile = _ProcessFiles.Dequeue
_FileWindow = New FileWindow(_ProcessFile)
AddHandler _FileWindow.Closed, AddressOf FileWindow_Closed
_FileWindow.Show()
End If
End Sub
Private Sub FileWindow_Closed(sender As Object, e As EventArgs)
If _FileWindow.DialogResult Then
Me.IsEnabled = False
Dim fs = _FileWindow.File.OpenRead
App.MainPage.UploadAttachment(fs, _FileWindow.Filename, "unknown/unknown", _FileWindow.Comments)
Me.IsEnabled = True
End If
StartProcessing()
End Sub
Private Sub DropTarget_Drop(sender As Object, e As System.Windows.DragEventArgs) Handles DropTarget.Drop
For Each f As IO.FileInfo In e.Data.GetData(DataFormats.FileDrop)
_ProcessFiles.Enqueue(f)
Next
StartProcessing()
End Sub
End Class
Partial Public Class File
Inherits Page
Public Sub New()
InitializeComponent()
End Sub
Private _FileWindow As FileWindow
Private _ProcessFile As IO.FileInfo
Private _ProcessFiles As Queue(Of IO.FileInfo)
'Executes when the user navigates to this page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs)
_ProcessFiles = New Queue(Of IO.FileInfo)
End Sub
Private Sub ButtonBrowseForFile_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonBrowseForFile.Click
Dim ofd As New OpenFileDialog() With {.Multiselect = True}
If ofd.ShowDialog() Then
For Each f In ofd.Files
_ProcessFiles.Enqueue(f)
Next
StartProcessing()
End If
End Sub
Private Sub StartProcessing()
If _ProcessFiles.Count > 0 Then
_ProcessFile = _ProcessFiles.Dequeue
_FileWindow = New FileWindow(_ProcessFile)
AddHandler _FileWindow.Closed, AddressOf FileWindow_Closed
_FileWindow.Show()
End If
End Sub
Private Sub FileWindow_Closed(sender As Object, e As EventArgs)
If _FileWindow.DialogResult Then
Me.IsEnabled = False
Dim fs = _FileWindow.File.OpenRead
App.MainPage.UploadAttachment(fs, _FileWindow.Filename, "unknown/unknown", _FileWindow.Comments)
Me.IsEnabled = True
End If
StartProcessing()
End Sub
Private Sub DropTarget_Drop(sender As Object, e As System.Windows.DragEventArgs) Handles DropTarget.Drop
For Each f As IO.FileInfo In e.Data.GetData(DataFormats.FileDrop)
_ProcessFiles.Enqueue(f)
Next
StartProcessing()
End Sub
End Class
@@ -1,50 +1,50 @@
<controls:ChildWindow
x:Class="Disco.Silverlight.AttachmentUpload.FileWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Title="Upload File">
<Grid x:Name="LayoutRoot" Width="540">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock x:Name="IntroductoryText" Grid.Row="0" Margin="0"
Text="Please provide details for the file."/>
<StackPanel x:Name="ContentStackPanel" Grid.Row="2" Margin="0,6,0,0">
<TextBlock x:Name="LabelText" TextWrapping="Wrap" Margin="0,0,0,2"
Text="Details"/>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0">Filename:</TextBlock>
<TextBlock Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0">Comments:</TextBlock>
<TextBlock x:Name="textBlockName" Grid.Row="0" Grid.Column="1" Margin="4" Text="{Binding Filename}" />
<TextBox x:Name="textBlockComments" Grid.Row="1" Grid.Column="1" Height="24" Margin="4" Text="{Binding Comments}" />
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Margin="0,10,0,0">
<Button x:Name="ButtonCancel" Click="ButtonCancel_Click" Padding="14 6" VerticalAlignment="Bottom"
Margin="0,0,10,0"
TabIndex="0" Content="CANCEL"/>
<Button x:Name="ButtonOK" Click="ButtonOK_Click" Padding="14 6" VerticalAlignment="Bottom"
TabIndex="0" Content="OK" />
</StackPanel>
</Grid>
<controls:ChildWindow
x:Class="Disco.Silverlight.AttachmentUpload.FileWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Title="Upload File">
<Grid x:Name="LayoutRoot" Width="540">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock x:Name="IntroductoryText" Grid.Row="0" Margin="0"
Text="Please provide details for the file."/>
<StackPanel x:Name="ContentStackPanel" Grid.Row="2" Margin="0,6,0,0">
<TextBlock x:Name="LabelText" TextWrapping="Wrap" Margin="0,0,0,2"
Text="Details"/>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0">Filename:</TextBlock>
<TextBlock Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0">Comments:</TextBlock>
<TextBlock x:Name="textBlockName" Grid.Row="0" Grid.Column="1" Margin="4" Text="{Binding Filename}" />
<TextBox x:Name="textBlockComments" Grid.Row="1" Grid.Column="1" Height="24" Margin="4" Text="{Binding Comments}" />
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Margin="0,10,0,0">
<Button x:Name="ButtonCancel" Click="ButtonCancel_Click" Padding="14 6" VerticalAlignment="Bottom"
Margin="0,0,10,0"
TabIndex="0" Content="CANCEL"/>
<Button x:Name="ButtonOK" Click="ButtonOK_Click" Padding="14 6" VerticalAlignment="Bottom"
TabIndex="0" Content="OK" />
</StackPanel>
</Grid>
</controls:ChildWindow>
@@ -1,55 +1,55 @@
Partial Public Class FileWindow
Inherits ChildWindow
Public Property File As IO.FileInfo
Public Property Filename As String
Public Property Comments As String
Private _InitialFocus As Boolean = False
Public Sub New(File As IO.FileInfo)
InitializeComponent()
Me.File = File
Me.Filename = File.Name
Me.Comments = String.Empty
Me.DataContext = Me
End Sub
Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
If String.IsNullOrEmpty(Me.textBlockComments.Text) Then
MessageBox.Show("Please provide a Comment")
Me.textBlockComments.Focus()
Else
Me.Comments = textBlockComments.Text
Me.DialogResult = True
End If
End Sub
Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Me.DialogResult = False
End Sub
Private Sub textBlockComments_KeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs) Handles textBlockComments.KeyDown
If e.Key = Key.Enter Then
ButtonOK_Click(Nothing, Nothing)
Return
End If
If e.Key = Key.Escape Then
ButtonCancel_Click(Nothing, Nothing)
Return
End If
End Sub
Private Sub FileWindow_GotFocus(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.GotFocus
If Not _InitialFocus Then
Me.textBlockComments.Focus()
_InitialFocus = True
End If
End Sub
End Class
Partial Public Class FileWindow
Inherits ChildWindow
Public Property File As IO.FileInfo
Public Property Filename As String
Public Property Comments As String
Private _InitialFocus As Boolean = False
Public Sub New(File As IO.FileInfo)
InitializeComponent()
Me.File = File
Me.Filename = File.Name
Me.Comments = String.Empty
Me.DataContext = Me
End Sub
Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
If String.IsNullOrEmpty(Me.textBlockComments.Text) Then
MessageBox.Show("Please provide a Comment")
Me.textBlockComments.Focus()
Else
Me.Comments = textBlockComments.Text
Me.DialogResult = True
End If
End Sub
Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Me.DialogResult = False
End Sub
Private Sub textBlockComments_KeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs) Handles textBlockComments.KeyDown
If e.Key = Key.Enter Then
ButtonOK_Click(Nothing, Nothing)
Return
End If
If e.Key = Key.Escape Then
ButtonCancel_Click(Nothing, Nothing)
Return
End If
End Sub
Private Sub FileWindow_GotFocus(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.GotFocus
If Not _InitialFocus Then
Me.textBlockComments.Focus()
_InitialFocus = True
End If
End Sub
End Class
@@ -1,14 +1,14 @@
<navigation:Page x:Class="Disco.Silverlight.AttachmentUpload.Hidden"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="640" d:DesignHeight="480"
Title="Hidden Page">
<Grid x:Name="LayoutRoot">
</Grid>
</navigation:Page>
<navigation:Page x:Class="Disco.Silverlight.AttachmentUpload.Hidden"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="640" d:DesignHeight="480"
Title="Hidden Page">
<Grid x:Name="LayoutRoot">
</Grid>
</navigation:Page>
@@ -1,13 +1,13 @@
Partial Public Class Hidden
Inherits Page
Public Sub New()
InitializeComponent()
End Sub
'Executes when the user navigates to this page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs)
End Sub
End Class
Partial Public Class Hidden
Inherits Page
Public Sub New()
InitializeComponent()
End Sub
'Executes when the user navigates to this page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs)
End Sub
End Class
@@ -1,37 +1,37 @@
<navigation:Page x:Class="Disco.Silverlight.AttachmentUpload.WebCam"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
Title="WebCam Capture"
Style="{StaticResource PageStyle}">
<Grid x:Name="LayoutRoot">
<Grid x:Name="WebCamAccessHost" Visibility="Collapsed">
<Button x:Name="ButtonStartWebCam" Content="START WEBCAM" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="14, 8" />
</Grid>
<Grid x:Name="WebCamShow" Visibility="Collapsed">
<Rectangle x:Name="WebCamHost" />
<Button x:Name="ButtonCapture" Content="CAPTURE IMAGE" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" />
</Grid>
<Border x:Name="WebCamCaptured" Visibility="Collapsed" Width="600" Height="450" Background="#BBffe3cb" BorderBrush="#FFDB761D" BorderThickness="4" CornerRadius="4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle x:Name="WebCamCapturedImage" Grid.ColumnSpan="4" Margin="14" />
<Button x:Name="ButtonCancel" Grid.Row="1" Grid.Column="0" Content="CANCEL" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" Margin="6" />
<TextBlock Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="10 0">Comments:</TextBlock>
<TextBox Grid.Row="1" Grid.Column="2" x:Name="TextBoxComments" Height="24" />
<Button x:Name="ButtonPost" Grid.Row="1" Grid.Column="3" Content="UPLOAD IMAGE" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" Margin="6" />
</Grid>
</Border>
</Grid>
<navigation:Page x:Class="Disco.Silverlight.AttachmentUpload.WebCam"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
Title="WebCam Capture"
Style="{StaticResource PageStyle}">
<Grid x:Name="LayoutRoot">
<Grid x:Name="WebCamAccessHost" Visibility="Collapsed">
<Button x:Name="ButtonStartWebCam" Content="START WEBCAM" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="14, 8" />
</Grid>
<Grid x:Name="WebCamShow" Visibility="Collapsed">
<Rectangle x:Name="WebCamHost" />
<Button x:Name="ButtonCapture" Content="CAPTURE IMAGE" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" />
</Grid>
<Border x:Name="WebCamCaptured" Visibility="Collapsed" Width="600" Height="450" Background="#BBffe3cb" BorderBrush="#FFDB761D" BorderThickness="4" CornerRadius="4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle x:Name="WebCamCapturedImage" Grid.ColumnSpan="4" Margin="14" />
<Button x:Name="ButtonCancel" Grid.Row="1" Grid.Column="0" Content="CANCEL" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" Margin="6" />
<TextBlock Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="10 0">Comments:</TextBlock>
<TextBox Grid.Row="1" Grid.Column="2" x:Name="TextBoxComments" Height="24" />
<Button x:Name="ButtonPost" Grid.Row="1" Grid.Column="3" Content="UPLOAD IMAGE" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" Margin="6" />
</Grid>
</Border>
</Grid>
</navigation:Page>
@@ -1,143 +1,143 @@
Imports System.Windows.Media.Effects
Partial Public Class WebCam
Inherits Page
Public Sub New()
InitializeComponent()
End Sub
Private _CaptureSource As CaptureSource
Private _VideoBrush As VideoBrush
Private _CapturedImage As Imaging.WriteableBitmap
'Executes when the user navigates to this page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs)
If _CaptureSource Is Nothing Then
'' Init WebCam
_CaptureSource = New CaptureSource
_CaptureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()
'' Get Best Quality Image
_CaptureSource.VideoCaptureDevice.DesiredFormat = (From f In _CaptureSource.VideoCaptureDevice.SupportedFormats Where f.PixelHeight <= 720
Order By (f.FramesPerSecond * f.PixelHeight * f.PixelWidth) Descending).FirstOrDefault()
AddHandler _CaptureSource.CaptureImageCompleted, AddressOf CaptureSource_CaptureImageCompleted
_VideoBrush = New VideoBrush()
_VideoBrush.Stretch = Stretch.Uniform
_VideoBrush.SetSource(_CaptureSource)
WebCamHost.Fill = _VideoBrush
End If
If (CaptureDeviceConfiguration.AllowedDeviceAccess) Then
ButtonStartWebCam_Click(Nothing, Nothing)
Else
WebCamAccessHost.Visibility = Windows.Visibility.Visible
WebCamCaptured.Visibility = Windows.Visibility.Collapsed
WebCamShow.Visibility = Windows.Visibility.Collapsed
End If
End Sub
Protected Overrides Sub OnNavigatedFrom(e As System.Windows.Navigation.NavigationEventArgs)
If _CaptureSource IsNot Nothing Then
If _CaptureSource.State = CaptureState.Started Then
_CaptureSource.Stop()
End If
End If
MyBase.OnNavigatedFrom(e)
End Sub
Private Sub ButtonStartWebCam_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonStartWebCam.Click
If (CaptureDeviceConfiguration.AllowedDeviceAccess OrElse CaptureDeviceConfiguration.RequestDeviceAccess()) Then
_CapturedImage = Nothing
Me.WebCamShow.Effect = Nothing
WebCamAccessHost.Visibility = Windows.Visibility.Collapsed
WebCamShow.Visibility = Windows.Visibility.Visible
WebCamCaptured.Visibility = Windows.Visibility.Collapsed
_CaptureSource.Start()
Me.ButtonCapture.Focus()
Else
WebCamAccessHost.Visibility = Windows.Visibility.Visible
WebCamCaptured.Visibility = Windows.Visibility.Collapsed
WebCamShow.Visibility = Windows.Visibility.Collapsed
End If
Me.IsEnabled = True
End Sub
Private Sub ButtonCapture_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonCapture.Click
_CaptureSource.CaptureImageAsync()
End Sub
Private Sub CaptureSource_CaptureImageCompleted(sender As Object, e As CaptureImageCompletedEventArgs)
Me.Dispatcher.BeginInvoke(Function()
ImageCaptured(e.Result)
Return Nothing
End Function)
End Sub
Private Sub ImageCaptured(image As Imaging.WriteableBitmap)
_CapturedImage = image
_CaptureSource.Stop()
Dim effect As New BlurEffect() With {.Radius = 15}
Me.WebCamShow.Effect = effect
Dim capturedImageBrush = New ImageBrush() With {.ImageSource = _CapturedImage, .Stretch = Stretch.Uniform}
Me.WebCamCapturedImage.Fill = capturedImageBrush
Me.TextBoxComments.Text = String.Empty
Me.WebCamCaptured.Visibility = Windows.Visibility.Visible
Me.TextBoxComments.Focus()
End Sub
Private Sub ButtonCancel_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonCancel.Click
ButtonStartWebCam_Click(Nothing, Nothing)
End Sub
Private Sub ButtonPost_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonPost.Click
Dim comments As String = Me.TextBoxComments.Text
If String.IsNullOrEmpty(comments) Then
MessageBox.Show("Please provide a Comment")
Me.TextBoxComments.Focus()
Else
Me.IsEnabled = False
System.Threading.ThreadPool.QueueUserWorkItem(Function()
App.MainPage.UploadAttachment(_CapturedImage.ToJpgStream, String.Format("CapturedImage-{0}.jpg", Now.ToString("yyyyMMdd-HHmmss")), "image/jpeg", comments)
Me.Dispatcher.BeginInvoke(Function()
ButtonStartWebCam_Click(Nothing, Nothing)
Return Nothing
End Function)
Return Nothing
End Function)
End If
End Sub
Private Sub TextBoxComments_KeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs) Handles TextBoxComments.KeyDown
If e.Key = Key.Enter Then
ButtonPost_Click(Nothing, Nothing)
Return
End If
If e.Key = Key.Escape Then
ButtonCancel_Click(Nothing, Nothing)
Return
End If
End Sub
End Class
Imports System.Windows.Media.Effects
Partial Public Class WebCam
Inherits Page
Public Sub New()
InitializeComponent()
End Sub
Private _CaptureSource As CaptureSource
Private _VideoBrush As VideoBrush
Private _CapturedImage As Imaging.WriteableBitmap
'Executes when the user navigates to this page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs)
If _CaptureSource Is Nothing Then
'' Init WebCam
_CaptureSource = New CaptureSource
_CaptureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()
'' Get Best Quality Image
_CaptureSource.VideoCaptureDevice.DesiredFormat = (From f In _CaptureSource.VideoCaptureDevice.SupportedFormats Where f.PixelHeight <= 720
Order By (f.FramesPerSecond * f.PixelHeight * f.PixelWidth) Descending).FirstOrDefault()
AddHandler _CaptureSource.CaptureImageCompleted, AddressOf CaptureSource_CaptureImageCompleted
_VideoBrush = New VideoBrush()
_VideoBrush.Stretch = Stretch.Uniform
_VideoBrush.SetSource(_CaptureSource)
WebCamHost.Fill = _VideoBrush
End If
If (CaptureDeviceConfiguration.AllowedDeviceAccess) Then
ButtonStartWebCam_Click(Nothing, Nothing)
Else
WebCamAccessHost.Visibility = Windows.Visibility.Visible
WebCamCaptured.Visibility = Windows.Visibility.Collapsed
WebCamShow.Visibility = Windows.Visibility.Collapsed
End If
End Sub
Protected Overrides Sub OnNavigatedFrom(e As System.Windows.Navigation.NavigationEventArgs)
If _CaptureSource IsNot Nothing Then
If _CaptureSource.State = CaptureState.Started Then
_CaptureSource.Stop()
End If
End If
MyBase.OnNavigatedFrom(e)
End Sub
Private Sub ButtonStartWebCam_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonStartWebCam.Click
If (CaptureDeviceConfiguration.AllowedDeviceAccess OrElse CaptureDeviceConfiguration.RequestDeviceAccess()) Then
_CapturedImage = Nothing
Me.WebCamShow.Effect = Nothing
WebCamAccessHost.Visibility = Windows.Visibility.Collapsed
WebCamShow.Visibility = Windows.Visibility.Visible
WebCamCaptured.Visibility = Windows.Visibility.Collapsed
_CaptureSource.Start()
Me.ButtonCapture.Focus()
Else
WebCamAccessHost.Visibility = Windows.Visibility.Visible
WebCamCaptured.Visibility = Windows.Visibility.Collapsed
WebCamShow.Visibility = Windows.Visibility.Collapsed
End If
Me.IsEnabled = True
End Sub
Private Sub ButtonCapture_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonCapture.Click
_CaptureSource.CaptureImageAsync()
End Sub
Private Sub CaptureSource_CaptureImageCompleted(sender As Object, e As CaptureImageCompletedEventArgs)
Me.Dispatcher.BeginInvoke(Function()
ImageCaptured(e.Result)
Return Nothing
End Function)
End Sub
Private Sub ImageCaptured(image As Imaging.WriteableBitmap)
_CapturedImage = image
_CaptureSource.Stop()
Dim effect As New BlurEffect() With {.Radius = 15}
Me.WebCamShow.Effect = effect
Dim capturedImageBrush = New ImageBrush() With {.ImageSource = _CapturedImage, .Stretch = Stretch.Uniform}
Me.WebCamCapturedImage.Fill = capturedImageBrush
Me.TextBoxComments.Text = String.Empty
Me.WebCamCaptured.Visibility = Windows.Visibility.Visible
Me.TextBoxComments.Focus()
End Sub
Private Sub ButtonCancel_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonCancel.Click
ButtonStartWebCam_Click(Nothing, Nothing)
End Sub
Private Sub ButtonPost_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles ButtonPost.Click
Dim comments As String = Me.TextBoxComments.Text
If String.IsNullOrEmpty(comments) Then
MessageBox.Show("Please provide a Comment")
Me.TextBoxComments.Focus()
Else
Me.IsEnabled = False
System.Threading.ThreadPool.QueueUserWorkItem(Function()
App.MainPage.UploadAttachment(_CapturedImage.ToJpgStream, String.Format("CapturedImage-{0}.jpg", Now.ToString("yyyyMMdd-HHmmss")), "image/jpeg", comments)
Me.Dispatcher.BeginInvoke(Function()
ButtonStartWebCam_Click(Nothing, Nothing)
Return Nothing
End Function)
Return Nothing
End Function)
End If
End Sub
Private Sub TextBoxComments_KeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs) Handles TextBoxComments.KeyDown
If e.Key = Key.Enter Then
ButtonPost_Click(Nothing, Nothing)
Return
End If
If e.Key = Key.Escape Then
ButtonCancel_Click(Nothing, Nothing)
Return
End If
End Sub
End Class
@@ -1,40 +1,40 @@
Imports FluxJpeg.Core
Imports System.Windows.Media.Imaging
Imports System.Runtime.CompilerServices
Imports FluxJpeg.Core.Encoder
Module WriteableBitmapExtensions
<Extension()>
Public Function ToJpgStream(ByVal bitmap As WriteableBitmap) As IO.Stream
Dim width As Integer = bitmap.PixelWidth
Dim height As Integer = bitmap.PixelHeight
Dim bands As Integer = 3
Dim raster(bands - 1)(,) As Byte
Dim i As Integer
For i = 0 To bands - 1
raster(i) = New Byte(width - 1, height - 1) {}
Next i
Dim row As Integer
For row = 0 To height - 1
Dim column As Integer
For column = 0 To width - 1
Dim pixel As Integer = bitmap.Pixels(((width * row) + column))
raster(0)(column, row) = BitConverter.GetBytes(pixel >> 16)(0)
raster(1)(column, row) = BitConverter.GetBytes(pixel >> 8)(0)
raster(2)(column, row) = BitConverter.GetBytes(pixel)(0)
Next column
Next row
Dim model As New ColorModel With {.colorspace = ColorSpace.RGB}
Dim img As New Image(model, raster)
Dim stream As New IO.MemoryStream
Dim encoder = New JpegEncoder(img, 85, stream)
encoder.Encode()
stream.Seek(0, IO.SeekOrigin.Begin)
Return stream
End Function
End Module
Imports FluxJpeg.Core
Imports System.Windows.Media.Imaging
Imports System.Runtime.CompilerServices
Imports FluxJpeg.Core.Encoder
Module WriteableBitmapExtensions
<Extension()>
Public Function ToJpgStream(ByVal bitmap As WriteableBitmap) As IO.Stream
Dim width As Integer = bitmap.PixelWidth
Dim height As Integer = bitmap.PixelHeight
Dim bands As Integer = 3
Dim raster(bands - 1)(,) As Byte
Dim i As Integer
For i = 0 To bands - 1
raster(i) = New Byte(width - 1, height - 1) {}
Next i
Dim row As Integer
For row = 0 To height - 1
Dim column As Integer
For column = 0 To width - 1
Dim pixel As Integer = bitmap.Pixels(((width * row) + column))
raster(0)(column, row) = BitConverter.GetBytes(pixel >> 16)(0)
raster(1)(column, row) = BitConverter.GetBytes(pixel >> 8)(0)
raster(2)(column, row) = BitConverter.GetBytes(pixel)(0)
Next column
Next row
Dim model As New ColorModel With {.colorspace = ColorSpace.RGB}
Dim img As New Image(model, raster)
Dim stream As New IO.MemoryStream
Dim encoder = New JpegEncoder(img, 85, stream)
encoder.Encode()
stream.Seek(0, IO.SeekOrigin.Begin)
Return stream
End Function
End Module