aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-15 14:39:24 -0400
committerMichael <[email protected]>2017-04-15 14:39:24 -0400
commit51050a02d4d5eff361cfa697eeba777ddafa085a (patch)
tree46fd8d57f8aa8a1c8a2eb264b7dd506f876c1c72 /ShiftOS.WinForms
parent761202b4908d28f6aba852a3a59eb1dca50957d1 (diff)
downloadshiftos_thereturn-51050a02d4d5eff361cfa697eeba777ddafa085a.tar.gz
shiftos_thereturn-51050a02d4d5eff361cfa697eeba777ddafa085a.tar.bz2
shiftos_thereturn-51050a02d4d5eff361cfa697eeba777ddafa085a.zip
Use NAudio to handle system sounds
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Applications/Dialog.cs14
-rw-r--r--ShiftOS.WinForms/Applications/Shifter.Designer.cs10
2 files changed, 18 insertions, 6 deletions
diff --git a/ShiftOS.WinForms/Applications/Dialog.cs b/ShiftOS.WinForms/Applications/Dialog.cs
index 10737a1..171bdc4 100644
--- a/ShiftOS.WinForms/Applications/Dialog.cs
+++ b/ShiftOS.WinForms/Applications/Dialog.cs
@@ -27,6 +27,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.Linq;
using System.Media;
using System.Text;
@@ -44,15 +45,22 @@ namespace ShiftOS.WinForms.Applications
public Dialog()
{
InitializeComponent();
- }
+ }
public string Title { get; private set; }
public void OnLoad()
{
AppearanceManager.SetWindowTitle(this, this.Title);
- //NOT EVEn THIS WORKS
- new Computer().Audio.Play(Properties.Resources.infobox, Microsoft.VisualBasic.AudioPlayMode.Background);
+ var str = Properties.Resources.infobox;
+ var bytes = new byte[str.Length];
+ str.Read(bytes, 0, bytes.Length);
+ ShiftOS.Engine.AudioManager.Stop();
+ if (File.Exists("snd.wav"))
+ File.Delete("snd.wav");
+ File.WriteAllBytes("snd.wav", bytes);
+
+ ShiftOS.Engine.AudioManager.Play("snd.wav");
}
public void OnSkinLoad()
diff --git a/ShiftOS.WinForms/Applications/Shifter.Designer.cs b/ShiftOS.WinForms/Applications/Shifter.Designer.cs
index 593f43d..7ef20bf 100644
--- a/ShiftOS.WinForms/Applications/Shifter.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Shifter.Designer.cs
@@ -37,11 +37,15 @@ namespace ShiftOS.WinForms.Applications
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
- if (disposing && (components != null))
+ try
{
- components.Dispose();
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
}
- base.Dispose(disposing);
+ catch { }
}
#region Windows Form Designer generated code