Fix: Silverlight AttachmentUpload
Workaround for WebCam opacity bug
This commit is contained in:
+1
-1
@@ -109,7 +109,7 @@ AppPackages/
|
|||||||
# Others
|
# Others
|
||||||
sql/
|
sql/
|
||||||
*.Cache
|
*.Cache
|
||||||
ClientBin/
|
# ClientBin/
|
||||||
[Ss]tyle[Cc]op.*
|
[Ss]tyle[Cc]op.*
|
||||||
~$*
|
~$*
|
||||||
*~
|
*~
|
||||||
|
|||||||
@@ -87,8 +87,8 @@
|
|||||||
|
|
||||||
<!-- Content Frame Style -->
|
<!-- Content Frame Style -->
|
||||||
<Style x:Key="ContentFrameStyle" TargetType="navigation:Frame">
|
<Style x:Key="ContentFrameStyle" TargetType="navigation:Frame">
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="#FFFFFFFF"/>
|
||||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
|
||||||
<Setter Property="Padding" Value="58,15,58,15"/>
|
<Setter Property="Padding" Value="58,15,58,15"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 2012
|
||||||
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Disco.Silverlight.AttachmentUpload", "Disco.Silverlight.AttachmentUpload.vbproj", "{85747DDC-1389-4A40-9AFC-F57E0992294E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{85747DDC-1389-4A40-9AFC-F57E0992294E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{85747DDC-1389-4A40-9AFC-F57E0992294E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{85747DDC-1389-4A40-9AFC-F57E0992294E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{85747DDC-1389-4A40-9AFC-F57E0992294E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -108,9 +108,6 @@
|
|||||||
<Import Include="System.Windows.Shapes" />
|
<Import Include="System.Windows.Shapes" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\Disco.BI.VB\BI\Utilities.vb">
|
|
||||||
<Link>Utilities.vb</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="App.xaml.vb">
|
<Compile Include="App.xaml.vb">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -120,6 +117,7 @@
|
|||||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
|
<Compile Include="Utilities.vb" />
|
||||||
<Compile Include="Views\FileWindow.xaml.vb">
|
<Compile Include="Views\FileWindow.xaml.vb">
|
||||||
<DependentUpon>FileWindow.xaml</DependentUpon>
|
<DependentUpon>FileWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
Imports System.Runtime.CompilerServices
|
||||||
|
#If Not SILVERLIGHT = 1 Then
|
||||||
|
Imports System.Web.Mvc
|
||||||
|
#End If
|
||||||
|
|
||||||
|
Namespace BI
|
||||||
|
<Extension()>
|
||||||
|
Public Module Utilities
|
||||||
|
|
||||||
|
<Extension()>
|
||||||
|
Public Function StreamToString(stream As IO.Stream) As String
|
||||||
|
If (stream.Position <> 0) Then
|
||||||
|
stream.Position = 0
|
||||||
|
End If
|
||||||
|
Using sr As IO.StreamReader = New IO.StreamReader(stream)
|
||||||
|
Return sr.ReadToEnd
|
||||||
|
End Using
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<Extension()>
|
||||||
|
Public Function ToFuzzy(d As DateTime) As String
|
||||||
|
|
||||||
|
Dim n = DateTime.Now
|
||||||
|
'' Today
|
||||||
|
If d.Date = n.Date Then
|
||||||
|
'' Earlier
|
||||||
|
If d < n Then
|
||||||
|
'' Earlier
|
||||||
|
If d > n.AddMinutes(-1) Then
|
||||||
|
Return String.Format("A moment ago")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If d > n.AddMinutes(-10) Then
|
||||||
|
Return String.Format("A few minutes ago")
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
'' Later
|
||||||
|
If d < n.AddMinutes(1) Then
|
||||||
|
Return String.Format("In a moment")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If d < n.AddMinutes(10) Then
|
||||||
|
Return String.Format("In a few minutes")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return String.Format("Today at {0:h:mm tt}", d)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'' Past
|
||||||
|
If d.Date < n.Date Then
|
||||||
|
'' Yesterday
|
||||||
|
If d.Date = n.Date.AddDays(-1) Then
|
||||||
|
Return String.Format("Yesterday at {0:h:mm tt}", d)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'' Last Week
|
||||||
|
Dim weekStart = n.Date.AddDays(-7)
|
||||||
|
If d > weekStart Then
|
||||||
|
Return String.Format("Last {0:dddd} at {0:h:mm tt}", d)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'' This Year
|
||||||
|
Dim yearStart = New Date(n.Year, 1, 1)
|
||||||
|
If d > yearStart Then
|
||||||
|
'' Weeks
|
||||||
|
Dim weekNumber As Integer = ((n.DayOfYear - d.DayOfYear) / 7)
|
||||||
|
Return String.Format("{0} Weeks ago, {1:ddd, d MMM}", weekNumber, d)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'' Future
|
||||||
|
If d.Date > n.Date Then
|
||||||
|
'' Tomorrow
|
||||||
|
If d.Date = n.Date.AddDays(1) Then
|
||||||
|
Return String.Format("Tomorrow at {0:h:mm tt}", d)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'' Next Week
|
||||||
|
Dim weekEnd = n.Date.AddDays(7)
|
||||||
|
If d < weekEnd Then
|
||||||
|
Return String.Format("Next {0:dddd} at {0:h:mm tt}", d)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'' This Year
|
||||||
|
Dim nextYearStart = New Date(n.Year + 1, 1, 1)
|
||||||
|
If d < nextYearStart Then
|
||||||
|
'' Weeks
|
||||||
|
Dim weekNumber As Integer = ((d.DayOfYear - n.DayOfYear) / 7)
|
||||||
|
Return String.Format("In {0} Weeks, {1:ddd, d MMM}", weekNumber, d)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return d.ToString("ddd, d MMM yyyy")
|
||||||
|
|
||||||
|
End Function
|
||||||
|
<Extension()>
|
||||||
|
Public Function ToFuzzy(d As DateTime?, Optional NullValue As String = "N/A") As String
|
||||||
|
If d.HasValue Then
|
||||||
|
Return ToFuzzy(d.Value)
|
||||||
|
Else
|
||||||
|
Return NullValue
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<Extension()>
|
||||||
|
Public Function ToFullDateTime(d As DateTime) As String
|
||||||
|
Return d.ToString("ddd, d MMM yyyy @ h:mm:sstt")
|
||||||
|
End Function
|
||||||
|
<Extension()>
|
||||||
|
Public Function ToFullDateTime(d As DateTime?, Optional NullValue As String = "N/A") As String
|
||||||
|
If d.HasValue Then
|
||||||
|
Return ToFullDateTime(d.Value)
|
||||||
|
Else
|
||||||
|
Return NullValue
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<Extension()>
|
||||||
|
Public Function ToJavascriptDate(d As DateTime?, Optional DefaultDate As DateTime? = Nothing) As String
|
||||||
|
If d.HasValue Then
|
||||||
|
Return ToJavascriptDate(d.Value)
|
||||||
|
Else
|
||||||
|
If DefaultDate.HasValue Then
|
||||||
|
Return ToJavascriptDate(DefaultDate.Value)
|
||||||
|
Else
|
||||||
|
Return "null"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
<Extension()>
|
||||||
|
Public Function ToJavascriptDate(d As DateTime) As String
|
||||||
|
Return String.Format("new Date({0}, {1}, {2}, {3}, {4}, {5})", d.Year, d.Month - 1, d.Day, d.Hour, d.Minute, d.Second)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
#If Not SILVERLIGHT = 1 Then
|
||||||
|
<Extension()>
|
||||||
|
Public Function ToSelectListItems(Items As List(Of String), Optional SelectedItem As String = Nothing) As List(Of SelectListItem)
|
||||||
|
If SelectedItem Is Nothing Then
|
||||||
|
Return Items.Select(Function(item) New SelectListItem() With {.Value = item,
|
||||||
|
.Text = item}).ToList()
|
||||||
|
Else
|
||||||
|
Return Items.Select(Function(item) New SelectListItem() With {.Value = item,
|
||||||
|
.Text = item,
|
||||||
|
.Selected = (item = SelectedItem)}).ToList()
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
#End If
|
||||||
|
|
||||||
|
End Module
|
||||||
|
End Namespace
|
||||||
@@ -11,8 +11,17 @@
|
|||||||
<Button x:Name="ButtonStartWebCam" Content="START WEBCAM" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="14, 8" />
|
<Button x:Name="ButtonStartWebCam" Content="START WEBCAM" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="14, 8" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid x:Name="WebCamShow" Visibility="Collapsed">
|
<Grid x:Name="WebCamShow" Visibility="Collapsed">
|
||||||
<Rectangle x:Name="WebCamHost" />
|
<Grid.RowDefinitions>
|
||||||
<Button x:Name="ButtonCapture" Content="CAPTURE IMAGE" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Background="Black">
|
||||||
|
<Rectangle x:Name="WebCamHost" OpacityMask="White" />
|
||||||
|
</Border>
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Row="1" Margin="0, 10, 0, 0">
|
||||||
|
<Button x:Name="ButtonCapture" Content="CAPTURE IMAGE (Michael)" HorizontalAlignment="Center" Padding="14, 8" />
|
||||||
|
<TextBlock x:Name="TextBlockWebCamFormat" HorizontalAlignment="Center" Margin="0, 6, 0, 0"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Border x:Name="WebCamCaptured" Visibility="Collapsed" Width="600" Height="450" Background="#BBffe3cb" BorderBrush="#FFDB761D" BorderThickness="4" CornerRadius="4">
|
<Border x:Name="WebCamCaptured" Visibility="Collapsed" Width="600" Height="450" Background="#BBffe3cb" BorderBrush="#FFDB761D" BorderThickness="4" CornerRadius="4">
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -26,7 +35,9 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Rectangle x:Name="WebCamCapturedImage" Grid.ColumnSpan="4" Margin="14" />
|
<Border Background="Black" Grid.ColumnSpan="4" Margin="14">
|
||||||
|
<Rectangle x:Name="WebCamCapturedImage" />
|
||||||
|
</Border>
|
||||||
<Button x:Name="ButtonCancel" Grid.Row="1" Grid.Column="0" Content="CANCEL" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="14, 8" Margin="6" />
|
<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>
|
<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" />
|
<TextBox Grid.Row="1" Grid.Column="2" x:Name="TextBoxComments" Height="24" />
|
||||||
|
|||||||
@@ -21,14 +21,20 @@ Partial Public Class WebCam
|
|||||||
_CaptureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()
|
_CaptureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()
|
||||||
|
|
||||||
'' Get Best Quality Image
|
'' Get Best Quality Image
|
||||||
_CaptureSource.VideoCaptureDevice.DesiredFormat = (From f In _CaptureSource.VideoCaptureDevice.SupportedFormats Where f.PixelHeight <= 720
|
Dim format = (From f In _CaptureSource.VideoCaptureDevice.SupportedFormats Where f.PixelHeight <= 720 And f.Stride = 0
|
||||||
Order By (f.FramesPerSecond * f.PixelHeight * f.PixelWidth) Descending).FirstOrDefault()
|
Order By (f.PixelHeight * f.PixelWidth) Descending Order By f.FramesPerSecond).FirstOrDefault()
|
||||||
|
|
||||||
|
TextBlockWebCamFormat.Text = String.Format("{0}x{1} at {2}fps", format.PixelWidth, format.PixelHeight, format.FramesPerSecond)
|
||||||
|
|
||||||
|
_CaptureSource.VideoCaptureDevice.DesiredFormat = format
|
||||||
|
|
||||||
AddHandler _CaptureSource.CaptureImageCompleted, AddressOf CaptureSource_CaptureImageCompleted
|
AddHandler _CaptureSource.CaptureImageCompleted, AddressOf CaptureSource_CaptureImageCompleted
|
||||||
_VideoBrush = New VideoBrush()
|
_VideoBrush = New VideoBrush()
|
||||||
_VideoBrush.Stretch = Stretch.Uniform
|
_VideoBrush.Stretch = Stretch.Uniform
|
||||||
_VideoBrush.SetSource(_CaptureSource)
|
_VideoBrush.SetSource(_CaptureSource)
|
||||||
WebCamHost.Fill = _VideoBrush
|
WebCamHost.Fill = _VideoBrush
|
||||||
|
|
||||||
|
ButtonCapture.Focus()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If (CaptureDeviceConfiguration.AllowedDeviceAccess) Then
|
If (CaptureDeviceConfiguration.AllowedDeviceAccess) Then
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Include all Resources
|
||||||
|
!*
|
||||||
|
Disco.ClientBootstrapper.exe
|
||||||
|
PreparationClient.zip
|
||||||
Binary file not shown.
Reference in New Issue
Block a user