mirror of
https://github.com/chibicitiberiu/drumkit.git
synced 2024-02-24 10:53:32 +00:00
Added 'show key bindings' feature.
This commit is contained in:
parent
25b97fe51f
commit
fb6791fee2
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2013
|
||||||
|
VisualStudioVersion = 12.0.21005.1
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrumKit", "DrumKit\DrumKit.csproj", "{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrumKit", "DrumKit\DrumKit.csproj", "{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tarball", "Tarball\Tarball.csproj", "{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tarball", "Tarball\Tarball.csproj", "{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}"
|
||||||
|
Binary file not shown.
@ -769,13 +769,15 @@
|
|||||||
<Setter Property="AutomationProperties.AutomationId" Value="GoAppBarButton"/>
|
<Setter Property="AutomationProperties.AutomationId" Value="GoAppBarButton"/>
|
||||||
<Setter Property="AutomationProperties.Name" Value="Go"/>
|
<Setter Property="AutomationProperties.Name" Value="Go"/>
|
||||||
<Setter Property="Content" Value=""/>
|
<Setter Property="Content" Value=""/>
|
||||||
</Style>
|
</Style> -->
|
||||||
|
|
||||||
<Style x:Key="KeyboardAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
|
<Style x:Key="KeyboardAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
|
||||||
<Setter Property="AutomationProperties.AutomationId" Value="KeyboardAppBarButton"/>
|
<Setter Property="AutomationProperties.AutomationId" Value="KeyboardAppBarButton"/>
|
||||||
<Setter Property="AutomationProperties.Name" Value="Keyboard"/>
|
<Setter Property="AutomationProperties.Name" Value="Keyboard"/>
|
||||||
<Setter Property="Content" Value=""/>
|
<Setter Property="Content" Value=""/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="DockLeftAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
|
|
||||||
|
<!-- <Style x:Key="DockLeftAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
|
||||||
<Setter Property="AutomationProperties.AutomationId" Value="DockLeftAppBarButton"/>
|
<Setter Property="AutomationProperties.AutomationId" Value="DockLeftAppBarButton"/>
|
||||||
<Setter Property="AutomationProperties.Name" Value="Dock Left"/>
|
<Setter Property="AutomationProperties.Name" Value="Dock Left"/>
|
||||||
<Setter Property="Content" Value=""/>
|
<Setter Property="Content" Value=""/>
|
||||||
|
@ -201,6 +201,7 @@
|
|||||||
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\TomLow04.wav" />
|
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\TomLow04.wav" />
|
||||||
<None Include="DrumKit_StoreKey.pfx" />
|
<None Include="DrumKit_StoreKey.pfx" />
|
||||||
<None Include="DrumKit_TemporaryKey.pfx" />
|
<None Include="DrumKit_TemporaryKey.pfx" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Assets\bg.png" />
|
<Content Include="Assets\bg.png" />
|
||||||
@ -281,22 +282,23 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="SharpDX, Version=2.4.2.0, Culture=neutral, PublicKeyToken=627a3d6d1956f55a, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\..\..\..\WebDownloads\SharpDX242\Bin\Signed-winrt\SharpDX.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SharpDX.XAudio2, Version=2.4.2.0, Culture=neutral, PublicKeyToken=627a3d6d1956f55a, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\..\..\..\WebDownloads\SharpDX242\Bin\Signed-winrt\SharpDX.XAudio2.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Tarball\Tarball.csproj">
|
<ProjectReference Include="..\Tarball\Tarball.csproj">
|
||||||
<Project>{5cb567d7-572e-4bae-802f-7e3f62cddf64}</Project>
|
<Project>{5cb567d7-572e-4bae-802f-7e3f62cddf64}</Project>
|
||||||
<Name>Tarball</Name>
|
<Name>Tarball</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<WCFMetadata Include="Service References\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="SharpDX">
|
||||||
|
<HintPath>..\packages\SharpDX.2.5.0\lib\win8\SharpDX.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="SharpDX.XAudio2">
|
||||||
|
<HintPath>..\packages\SharpDX.XAudio2.2.5.0\lib\win8\SharpDX.XAudio2.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '11.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '11.0' ">
|
||||||
<VisualStudioVersion>11.0</VisualStudioVersion>
|
<VisualStudioVersion>11.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
d:DesignHeight="300"
|
d:DesignHeight="300"
|
||||||
d:DesignWidth="400">
|
d:DesignWidth="400">
|
||||||
|
|
||||||
<Grid Name="grid" Background="Transparent"
|
<Grid Background="Transparent">
|
||||||
PointerPressed="Grid_PointerPressed">
|
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
@ -52,14 +51,38 @@
|
|||||||
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
<Image Name="image" IsHitTestVisible="False"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch" />
|
|
||||||
|
|
||||||
<Image Name="imagePressed" IsHitTestVisible="False"
|
<Grid Name="grid" Background="Transparent"
|
||||||
HorizontalAlignment="Stretch"
|
PointerPressed="Grid_PointerPressed">
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Opacity="0" />
|
<Image Name="image" IsHitTestVisible="False"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch" />
|
||||||
|
|
||||||
|
<Image Name="imagePressed" IsHitTestVisible="False"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Opacity="0" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Name="textKeyShadow"
|
||||||
|
Text="{Binding ElementName=textKey, Path=Text}"
|
||||||
|
Style="{StaticResource TitleTextStyle}"
|
||||||
|
Foreground="Black"
|
||||||
|
IsHitTestVisible="False"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="2,0,0,13"
|
||||||
|
Opacity="0.6" />
|
||||||
|
|
||||||
|
<TextBlock Name="textKey"
|
||||||
|
IsHitTestVisible="False"
|
||||||
|
Style="{StaticResource TitleTextStyle}"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,0,14"
|
||||||
|
Opacity="0.8" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -62,11 +62,50 @@ namespace DrumKit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables or disables the hit animation.
|
/// Enables or disables the hit animation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool IsAnimationEnabled {
|
private bool IsAnimationEnabled
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return DataController.Settings.Animations;
|
return DataController.Settings.Animations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the key string for display
|
||||||
|
/// </summary>
|
||||||
|
public string KeyString
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(value))
|
||||||
|
this.textKey.Text = String.Format("{0} [{1}]", DrumName, value);
|
||||||
|
|
||||||
|
else this.textKey.Text = DrumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating if the key is visible
|
||||||
|
/// </summary>
|
||||||
|
public bool IsKeyVisible
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.textKey.Visibility == Windows.UI.Xaml.Visibility.Visible;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.textKey.Visibility = (value) ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
this.textKeyShadow.Visibility = (value) ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the drum name
|
||||||
|
/// </summary>
|
||||||
|
private string DrumName { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
@ -82,7 +121,8 @@ namespace DrumKit
|
|||||||
|
|
||||||
// Set drum properties
|
// Set drum properties
|
||||||
this.DrumID = drum.Id;
|
this.DrumID = drum.Id;
|
||||||
// TODO: key
|
this.DrumName = drum.Name;
|
||||||
|
this.KeyString = null;
|
||||||
this.image.Source = drum.LoadedImageSource;
|
this.image.Source = drum.LoadedImageSource;
|
||||||
this.imagePressed.Source = drum.LoadedImagePressedSource;
|
this.imagePressed.Source = drum.LoadedImagePressedSource;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,13 @@
|
|||||||
Click="ButtonEditMode_Click"
|
Click="ButtonEditMode_Click"
|
||||||
Style="{StaticResource EditAppBarButtonStyle}" />
|
Style="{StaticResource EditAppBarButtonStyle}" />
|
||||||
|
|
||||||
|
<ToggleButton
|
||||||
|
Name="buttonKeys"
|
||||||
|
Click="buttonKeys_Click"
|
||||||
|
AutomationProperties.Name="Show keys"
|
||||||
|
IsChecked="True"
|
||||||
|
Style="{StaticResource KeyboardAppBarButtonStyle}" />
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="1" Orientation="Horizontal" >
|
<StackPanel Grid.Column="1" Orientation="Horizontal" >
|
||||||
|
@ -79,12 +79,21 @@ namespace DrumKit
|
|||||||
{
|
{
|
||||||
// Clear previous stuff if any
|
// Clear previous stuff if any
|
||||||
this.DrumUIs.Clear();
|
this.DrumUIs.Clear();
|
||||||
this.Keymap.Clear();
|
|
||||||
|
|
||||||
// Load drums
|
// Load drums
|
||||||
foreach (var i in DataController.CurrentDrumkit.DrumsList)
|
foreach (var i in DataController.CurrentDrumkit.DrumsList)
|
||||||
InitializeDrum(i);
|
InitializeDrum(i);
|
||||||
|
|
||||||
|
UpdateDrumConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets up the drum configurations
|
||||||
|
/// </summary>
|
||||||
|
private void UpdateDrumConfig()
|
||||||
|
{
|
||||||
|
this.Keymap.Clear();
|
||||||
|
|
||||||
// Load drum configurations
|
// Load drum configurations
|
||||||
foreach (var i in DataController.CurrentConfig.DrumsList)
|
foreach (var i in DataController.CurrentConfig.DrumsList)
|
||||||
{
|
{
|
||||||
@ -95,9 +104,16 @@ namespace DrumKit
|
|||||||
this.DrumUIs.Remove(i.TargetId);
|
this.DrumUIs.Remove(i.TargetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keyboard mapping
|
else
|
||||||
if (!Keymap.ContainsKey(i.Key))
|
{
|
||||||
Keymap.Add(i.Key, i.TargetId);
|
// Set drum key
|
||||||
|
this.DrumUIs[i.TargetId].KeyString = UIHelper.GetPrettifiedVKeyName(i.Key);
|
||||||
|
this.DrumUIs[i.TargetId].IsKeyVisible = DataController.Settings.ShowKeyBindings;
|
||||||
|
|
||||||
|
// Keyboard mapping
|
||||||
|
if (!Keymap.ContainsKey(i.Key))
|
||||||
|
Keymap.Add(i.Key, i.TargetId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,6 +299,7 @@ namespace DrumKit
|
|||||||
|
|
||||||
// Set toggles
|
// Set toggles
|
||||||
buttonAnimations.IsChecked = DataController.Settings.Animations;
|
buttonAnimations.IsChecked = DataController.Settings.Animations;
|
||||||
|
buttonKeys.IsChecked = DataController.Settings.ShowKeyBindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -336,6 +353,29 @@ namespace DrumKit
|
|||||||
DataController.SaveSettings();
|
DataController.SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the 'show keys' toggle button
|
||||||
|
/// </summary>
|
||||||
|
private void buttonKeys_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var button = sender as ToggleButton;
|
||||||
|
if (button == null) return;
|
||||||
|
|
||||||
|
bool isChecked = (button.IsChecked.HasValue && button.IsChecked.Value);
|
||||||
|
|
||||||
|
// Fix togglebuton style bug
|
||||||
|
VisualStateManager.GoToState(button, isChecked ? "Checked" : "Unchecked", false);
|
||||||
|
|
||||||
|
// Change setting
|
||||||
|
DataController.Settings.ShowKeyBindings = isChecked;
|
||||||
|
|
||||||
|
// Update UI
|
||||||
|
UpdateDrumConfig();
|
||||||
|
|
||||||
|
// Save modified setting
|
||||||
|
DataController.SaveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Goes to application settings.
|
/// Goes to application settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -345,6 +385,5 @@ namespace DrumKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
<ToggleButton
|
<ToggleButton
|
||||||
Name="toggleEnabled" Grid.Column="0"
|
Name="toggleEnabled" Grid.Column="0"
|
||||||
Margin="0,-4,20,0" Padding="5,1"
|
Margin="0,-4,20,0" Padding="5,1"
|
||||||
Content="Enabled"
|
Content="Visible"
|
||||||
Click="ToggleEnabled_Click" />
|
Click="ToggleEnabled_Click" />
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
@ -106,22 +106,7 @@ namespace DrumKit
|
|||||||
|
|
||||||
if (key != null)
|
if (key != null)
|
||||||
{
|
{
|
||||||
if (Enum.IsDefined(typeof(VirtualKey), config.Key))
|
key.Text = UIHelper.GetPrettifiedVKeyName(config.Key);
|
||||||
{
|
|
||||||
// Get name
|
|
||||||
string text = Enum.GetName(typeof(VirtualKey), config.Key);
|
|
||||||
|
|
||||||
// Prettify the name
|
|
||||||
if (text.StartsWith("Number"))
|
|
||||||
text = text.Substring("Number".Length);
|
|
||||||
|
|
||||||
text = System.Text.RegularExpressions.Regex.Replace(text, "([a-z])([A-Z])", "${1} ${2}");
|
|
||||||
|
|
||||||
// Set the text
|
|
||||||
key.Text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
else key.Text = string.Format("Unnamed ({0})", (int)config.Key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,12 +133,12 @@
|
|||||||
Grid.Row="10" Grid.Column="1"/>
|
Grid.Row="10" Grid.Column="1"/>
|
||||||
|
|
||||||
<!-- Interface section: Key bindings -->
|
<!-- Interface section: Key bindings -->
|
||||||
<!--<TextBlock Style="{StaticResource ItemTextStyle}"
|
<TextBlock Style="{StaticResource ItemTextStyle}"
|
||||||
Grid.Row="11" Margin="2,12,2,2">
|
Grid.Row="11" Margin="2,12,2,2">
|
||||||
Display key bindings</TextBlock>
|
Display key bindings</TextBlock>
|
||||||
|
|
||||||
<ToggleSwitch Name="keyBindingsToggle"
|
<ToggleSwitch Name="keyBindingsToggle"
|
||||||
Grid.Row="11" Grid.Column="1"/>-->
|
Grid.Row="11" Grid.Column="1"/>
|
||||||
|
|
||||||
<!-- Miscellaneous section -->
|
<!-- Miscellaneous section -->
|
||||||
<TextBlock Style="{StaticResource MyTitleTextStyle}"
|
<TextBlock Style="{StaticResource MyTitleTextStyle}"
|
||||||
|
@ -36,14 +36,14 @@ namespace DrumKit
|
|||||||
this.masterVolumeSlider.Value = DataController.MasterVolume * 100;
|
this.masterVolumeSlider.Value = DataController.MasterVolume * 100;
|
||||||
this.polyphonySlider.Value = DataController.Settings.Polyphony;
|
this.polyphonySlider.Value = DataController.Settings.Polyphony;
|
||||||
this.animationsToggle.IsOn = DataController.Settings.Animations;
|
this.animationsToggle.IsOn = DataController.Settings.Animations;
|
||||||
//this.keyBindingsToggle.IsOn = DataController.Settings.ShowKeyBindings;
|
this.keyBindingsToggle.IsOn = DataController.Settings.ShowKeyBindings;
|
||||||
this.debuggingModeToggle.IsOn = DataController.Settings.DebugMode;
|
this.debuggingModeToggle.IsOn = DataController.Settings.DebugMode;
|
||||||
|
|
||||||
// Set up events
|
// Set up events
|
||||||
masterVolumeSlider.ValueChanged += masterVolumeSlider_ValueChanged;
|
masterVolumeSlider.ValueChanged += masterVolumeSlider_ValueChanged;
|
||||||
polyphonySlider.ValueChanged += polyphonySlider_ValueChanged;
|
polyphonySlider.ValueChanged += polyphonySlider_ValueChanged;
|
||||||
animationsToggle.Toggled += animationsToggle_Toggled;
|
animationsToggle.Toggled += animationsToggle_Toggled;
|
||||||
//keyBindingsToggle.Toggled += keyBindingsToggle_Toggled;
|
keyBindingsToggle.Toggled += keyBindingsToggle_Toggled;
|
||||||
buttonWebsite.Click += buttonWebsite_Click;
|
buttonWebsite.Click += buttonWebsite_Click;
|
||||||
buttonSupport.Click += buttonSupport_Click;
|
buttonSupport.Click += buttonSupport_Click;
|
||||||
buttonReset.Click += buttonReset_Click;
|
buttonReset.Click += buttonReset_Click;
|
||||||
@ -68,11 +68,11 @@ namespace DrumKit
|
|||||||
DataController.SaveSettings();
|
DataController.SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void keyBindingsToggle_Toggled(object sender, RoutedEventArgs e)
|
private void keyBindingsToggle_Toggled(object sender, RoutedEventArgs e)
|
||||||
//{
|
{
|
||||||
// DataController.Settings.ShowKeyBindings = this.keyBindingsToggle.IsOn;
|
DataController.Settings.ShowKeyBindings = this.keyBindingsToggle.IsOn;
|
||||||
// DataController.SaveSettings();
|
DataController.SaveSettings();
|
||||||
//}
|
}
|
||||||
|
|
||||||
private async void buttonWebsite_Click(object sender, RoutedEventArgs e)
|
private async void buttonWebsite_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Windows.System;
|
||||||
using Windows.UI.ViewManagement;
|
using Windows.UI.ViewManagement;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
@ -51,5 +52,24 @@ namespace DrumKit
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetPrettifiedVKeyName(VirtualKey vkey)
|
||||||
|
{
|
||||||
|
if (Enum.IsDefined(typeof(VirtualKey), vkey))
|
||||||
|
{
|
||||||
|
// Get name
|
||||||
|
string text = Enum.GetName(typeof(VirtualKey), vkey);
|
||||||
|
|
||||||
|
// Prettify the name
|
||||||
|
if (text.StartsWith("Number"))
|
||||||
|
text = text.Substring("Number".Length);
|
||||||
|
|
||||||
|
text = System.Text.RegularExpressions.Regex.Replace(text, "([a-z])([A-Z])", "${1} ${2}");
|
||||||
|
|
||||||
|
// Set the text
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
else return string.Format("Unnamed ({0})", (int)vkey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
DrumKit/packages.config
Normal file
5
DrumKit/packages.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="SharpDX" version="2.5.0" targetFramework="win" />
|
||||||
|
<package id="SharpDX.XAudio2" version="2.5.0" targetFramework="win" />
|
||||||
|
</packages>
|
Loading…
Reference in New Issue
Block a user