Marked as SoundBoard v0.9.8.0(stable) according to the folder.
This commit is contained in:
@@ -3,11 +3,83 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace SoundBoard
|
||||
{
|
||||
class GenerateRandomPlayList
|
||||
{
|
||||
private Random randomNumber = new Random(); //Random number generator
|
||||
private string __workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
|
||||
public string[] SingleViewPlayList(List<List<String>> listViewContents, int iterations, int index)
|
||||
{
|
||||
string[] playList = new String[iterations];
|
||||
string tempFileName;
|
||||
int i = 0;
|
||||
int itemCount = listViewContents[index].Count - 1; //Count is not zero index based
|
||||
|
||||
do
|
||||
{
|
||||
tempFileName = listViewContents[index][randomNumber.Next(0, itemCount)];
|
||||
if (playList.Contains(tempFileName))
|
||||
{
|
||||
playList[i] = listViewContents[index][randomNumber.Next(0, itemCount)];
|
||||
}
|
||||
else
|
||||
{
|
||||
playList[i] = tempFileName;
|
||||
}
|
||||
i++;
|
||||
} while (i < iterations);
|
||||
return playList;
|
||||
}
|
||||
|
||||
public string[] MulitViewPlayList(List<List<String>> listViewContents, int iterations)
|
||||
{
|
||||
string[] playList = new String[iterations];
|
||||
int zeroIndexCount = listViewContents[0].Count;
|
||||
int tabCount = listViewContents.Count;
|
||||
int itemCount;
|
||||
int i = 0;
|
||||
int temp;
|
||||
string tempFilePath;
|
||||
|
||||
do
|
||||
{
|
||||
if (zeroIndexCount > 5)
|
||||
{
|
||||
temp = randomNumber.Next(0, tabCount - 1);
|
||||
itemCount = listViewContents[temp].Count - 1; //Count is zero index based
|
||||
tempFilePath = listViewContents[temp][randomNumber.Next(0, itemCount)];
|
||||
if (playList.Contains(tempFilePath))
|
||||
{
|
||||
playList[i] = listViewContents[temp][randomNumber.Next(0, itemCount)];
|
||||
}
|
||||
else
|
||||
{
|
||||
playList[i] = tempFilePath;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = randomNumber.Next(1, tabCount - 1);
|
||||
itemCount = listViewContents[temp].Count - 1; //Count is zero index based
|
||||
tempFilePath = listViewContents[temp][randomNumber.Next(0, itemCount)];
|
||||
if (playList.Contains(tempFilePath))
|
||||
{
|
||||
playList[i] = listViewContents[temp][randomNumber.Next(0, itemCount)];
|
||||
}
|
||||
else
|
||||
{
|
||||
playList[i] = tempFilePath;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
} while(i < iterations);
|
||||
|
||||
return playList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Controls;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SoundBoard
|
||||
{
|
||||
class MediaPlayer
|
||||
{
|
||||
private MediaElement gPlayer = new MediaElement();
|
||||
private bool gWillLoopMedia = false;
|
||||
private bool gLoopBoxState = false; //is the loopbox on mainForm check
|
||||
private string[] gPlayList;
|
||||
public string gErrorMessage;
|
||||
|
||||
//Public constructor, used mainy to create the event handlers for the MediaElement.
|
||||
public MediaPlayer()
|
||||
{
|
||||
gPlayer.MediaEnded += gPlayer_MediaEnded;
|
||||
gPlayer.MediaFailed += gPlayer_MediaFailed;
|
||||
}
|
||||
|
||||
void gPlayer_MediaFailed(object sender, System.Windows.ExceptionRoutedEventArgs e)
|
||||
{
|
||||
gErrorMessage = "The selected file ~1 could not be played"; //"~1" could be replaced with the file that caused the error to occur
|
||||
}
|
||||
|
||||
public bool WillLoop
|
||||
{
|
||||
set { gWillLoopMedia = value; }
|
||||
}
|
||||
|
||||
public bool IsLoopBoxCheck
|
||||
{
|
||||
set { gLoopBoxState = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method captures the MediaEnded event for the MediaElement and, if the playList array contains something,
|
||||
/// it will remove the first object in the array, and pass the next object in as the param to the PlaySoundFile method.
|
||||
/// The orginal array is replaced with this modified array.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void gPlayer_MediaEnded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
//select next item in playlist
|
||||
if (gPlayList != null)
|
||||
{
|
||||
//Easiest way to remove the object at index zero
|
||||
List<string> tempList = new List<string>();
|
||||
tempList = gPlayList.ToList<string>();
|
||||
tempList.RemoveAt(0);
|
||||
gPlayList = tempList.ToArray<string>();
|
||||
if (gPlayList.Length > 0)
|
||||
{
|
||||
PlaySoundFile(gPlayList[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
//check to see if the loopbox on mainForm is checked
|
||||
if (gLoopBoxState)
|
||||
{
|
||||
gWillLoopMedia = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gWillLoopMedia = false;
|
||||
}
|
||||
gPlayList = null; //null out the playList string array, so the playList isn't repeated by mistake
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//If the playList variable is empty then it's safe to assume the randomize function is not active.
|
||||
if (gWillLoopMedia)
|
||||
{
|
||||
gPlayer.Position = TimeSpan.Zero;
|
||||
gPlayer.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayAudioPlaylist(string[] playList)
|
||||
{
|
||||
gPlayList = null;
|
||||
gWillLoopMedia = false;
|
||||
gPlayList = playList;
|
||||
PlaySoundFile(playList[0]);
|
||||
}
|
||||
|
||||
public void PlaySoundFile(string file)
|
||||
{
|
||||
gPlayer.Source = new Uri(file);
|
||||
gPlayer.LoadedBehavior = MediaState.Manual;
|
||||
gPlayer.UnloadedBehavior = MediaState.Manual;
|
||||
gPlayer.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -78,8 +78,11 @@
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -88,6 +91,7 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="aboutForm.cs">
|
||||
@@ -96,6 +100,13 @@
|
||||
<Compile Include="aboutForm.Designer.cs">
|
||||
<DependentUpon>aboutForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MediaPlayer.cs" />
|
||||
<Compile Include="programDebugConsole.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="programDebugConsole.Designer.cs">
|
||||
<DependentUpon>programDebugConsole.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GenerateRandomPlayList.cs" />
|
||||
<Compile Include="mainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -108,6 +119,9 @@
|
||||
<EmbeddedResource Include="aboutForm.resx">
|
||||
<DependentUpon>aboutForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="programDebugConsole.resx">
|
||||
<DependentUpon>programDebugConsole.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="mainForm.resx">
|
||||
<DependentUpon>mainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -131,7 +145,7 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="favico.ico" />
|
||||
@@ -153,17 +167,6 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="WMPLib">
|
||||
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
|
||||
|
||||
Generated
+24
-14
@@ -38,11 +38,12 @@
|
||||
this.mainMenuPlayAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mainMenuHelp = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mainMenuHelpAbout = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mainMenuHelpShowConsole = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.randomIterationNumericUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.soundboardTabControl = new System.Windows.Forms.TabControl();
|
||||
this.loopSelectedSoundCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.fileSystemWatcherMain = new System.IO.FileSystemWatcher();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.mainMenu.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.randomIterationNumericUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcherMain)).BeginInit();
|
||||
@@ -112,7 +113,9 @@
|
||||
// mainMenuHelp
|
||||
//
|
||||
this.mainMenuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mainMenuHelpAbout});
|
||||
this.mainMenuHelpAbout,
|
||||
this.toolStripSeparator1,
|
||||
this.mainMenuHelpShowConsole});
|
||||
this.mainMenuHelp.Name = "mainMenuHelp";
|
||||
this.mainMenuHelp.Size = new System.Drawing.Size(44, 20);
|
||||
this.mainMenuHelp.Text = "&Help";
|
||||
@@ -120,10 +123,23 @@
|
||||
// mainMenuHelpAbout
|
||||
//
|
||||
this.mainMenuHelpAbout.Name = "mainMenuHelpAbout";
|
||||
this.mainMenuHelpAbout.Size = new System.Drawing.Size(107, 22);
|
||||
this.mainMenuHelpAbout.Size = new System.Drawing.Size(149, 22);
|
||||
this.mainMenuHelpAbout.Text = "A&bout";
|
||||
this.mainMenuHelpAbout.Click += new System.EventHandler(this.mainMenuHelpAbout_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(146, 6);
|
||||
//
|
||||
// mainMenuHelpShowConsole
|
||||
//
|
||||
this.mainMenuHelpShowConsole.CheckOnClick = true;
|
||||
this.mainMenuHelpShowConsole.Name = "mainMenuHelpShowConsole";
|
||||
this.mainMenuHelpShowConsole.Size = new System.Drawing.Size(149, 22);
|
||||
this.mainMenuHelpShowConsole.Text = "S&how Console";
|
||||
this.mainMenuHelpShowConsole.Click += new System.EventHandler(this.mainMenuHelpShowConsole_Click);
|
||||
//
|
||||
// randomIterationNumericUpDown
|
||||
//
|
||||
this.randomIterationNumericUpDown.Location = new System.Drawing.Point(94, 548);
|
||||
@@ -169,21 +185,13 @@
|
||||
this.fileSystemWatcherMain.EnableRaisingEvents = true;
|
||||
this.fileSystemWatcherMain.SynchronizingObject = this;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(294, 548);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(35, 13);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.Text = "label1";
|
||||
//
|
||||
// formMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(425, 578);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.loopSelectedSoundCheckBox);
|
||||
this.Controls.Add(this.randomIterationNumericUpDown);
|
||||
this.Controls.Add(this.soundboardTabControl);
|
||||
@@ -192,6 +200,7 @@
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.KeyPreview = true;
|
||||
this.MainMenuStrip = this.mainMenu;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "formMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Interwebz\'s Soundboard";
|
||||
@@ -220,7 +229,8 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem mainMenuHelpAbout;
|
||||
private System.Windows.Forms.CheckBox loopSelectedSoundCheckBox;
|
||||
private System.IO.FileSystemWatcher fileSystemWatcherMain;
|
||||
public System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem mainMenuHelpShowConsole;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+151
-300
@@ -13,15 +13,16 @@ using System.Diagnostics;
|
||||
|
||||
namespace SoundBoard
|
||||
{
|
||||
public partial class formMain : Form, IMessageFilter
|
||||
public partial class formMain : Form
|
||||
{
|
||||
private const int WM_KEYDOWN = 0x100;
|
||||
public WMPLib.WindowsMediaPlayer Player = new WMPLib.WindowsMediaPlayer();
|
||||
public Random randomNum = new Random();
|
||||
public ListView listViewEntity = new ListView();
|
||||
public string _workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
public string[] _soundFiles;
|
||||
public string[] _soundDirectories;
|
||||
//private const int WM_KEYDOWN = 0x100;
|
||||
private programDebugConsole debugConsoleWindow = new programDebugConsole();
|
||||
private MediaPlayer gMultimediaPlayer = new MediaPlayer();
|
||||
private Random randomNum = new Random();
|
||||
private ListView listViewEntity = new ListView();
|
||||
private string _workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
private string[] _soundDirectories;
|
||||
private List<List<String>> listViewContents = new List<List<string>>();
|
||||
|
||||
public formMain()
|
||||
{
|
||||
@@ -30,26 +31,23 @@ namespace SoundBoard
|
||||
|
||||
private void formMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
_soundFiles = Directory.GetFiles(_workingDirectory);
|
||||
//Build the UI, foreach directory create one TabPage and one ListView object
|
||||
foreach (string sound in _soundFiles)
|
||||
try
|
||||
{
|
||||
CreateUITabs("Working Directory", _workingDirectory);
|
||||
|
||||
_soundDirectories = Directory.GetDirectories(_workingDirectory);
|
||||
foreach (string sounds in _soundDirectories)
|
||||
{
|
||||
CreateUITabs(Path.GetFileName(sounds), sounds);
|
||||
}
|
||||
}
|
||||
_soundDirectories = Directory.GetDirectories(_workingDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string sounds in _soundDirectories)
|
||||
catch (Exception ex)
|
||||
{
|
||||
CreateUITabs(Path.GetFileName(sounds), sounds);
|
||||
MessageBox.Show(ex.Message + "\nThis application will now terminate.", "Fatal Error");
|
||||
Close();
|
||||
}
|
||||
|
||||
Application.AddMessageFilter(this);
|
||||
fileSystemWatcherMain.Path = _workingDirectory; //watch in the application's working directory
|
||||
fileSystemWatcherMain.IncludeSubdirectories = true; //and watch in the subfolders for changes, but only one layer down from the app's directory
|
||||
fileSystemWatcherMain.Created += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder created
|
||||
fileSystemWatcherMain.Deleted += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder moved or deleted
|
||||
fileSystemWatcherMain.Renamed += new RenamedEventHandler(fileSystemUpdateDetected); //for any file changes like file extension changes
|
||||
soundboardTabControl.SelectedIndexChanged += new EventHandler(CheckForDisabledListBox); //disables or enables the Show on Disk file menu object
|
||||
Player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(WMP_PlayStateChange); //eventhandler for the playstate of the Player object
|
||||
//check to see if the listView is empty on form load
|
||||
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
|
||||
{
|
||||
@@ -61,41 +59,22 @@ namespace SoundBoard
|
||||
mainMenuFileShowOnDisk.Enabled = false;
|
||||
btnRandom.Enabled = false;
|
||||
}
|
||||
soundboardTabControl.Select();
|
||||
fileSystemWatcherMain.Path = _workingDirectory; //watch in the application's working directory
|
||||
fileSystemWatcherMain.IncludeSubdirectories = true; //and watch in the subfolders for changes, but only one layer down from the app's directory
|
||||
fileSystemWatcherMain.Created += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder created
|
||||
fileSystemWatcherMain.Deleted += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder moved or deleted
|
||||
fileSystemWatcherMain.Renamed += new RenamedEventHandler(fileSystemUpdateDetected); //for any file changes like file extension changes
|
||||
soundboardTabControl.SelectedIndexChanged += new EventHandler(CheckForDisabledListView); //disables or enables the Show on Disk file menu object
|
||||
debugConsoleWindow.FormClosing += debugConsoleWindow_FormClosing; //Capture the closing of the form and prevent it, instead hide it
|
||||
}
|
||||
|
||||
private void WMP_PlayStateChange(int newState)
|
||||
#region event-handlers
|
||||
void debugConsoleWindow_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
//check to see if the random play functions are running
|
||||
if (btnRandom.Enabled == false)
|
||||
{
|
||||
if (Player.playState == WMPLib.WMPPlayState.wmppsTransitioning)
|
||||
{
|
||||
//Player is transitioning, so keep the controls disabled
|
||||
btnRandom.Enabled = false;
|
||||
loopSelectedSoundCheckBox.Enabled = false;
|
||||
}
|
||||
else if (Player.playState == WMPLib.WMPPlayState.wmppsPlaying)
|
||||
{
|
||||
//player is still playing the random playlist, keep the controls disbaled
|
||||
btnRandom.Enabled = false;
|
||||
loopSelectedSoundCheckBox.Enabled = false;
|
||||
}
|
||||
else if (Player.playState == WMPLib.WMPPlayState.wmppsReady)
|
||||
{
|
||||
//renable the controls, the Random functions are done
|
||||
//first check to see if the loop checkBox is checked, if so set the player to "loop"
|
||||
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
|
||||
{
|
||||
btnRandom.Enabled = true;
|
||||
}
|
||||
if (loopSelectedSoundCheckBox.Checked == true)
|
||||
{
|
||||
Player.settings.setMode("loop", true);
|
||||
}
|
||||
loopSelectedSoundCheckBox.Enabled = true;
|
||||
}
|
||||
}
|
||||
e.Cancel = true;
|
||||
debugConsoleWindow.HideConsole();
|
||||
mainMenuHelpShowConsole.Enabled = true;
|
||||
mainMenuHelpShowConsole.Checked = false;
|
||||
}
|
||||
|
||||
private void fileSystemUpdateDetected(object sender, FileSystemEventArgs e)
|
||||
@@ -103,18 +82,9 @@ namespace SoundBoard
|
||||
//perform the UI refresh operation
|
||||
RefreshUIControls();
|
||||
}
|
||||
|
||||
private void CheckForDisabledListBox(object sender, EventArgs e)
|
||||
private void CheckForDisabledListView(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
listViewEntity = (ListView)soundboardTabControl.SelectedTab.Controls[0];
|
||||
}
|
||||
catch (Exception spam)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
listViewEntity = (ListView)soundboardTabControl.SelectedTab.Controls[0];
|
||||
if (listViewEntity.Enabled == false)
|
||||
{
|
||||
mainMenuFileShowOnDisk.Enabled = false;
|
||||
@@ -126,12 +96,14 @@ namespace SoundBoard
|
||||
btnRandom.Enabled = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void RefreshUIControls()
|
||||
{
|
||||
_workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
_soundDirectories = Directory.GetDirectories(_workingDirectory);
|
||||
|
||||
soundboardTabControl.SelectedIndexChanged -= new EventHandler(CheckForDisabledListView);
|
||||
|
||||
foreach (TabPage tabPage in soundboardTabControl.TabPages)
|
||||
{
|
||||
foreach (ListView listView in tabPage.Controls)
|
||||
@@ -141,10 +113,10 @@ namespace SoundBoard
|
||||
tabPage.Dispose();
|
||||
}
|
||||
|
||||
foreach (string sounds in _soundFiles)
|
||||
{
|
||||
CreateUITabs("Working Directory", _workingDirectory);
|
||||
}
|
||||
listViewContents.Clear();
|
||||
|
||||
CreateUITabs("Working Directory", _workingDirectory);
|
||||
|
||||
foreach (string files in _soundDirectories)
|
||||
{
|
||||
CreateUITabs(Path.GetFileName(files), files);
|
||||
@@ -160,6 +132,7 @@ namespace SoundBoard
|
||||
mainMenuFileShowOnDisk.Enabled = false;
|
||||
btnRandom.Enabled = false;
|
||||
}
|
||||
soundboardTabControl.SelectedIndexChanged += new EventHandler(CheckForDisabledListView);
|
||||
}
|
||||
|
||||
private void CreateUITabs(string tabName, string directoryPath)
|
||||
@@ -167,87 +140,89 @@ namespace SoundBoard
|
||||
//Add tabs dynamically
|
||||
int soundControlHeight = soundboardTabControl.Height;
|
||||
int soundControlWidth = soundboardTabControl.Width;
|
||||
string[] directoryFiles; //Files in the target directory
|
||||
int index = soundboardTabControl.TabCount;
|
||||
int fileCount = 0;
|
||||
TabPage tab = new TabPage();
|
||||
ListView localListView = new ListView();
|
||||
string[] columnNames = new string[2]; //Perhaps include a compatibility column to flag files that cause errors?
|
||||
string[] files;
|
||||
ListViewItem listItemObject;
|
||||
|
||||
if (soundboardTabControl.Controls.ContainsKey(tabName.Replace(" ", "") + "Tab"))
|
||||
{
|
||||
//Construct the TabPage and its properties
|
||||
tab.Text = tabName; //Display the folder's full name to the user
|
||||
tab.Name = tabName.Replace(" ", "") + "Tab"; //create a legal name for the tab's (name) property
|
||||
tab.Height = soundControlHeight;
|
||||
tab.Height = soundControlWidth;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Construct the TabPage and its properties
|
||||
tab.Text = tabName; //Display the folder's full name to the user
|
||||
tab.Name = tabName.Replace(" ", "") + "Tab"; //create a legal name for the tab's (name) property
|
||||
tab.Height = soundControlHeight;
|
||||
tab.Height = soundControlWidth;
|
||||
soundboardTabControl.Controls.Add(tab);
|
||||
//Construct the ListView and its properties
|
||||
localListView.Height = soundControlHeight - 25;
|
||||
localListView.Width = soundControlWidth - 5;
|
||||
localListView.Name = tabName.Replace(" ", "") + "ListView";
|
||||
localListView.FullRowSelect = true;
|
||||
localListView.MultiSelect = false;
|
||||
localListView.GridLines = true;
|
||||
localListView.View = View.Details;
|
||||
localListView.Activation = ItemActivation.OneClick;
|
||||
localListView.TabStop = false;
|
||||
localListView.Columns.Add("File Name", 340, HorizontalAlignment.Left);
|
||||
localListView.Columns.Add("File Ext", 50, HorizontalAlignment.Left);
|
||||
localListView.ItemActivate += new EventHandler((sender, e) => ListViewOnLeftClick(sender, e, localListView));
|
||||
|
||||
//Construct the ListView and its properties
|
||||
localListView.Height = soundControlHeight - 25;
|
||||
localListView.Width = soundControlWidth - 5;
|
||||
localListView.Name = tabName.Replace(" ", "") + "ListView";
|
||||
localListView.FullRowSelect = true;
|
||||
localListView.MultiSelect = false;
|
||||
localListView.GridLines = true;
|
||||
localListView.View = View.Details;
|
||||
localListView.Activation = ItemActivation.OneClick;
|
||||
localListView.TabStop = false;
|
||||
tab.Controls.Add(localListView);
|
||||
localListView.Columns.Add("File Name", 340, HorizontalAlignment.Left);
|
||||
localListView.Columns.Add("File Ext", 50, HorizontalAlignment.Left);
|
||||
localListView.ItemActivate += new EventHandler((sender, e) => ListViewOnLeftClick(sender, e, localListView));
|
||||
}
|
||||
files = Directory.GetFiles(directoryPath);
|
||||
listViewContents.Add(new List<String>());
|
||||
|
||||
directoryFiles = Directory.GetFiles(Path.GetFullPath(directoryPath));
|
||||
|
||||
foreach (string file in directoryFiles)
|
||||
foreach (string file in files)
|
||||
{
|
||||
switch (Path.GetExtension(file).ToLower())
|
||||
{
|
||||
//Only include sound files in the ListView
|
||||
case ".mp3":
|
||||
case ".wav":
|
||||
//Only include sound files in the ListView / most commonly supported audio formats in Windows
|
||||
case ".mp3": //MPEG layer 3
|
||||
case ".wav": //WAV audio format
|
||||
case ".wma": //Windows Media Audio
|
||||
case ".mid": //MIDI - Musical Instrument Digital Interface
|
||||
case ".ra": //Real Audio
|
||||
case ".ram": //Real Audio
|
||||
case ".rm": //Real Audio
|
||||
case ".ogg": //OGG audio format
|
||||
columnNames[0] = Path.GetFileNameWithoutExtension(file);
|
||||
columnNames[1] = Path.GetExtension(file);
|
||||
listItemObject = new ListViewItem(columnNames);
|
||||
localListView.Items.Add(listItemObject);
|
||||
listViewContents[index].Add(file);
|
||||
fileCount++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (localListView.Items.Count == 0)
|
||||
if (localListView.Items.Count == 0 && tab.Name == "WorkingDirectoryTab")
|
||||
{
|
||||
if (tab.Name == "WorkingDirectoryTab")
|
||||
{
|
||||
localListView.Items.Add("No sound files detected in the application's working directory.");
|
||||
}
|
||||
else
|
||||
{
|
||||
localListView.Items.Add("No sound files detected in the " + tabName + " directory");
|
||||
}
|
||||
|
||||
soundboardTabControl.Controls.Add(tab);
|
||||
tab.Controls.Add(localListView);
|
||||
localListView.Items.Add("No files found in the programs working directory");
|
||||
localListView.Enabled = false;
|
||||
if (soundboardTabControl.SelectedIndex == 0)
|
||||
{
|
||||
mainMenuFileShowOnDisk.Enabled = false;
|
||||
btnRandom.Enabled = false;
|
||||
}
|
||||
}
|
||||
else if (localListView.Items.Count > 0 && tab.Name == "WorkingDirectoryTab")
|
||||
{
|
||||
soundboardTabControl.Controls.Add(tab);
|
||||
tab.Controls.Add(localListView);
|
||||
}
|
||||
else if (localListView.Items.Count > 0)
|
||||
{
|
||||
soundboardTabControl.Controls.Add(tab);
|
||||
tab.Controls.Add(localListView);
|
||||
}
|
||||
else
|
||||
{
|
||||
//remove the array that represents the tab that was created above because it is empty
|
||||
int i = listViewContents.Count;
|
||||
listViewContents.RemoveAt(i - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void ListViewOnLeftClick(object sender, EventArgs e, ListView listView)
|
||||
{
|
||||
if (btnRandom.Enabled == false)
|
||||
{
|
||||
//If the btnRandom button is disabled that means a randomise function is running, so don't interupt it
|
||||
return;
|
||||
}
|
||||
string fileName;
|
||||
string fileExt;
|
||||
string fileLocation;
|
||||
@@ -277,109 +252,27 @@ namespace SoundBoard
|
||||
return;
|
||||
}
|
||||
}
|
||||
PlaySoundFile(fileLocation);
|
||||
gMultimediaPlayer.PlaySoundFile(fileLocation);
|
||||
}
|
||||
|
||||
private void btnRandom_Click(object sender, EventArgs e)
|
||||
{
|
||||
int iterations = (int)randomIterationNumericUpDown.Value;
|
||||
listViewEntity = (ListView)soundboardTabControl.SelectedTab.Controls[0];
|
||||
Player.currentPlaylist.clear();
|
||||
|
||||
//DOuble check to see if the ListView has any items that can be played
|
||||
if (listViewEntity.Enabled == false)
|
||||
{
|
||||
//the ListView disabled and therefore contains no sounds, so return
|
||||
return;
|
||||
}
|
||||
//disable the Random Button and the loop checkbox
|
||||
btnRandom.Enabled = false;
|
||||
loopSelectedSoundCheckBox.Enabled = false;
|
||||
GenerateRandomPlayList makePlayList = new GenerateRandomPlayList();
|
||||
string[] playList;
|
||||
|
||||
if (mainMenuPlayAll.Checked == true)
|
||||
{
|
||||
playRandomSoundBothColumns(iterations);
|
||||
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
|
||||
{
|
||||
btnRandom.Enabled = true;
|
||||
}
|
||||
loopSelectedSoundCheckBox.Enabled = true;
|
||||
return;
|
||||
playList = makePlayList.MulitViewPlayList(listViewContents, iterations);
|
||||
|
||||
gMultimediaPlayer.PlayAudioPlaylist(playList);
|
||||
}
|
||||
|
||||
for (int i = 0; i < iterations; i++)
|
||||
else
|
||||
{
|
||||
string fileLocation = "";
|
||||
string fileExt;
|
||||
string fileName;
|
||||
//Check to see if the selected tab is the working directory's tab
|
||||
if (soundboardTabControl.SelectedIndex == 0)
|
||||
{
|
||||
listViewEntity.Items[randomNum.Next(listViewEntity.Items.Count)].Selected = true;
|
||||
fileName = listViewEntity.SelectedItems[0].SubItems[0].Text;
|
||||
fileExt = listViewEntity.SelectedItems[0].SubItems[1].Text;
|
||||
playList = makePlayList.SingleViewPlayList(listViewContents, iterations, soundboardTabControl.SelectedIndex);
|
||||
|
||||
if (File.Exists(_workingDirectory + "\\" + fileName + fileExt))
|
||||
{
|
||||
fileLocation = _workingDirectory + "\\" + fileName + fileExt;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("The file couldn't be found.", "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
|
||||
{
|
||||
btnRandom.Enabled = true;
|
||||
}
|
||||
loopSelectedSoundCheckBox.Enabled = true;
|
||||
Player.currentPlaylist.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
listViewEntity.Items[randomNum.Next(listViewEntity.Items.Count)].Selected = true;
|
||||
fileName = listViewEntity.SelectedItems[0].SubItems[0].Text;
|
||||
fileExt = listViewEntity.SelectedItems[0].SubItems[1].Text;
|
||||
|
||||
if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt))
|
||||
{
|
||||
fileLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt, "Not Found");
|
||||
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
|
||||
{
|
||||
btnRandom.Enabled = true;
|
||||
}
|
||||
loopSelectedSoundCheckBox.Enabled = true;
|
||||
Player.currentPlaylist.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//load the player with the randomly chosen sounds
|
||||
enumeratePlayerPlayList(fileLocation);
|
||||
}
|
||||
//prepare the Player object and play the playlist
|
||||
btnRandom.Enabled = false;
|
||||
Player.settings.setMode("loop", false);
|
||||
PlayPlayList();
|
||||
}
|
||||
|
||||
private void PlaySoundFile(string fileLocation)
|
||||
{
|
||||
//Set the file to be played's location
|
||||
Player.URL = fileLocation;
|
||||
|
||||
//Attempt to play the file
|
||||
try
|
||||
{
|
||||
Player.controls.play();
|
||||
}
|
||||
catch (InvalidOperationException Ex)
|
||||
{
|
||||
MessageBox.Show("The file couldn't be played.", "Invalid Sound File", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
gMultimediaPlayer.PlayAudioPlaylist(playList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,91 +280,46 @@ namespace SoundBoard
|
||||
{
|
||||
if (loopSelectedSoundCheckBox.Checked == true)
|
||||
{
|
||||
Player.settings.setMode("loop", true);
|
||||
gMultimediaPlayer.WillLoop = true;
|
||||
gMultimediaPlayer.IsLoopBoxCheck = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.settings.setMode("loop", false);
|
||||
gMultimediaPlayer.WillLoop = false;
|
||||
gMultimediaPlayer.IsLoopBoxCheck = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void playRandomSoundBothColumns(int iterations)
|
||||
{
|
||||
int tempRandomNumber;
|
||||
string fileLocation = "";
|
||||
string fileName;
|
||||
string fileExt;
|
||||
listViewEntity = (ListView)soundboardTabControl.SelectedTab.Controls[0];
|
||||
|
||||
for (int i = 0; i <= iterations; i++)
|
||||
{
|
||||
tempRandomNumber = randomNum.Next(0, soundboardTabControl.TabCount);
|
||||
|
||||
if (soundboardTabControl.TabPages[tempRandomNumber].Controls[0].Enabled == true)
|
||||
{
|
||||
soundboardTabControl.SelectedIndex = tempRandomNumber;
|
||||
if (soundboardTabControl.SelectedIndex == 0)
|
||||
{
|
||||
listViewEntity.Items[randomNum.Next(listViewEntity.Items.Count)].Selected = true;
|
||||
fileName = listViewEntity.SelectedItems[0].SubItems[0].Text;
|
||||
fileExt = listViewEntity.SelectedItems[0].SubItems[1].Text;
|
||||
|
||||
if (File.Exists(_workingDirectory + "\\" + fileName + fileExt))
|
||||
{
|
||||
fileLocation = _workingDirectory + "\\" + fileName + fileExt;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
listViewEntity.Items[randomNum.Next(listViewEntity.Items.Count)].Selected = true;
|
||||
fileName = listViewEntity.SelectedItems[0].SubItems[0].Text;
|
||||
fileExt = listViewEntity.SelectedItems[0].SubItems[1].Text;
|
||||
|
||||
if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt))
|
||||
{
|
||||
fileLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
enumeratePlayerPlayList(fileLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
playRandomSoundBothColumns(iterations - i);
|
||||
}
|
||||
}
|
||||
PlayPlayList();
|
||||
}
|
||||
|
||||
#region Menu Strip Actions
|
||||
private void mainMenuFileShowOnDisk_Click(object sender, EventArgs e)
|
||||
{
|
||||
listViewEntity = (ListView)soundboardTabControl.SelectedTab.Controls[0];
|
||||
string fileName;
|
||||
string fileExt;
|
||||
|
||||
fileName = listViewEntity.SelectedItems[0].SubItems[0].Text;
|
||||
fileExt = listViewEntity.SelectedItems[0].SubItems[1].Text;
|
||||
|
||||
if (soundboardTabControl.SelectedIndex == 0)
|
||||
try
|
||||
{
|
||||
if (File.Exists(_workingDirectory + "\\" + fileName + fileExt))
|
||||
fileName = listViewEntity.SelectedItems[0].SubItems[0].Text;
|
||||
fileExt = listViewEntity.SelectedItems[0].SubItems[1].Text;
|
||||
|
||||
if (soundboardTabControl.SelectedIndex == 0)
|
||||
{
|
||||
Process.Start("explorer.exe", "/select, \"" + _workingDirectory + "\\" + fileName + fileExt + "\"");
|
||||
if (File.Exists(_workingDirectory + "\\" + fileName + fileExt))
|
||||
{
|
||||
Process.Start("explorer.exe", "/select, \"" + _workingDirectory + "\\" + fileName + fileExt + "\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt))
|
||||
{
|
||||
Process.Start("explorer.exe", "/select, \"" + _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt))
|
||||
{
|
||||
Process.Start("explorer.exe", "/select, \"" + _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + fileName + fileExt + "\"");
|
||||
}
|
||||
MessageBox.Show("No item is selected.", "No File Selected");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,29 +334,32 @@ namespace SoundBoard
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void enumeratePlayerPlayList(string fileLocation)
|
||||
private void mainMenuHelpShowConsole_Click(object sender, EventArgs e)
|
||||
{
|
||||
WMPLib.IWMPMedia playList = Player.newMedia(fileLocation);
|
||||
Player.currentPlaylist.appendItem(playList);
|
||||
debugConsoleWindow.ShowConsole();
|
||||
mainMenuHelpShowConsole.Enabled = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void PlayPlayList()
|
||||
{
|
||||
Player.controls.play();
|
||||
}
|
||||
//Handles all messages being sent to controls
|
||||
public bool PreFilterMessage(ref Message m)
|
||||
{
|
||||
Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;
|
||||
bool retVal = false;
|
||||
//NEEDS IT'S OWN THREAD!
|
||||
//public bool PreFilterMessage(ref Message m)
|
||||
//{
|
||||
// Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;
|
||||
// bool retVal = false;
|
||||
|
||||
if (m.Msg == WM_KEYDOWN)
|
||||
{
|
||||
// Handle the keypress
|
||||
label1.Text = keyCode.ToString();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
// if (m.Msg == WM_KEYDOWN)
|
||||
// {
|
||||
// // Handle the keypress
|
||||
// //Disable the Tab key
|
||||
// if (keyCode.ToString() == "Tab")
|
||||
// {
|
||||
// //Tab key caught, filter out the keystroke
|
||||
// debugConsoleWindow.WriteToConsole("Keystroke seen");
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return retVal;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
namespace SoundBoard
|
||||
{
|
||||
partial class programDebugConsole
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.mainDebugMenu = new System.Windows.Forms.MenuStrip();
|
||||
this.mainDebugMenuFile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mainDebugMenuFileClearLog = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mainDebugMenuOptions = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.listViewLog = new System.Windows.Forms.ListView();
|
||||
this.mainDebugMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mainDebugMenu
|
||||
//
|
||||
this.mainDebugMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mainDebugMenuFile,
|
||||
this.mainDebugMenuOptions});
|
||||
this.mainDebugMenu.Location = new System.Drawing.Point(0, 0);
|
||||
this.mainDebugMenu.Name = "mainDebugMenu";
|
||||
this.mainDebugMenu.Size = new System.Drawing.Size(486, 24);
|
||||
this.mainDebugMenu.TabIndex = 0;
|
||||
this.mainDebugMenu.Text = "menuStrip1";
|
||||
//
|
||||
// mainDebugMenuFile
|
||||
//
|
||||
this.mainDebugMenuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mainDebugMenuFileClearLog});
|
||||
this.mainDebugMenuFile.Name = "mainDebugMenuFile";
|
||||
this.mainDebugMenuFile.Size = new System.Drawing.Size(37, 20);
|
||||
this.mainDebugMenuFile.Text = "&File";
|
||||
//
|
||||
// mainDebugMenuFileClearLog
|
||||
//
|
||||
this.mainDebugMenuFileClearLog.Name = "mainDebugMenuFileClearLog";
|
||||
this.mainDebugMenuFileClearLog.Size = new System.Drawing.Size(152, 22);
|
||||
this.mainDebugMenuFileClearLog.Text = "&Clear Log";
|
||||
this.mainDebugMenuFileClearLog.Click += new System.EventHandler(this.mainDebugMenuFileClearLog_Click);
|
||||
//
|
||||
// mainDebugMenuOptions
|
||||
//
|
||||
this.mainDebugMenuOptions.Name = "mainDebugMenuOptions";
|
||||
this.mainDebugMenuOptions.Size = new System.Drawing.Size(61, 20);
|
||||
this.mainDebugMenuOptions.Text = "&Options";
|
||||
//
|
||||
// listViewLog
|
||||
//
|
||||
this.listViewLog.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.listViewLog.Location = new System.Drawing.Point(0, 27);
|
||||
this.listViewLog.Name = "listViewLog";
|
||||
this.listViewLog.Size = new System.Drawing.Size(486, 451);
|
||||
this.listViewLog.TabIndex = 1;
|
||||
this.listViewLog.TabStop = false;
|
||||
this.listViewLog.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewLog.View = System.Windows.Forms.View.List;
|
||||
//
|
||||
// programDebugConsole
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(486, 476);
|
||||
this.Controls.Add(this.listViewLog);
|
||||
this.Controls.Add(this.mainDebugMenu);
|
||||
this.MainMenuStrip = this.mainDebugMenu;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "programDebugConsole";
|
||||
this.Text = "SoundBoard Console";
|
||||
this.Load += new System.EventHandler(this.programDebugConsole_Load);
|
||||
this.mainDebugMenu.ResumeLayout(false);
|
||||
this.mainDebugMenu.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.MenuStrip mainDebugMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem mainDebugMenuFile;
|
||||
private System.Windows.Forms.ToolStripMenuItem mainDebugMenuOptions;
|
||||
private System.Windows.Forms.ListView listViewLog;
|
||||
private System.Windows.Forms.ToolStripMenuItem mainDebugMenuFileClearLog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SoundBoard
|
||||
{
|
||||
public partial class programDebugConsole : Form
|
||||
{
|
||||
public programDebugConsole()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void programDebugConsole_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Create and event handler to detect for form resize
|
||||
this.Resize += ProgramDebugConsole_Resize;
|
||||
listViewLog.Items.Add("SoundBoard Beta v1.5.0.0, with MP3 support.");
|
||||
}
|
||||
|
||||
private void ProgramDebugConsole_Resize(object sender, EventArgs e)
|
||||
{
|
||||
listViewLog.Height = this.Height;
|
||||
listViewLog.Width = this.Width;
|
||||
}
|
||||
|
||||
public void WriteToConsole(string message)
|
||||
{
|
||||
listViewLog.Items.Add(message);
|
||||
}
|
||||
|
||||
private void mainDebugMenuFileClearLog_Click(object sender, EventArgs e)
|
||||
{
|
||||
listViewLog.Items.Clear();
|
||||
listViewLog.Items.Add("SoundBoard Beta v1.5.0.0, with MP3 support.");
|
||||
}
|
||||
|
||||
public void ShowConsole()
|
||||
{
|
||||
this.Show();
|
||||
}
|
||||
|
||||
public void HideConsole()
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: 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">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<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">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<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" 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">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="mainDebugMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user