Permalink
Browse files

added audio to .net gui

  • Loading branch information...
1 parent 36564cf commit 2e6b17bcc4ddbe1cc1ab23935ed7394c8bd663d6 @dummy3k committed May 24, 2010
@@ -116,6 +116,12 @@
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
+ <ItemGroup>
+ <None Include="Resources\failure.wav" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Resources\success.wav" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.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.
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
-<Assembly: AssemblyVersion("1.0.0.0")>
-<Assembly: AssemblyFileVersion("1.0.0.0")>
+<Assembly: AssemblyVersion("1.0.*")>
+'<Assembly: AssemblyFileVersion("1.0.0.0")>
@@ -1,26 +1,27 @@
'------------------------------------------------------------------------------
' <auto-generated>
-' This code was generated by a tool.
-' Runtime Version:2.0.50727.4200
+' Dieser Code wurde von einem Tool generiert.
+' Laufzeitversion:2.0.50727.4200
'
-' Changes to this file may cause incorrect behavior and will be lost if
-' the code is regenerated.
+' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
+Imports System
Namespace My.Resources
- 'This class was auto-generated by the StronglyTypedResourceBuilder
- 'class via a tool like ResGen or Visual Studio.
- 'To add or remove a member, edit your .ResX file then rerun ResGen
- 'with the /str option, or rebuild your VS project.
- '<summary>
- ' A strongly-typed resource class, for looking up localized strings, etc.
- '</summary>
+ 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
+ '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
+ 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
+ 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
+ '''<summary>
+ ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ '''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
@@ -31,9 +32,9 @@ Namespace My.Resources
Private resourceCulture As Global.System.Globalization.CultureInfo
- '<summary>
- ' Returns the cached ResourceManager instance used by this class.
- '</summary>
+ '''<summary>
+ ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ '''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
@@ -45,18 +46,30 @@ Namespace My.Resources
End Get
End Property
- '<summary>
- ' Overrides the current thread's CurrentUICulture property for all
- ' resource lookups using this strongly typed resource class.
- '</summary>
+ '''<summary>
+ ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
+ ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
+ '''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
- Set(ByVal value As Global.System.Globalization.CultureInfo)
+ Set
resourceCulture = value
End Set
End Property
+
+ Friend ReadOnly Property failure() As System.IO.UnmanagedMemoryStream
+ Get
+ Return ResourceManager.GetStream("failure", resourceCulture)
+ End Get
+ End Property
+
+ Friend ReadOnly Property success() As System.IO.UnmanagedMemoryStream
+ Get
+ Return ResourceManager.GetStream("success", resourceCulture)
+ End Get
+ End Property
End Module
End Namespace
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@@ -114,4 +117,11 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="failure" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\failure.wav;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name="success" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\success.wav;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
</root>
Binary file not shown.
Binary file not shown.
@@ -79,7 +79,6 @@ Partial Class frmMain
Label2.Size = New System.Drawing.Size(30, 13)
Label2.TabIndex = 3
Label2.Text = "Title:"
- AddHandler Label2.Click, AddressOf Me.Label2_Click
'
'txtBarcode
'
@@ -1,8 +1,11 @@
Imports Microsoft.Win32
Imports CookComputing.XmlRpc
+Imports System.Media
Public Class frmMain
Private mRegistry As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\" & Application.ProductName)
+ Private mPlaySuccess As New SoundPlayer(My.Resources.success)
+ Private mPlayFailure As New SoundPlayer(My.Resources.failure)
Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
mRegistry.SetValue("txtUrl", txtUrl.Text)
@@ -15,23 +18,37 @@ Public Class frmMain
End Sub
Private Sub cmdFetch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFetch.Click
+ Fetch()
+ End Sub
+
+ Private Function Fetch() As Boolean
+ If txtBarcode.Text.Trim() = "" Then Return False
+
Dim proxy = XmlRpcProxyGen.Create(Of IMvApi)()
proxy.Url = txtUrl.Text
Dim result = proxy.AddMediumByISBN(txtBarcode.Text, "Books")
If Not result("success") Then
+ mPlayFailure.PlaySync()
MsgBox("Failure: " & result("success"))
- Return
+ Return False
End If
txtTitle.Text = result("title")
- 'Stop
- End Sub
-
- Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
-
+ 'Beep()
+ mPlaySuccess.Play()
+ Return True
+ End Function
+
+ Private Sub txtBarcode_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtBarcode.KeyDown
+ If e.KeyCode <> Keys.Return Then Return
+ e.SuppressKeyPress = True
End Sub
- Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTitle.TextChanged
-
+ Private Sub txtBarcode_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtBarcode.KeyUp
+ If e.KeyCode <> Keys.Return Then Return
+ e.SuppressKeyPress = True
+ If Fetch() Then
+ txtBarcode.Text = ""
+ End If
End Sub
End Class

0 comments on commit 2e6b17b

Please sign in to comment.