Added 'show key bindings' feature.

This commit is contained in:
Tiberiu Chibici 2014-05-05 11:23:28 +03:00
parent 25b97fe51f
commit fb6791fee2
14 changed files with 3741 additions and 3616 deletions

View File

@ -1,64 +1,66 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2013
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrumKit", "DrumKit\DrumKit.csproj", "{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}" VisualStudioVersion = 12.0.21005.1
EndProject MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tarball", "Tarball\Tarball.csproj", "{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrumKit", "DrumKit\DrumKit.csproj", "{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}"
EndProject EndProject
Global Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tarball", "Tarball\Tarball.csproj", "{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}"
GlobalSection(SolutionConfigurationPlatforms) = preSolution EndProject
Debug|Any CPU = Debug|Any CPU Global
Debug|ARM = Debug|ARM GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86 Debug|ARM = Debug|ARM
Release|Any CPU = Release|Any CPU Debug|x64 = Debug|x64
Release|ARM = Release|ARM Debug|x86 = Debug|x86
Release|x64 = Release|x64 Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86 Release|ARM = Release|ARM
EndGlobalSection Release|x64 = Release|x64
GlobalSection(ProjectConfigurationPlatforms) = postSolution Release|x86 = Release|x86
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU EndGlobalSection
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|Any CPU.Build.0 = Debug|Any CPU GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|ARM.ActiveCfg = Debug|ARM {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|ARM.Build.0 = Debug|ARM {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|ARM.Deploy.0 = Debug|ARM {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|ARM.ActiveCfg = Debug|ARM
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x64.ActiveCfg = Debug|x64 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|ARM.Build.0 = Debug|ARM
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x64.Build.0 = Debug|x64 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|ARM.Deploy.0 = Debug|ARM
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x64.Deploy.0 = Debug|x64 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x64.ActiveCfg = Debug|x64
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x86.ActiveCfg = Debug|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x64.Build.0 = Debug|x64
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x86.Build.0 = Debug|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x64.Deploy.0 = Debug|x64
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x86.Deploy.0 = Debug|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x86.ActiveCfg = Debug|x86
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|Any CPU.ActiveCfg = Release|Any CPU {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x86.Build.0 = Debug|x86
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|Any CPU.Build.0 = Release|Any CPU {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Debug|x86.Deploy.0 = Debug|x86
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|Any CPU.Deploy.0 = Release|Any CPU {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|ARM.ActiveCfg = Release|ARM {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|Any CPU.Build.0 = Release|Any CPU
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|ARM.Build.0 = Release|ARM {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|Any CPU.Deploy.0 = Release|Any CPU
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|ARM.Deploy.0 = Release|ARM {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|ARM.ActiveCfg = Release|ARM
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x64.ActiveCfg = Release|x64 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|ARM.Build.0 = Release|ARM
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x64.Build.0 = Release|x64 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|ARM.Deploy.0 = Release|ARM
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x64.Deploy.0 = Release|x64 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x64.ActiveCfg = Release|x64
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.ActiveCfg = Release|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x64.Build.0 = Release|x64
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Build.0 = Release|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x64.Deploy.0 = Release|x64
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Deploy.0 = Release|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.ActiveCfg = Release|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Build.0 = Release|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|Any CPU.Build.0 = Debug|Any CPU {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Deploy.0 = Release|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|ARM.ActiveCfg = Debug|ARM {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|ARM.Build.0 = Debug|ARM {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x64.ActiveCfg = Debug|x64 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|ARM.ActiveCfg = Debug|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x64.Build.0 = Debug|x64 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|ARM.Build.0 = Debug|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x86.ActiveCfg = Debug|x86 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x64.ActiveCfg = Debug|x64
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x86.Build.0 = Debug|x86 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x64.Build.0 = Debug|x64
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|Any CPU.ActiveCfg = Release|Any CPU {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x86.ActiveCfg = Debug|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|Any CPU.Build.0 = Release|Any CPU {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x86.Build.0 = Debug|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|ARM.ActiveCfg = Release|ARM {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|ARM.Build.0 = Release|ARM {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|Any CPU.Build.0 = Release|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x64.ActiveCfg = Release|x64 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|ARM.ActiveCfg = Release|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x64.Build.0 = Release|x64 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|ARM.Build.0 = Release|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x86.ActiveCfg = Release|x86 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x64.ActiveCfg = Release|x64
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x86.Build.0 = Release|x86 {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x64.Build.0 = Release|x64
EndGlobalSection {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x86.ActiveCfg = Release|x86
GlobalSection(SolutionProperties) = preSolution {5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x86.Build.0 = Release|x86
HideSolutionNode = FALSE EndGlobalSection
EndGlobalSection GlobalSection(SolutionProperties) = preSolution
EndGlobal HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,314 +1,316 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}</ProjectGuid> <ProjectGuid>{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}</ProjectGuid>
<OutputType>AppContainerExe</OutputType> <OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DrumKit</RootNamespace> <RootNamespace>DrumKit</RootNamespace>
<AssemblyName>DrumKit</AssemblyName> <AssemblyName>DrumKit</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage> <DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>DrumKit_StoreKey.pfx</PackageCertificateKeyFile> <PackageCertificateKeyFile>DrumKit_StoreKey.pfx</PackageCertificateKeyFile>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision> <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<PackageCertificateThumbprint>4FCCD6DD6F5D1EEA43AC26BB8D451F1B54209922</PackageCertificateThumbprint> <PackageCertificateThumbprint>4FCCD6DD6F5D1EEA43AC26BB8D451F1B54209922</PackageCertificateThumbprint>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled> <AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath> <OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget> <PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath> <OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget> <PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath> <OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath> <OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath> <OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App.xaml.cs"> <Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Controller\DataController.cs" /> <Compile Include="Controller\DataController.cs" />
<Compile Include="Controller\ControllerException.cs" /> <Compile Include="Controller\ControllerException.cs" />
<Compile Include="Domain\AppInstallInfo.cs" /> <Compile Include="Domain\AppInstallInfo.cs" />
<Compile Include="Domain\AppSettings.cs" /> <Compile Include="Domain\AppSettings.cs" />
<Compile Include="Domain\Sound.cs" /> <Compile Include="Domain\Sound.cs" />
<Compile Include="Recorder.cs" /> <Compile Include="Recorder.cs" />
<Compile Include="UI\DrumPlayUI.xaml.cs"> <Compile Include="UI\DrumPlayUI.xaml.cs">
<DependentUpon>DrumPlayUI.xaml</DependentUpon> <DependentUpon>DrumPlayUI.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\DrumEditUI.xaml.cs"> <Compile Include="UI\DrumEditUI.xaml.cs">
<DependentUpon>DrumEditUI.xaml</DependentUpon> <DependentUpon>DrumEditUI.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\EditorPage.xaml.cs"> <Compile Include="UI\EditorPage.xaml.cs">
<DependentUpon>EditorPage.xaml</DependentUpon> <DependentUpon>EditorPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\Settings\LayoutsSettingsControl.xaml.cs"> <Compile Include="UI\Settings\LayoutsSettingsControl.xaml.cs">
<DependentUpon>LayoutsSettingsControl.xaml</DependentUpon> <DependentUpon>LayoutsSettingsControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Utils\UIHelper.cs" /> <Compile Include="Utils\UIHelper.cs" />
<Compile Include="UI\Settings\ExperimentsSettingsControl.xaml.cs"> <Compile Include="UI\Settings\ExperimentsSettingsControl.xaml.cs">
<DependentUpon>ExperimentsSettingsControl.xaml</DependentUpon> <DependentUpon>ExperimentsSettingsControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\CommonControls\FileControl.xaml.cs"> <Compile Include="UI\CommonControls\FileControl.xaml.cs">
<DependentUpon>FileControl.xaml</DependentUpon> <DependentUpon>FileControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\Settings\DrumsSettingsControl.xaml.cs"> <Compile Include="UI\Settings\DrumsSettingsControl.xaml.cs">
<DependentUpon>DrumsSettingsControl.xaml</DependentUpon> <DependentUpon>DrumsSettingsControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\Settings\DrumkitsSettingsControl.xaml.cs"> <Compile Include="UI\Settings\DrumkitsSettingsControl.xaml.cs">
<DependentUpon>DrumkitsSettingsControl.xaml</DependentUpon> <DependentUpon>DrumkitsSettingsControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\Settings\GeneralSettingsControl.xaml.cs"> <Compile Include="UI\Settings\GeneralSettingsControl.xaml.cs">
<DependentUpon>GeneralSettingsControl.xaml</DependentUpon> <DependentUpon>GeneralSettingsControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Repository\LogRepository.cs" /> <Compile Include="Repository\LogRepository.cs" />
<Compile Include="Repository\DataRepository.cs" /> <Compile Include="Repository\DataRepository.cs" />
<Compile Include="Repository\SoundRepository.cs" /> <Compile Include="Repository\SoundRepository.cs" />
<Compile Include="UI\SettingsPage.xaml.cs"> <Compile Include="UI\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon> <DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Repository\RepositoryException.cs" /> <Compile Include="Repository\RepositoryException.cs" />
<Compile Include="Utils\IOHelper.cs" /> <Compile Include="Utils\IOHelper.cs" />
<Compile Include="Log.cs" /> <Compile Include="Log.cs" />
<Compile Include="Domain\Drum.cs" /> <Compile Include="Domain\Drum.cs" />
<Compile Include="Domain\DrumConfig.cs" /> <Compile Include="Domain\DrumConfig.cs" />
<Compile Include="Domain\Drumkit.cs" /> <Compile Include="Domain\Drumkit.cs" />
<Compile Include="Domain\DrumkitConfig.cs" /> <Compile Include="Domain\DrumkitConfig.cs" />
<Compile Include="Domain\DrumkitLayout.cs" /> <Compile Include="Domain\DrumkitLayout.cs" />
<Compile Include="Domain\DrumkitLayoutCollection.cs" /> <Compile Include="Domain\DrumkitLayoutCollection.cs" />
<Compile Include="Domain\DrumkitLayoutTargetView.cs" /> <Compile Include="Domain\DrumkitLayoutTargetView.cs" />
<Compile Include="Domain\DrumLayout.cs" /> <Compile Include="Domain\DrumLayout.cs" />
<Compile Include="Repository\DrumkitRepository.cs" /> <Compile Include="Repository\DrumkitRepository.cs" />
<Compile Include="UI\LoadingPage.xaml.cs"> <Compile Include="UI\LoadingPage.xaml.cs">
<DependentUpon>LoadingPage.xaml</DependentUpon> <DependentUpon>LoadingPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\MainPage.xaml.cs"> <Compile Include="UI\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon> <DependentUpon>MainPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SoundPool.cs" /> <Compile Include="SoundPool.cs" />
<Compile Include="Domain\SoundSource.cs" /> <Compile Include="Domain\SoundSource.cs" />
<Compile Include="UI\Settings\LogControl.xaml.cs"> <Compile Include="UI\Settings\LogControl.xaml.cs">
<DependentUpon>LogControl.xaml</DependentUpon> <DependentUpon>LogControl.xaml</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AppxManifest Include="Package.appxmanifest"> <AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</AppxManifest> </AppxManifest>
<Content Include="Assets\ApplicationData.tar" /> <Content Include="Assets\ApplicationData.tar" />
<Content Include="Features.txt" /> <Content Include="Features.txt" />
<None Include="Build\7z.exe" /> <None Include="Build\7z.exe" />
<None Include="Build\ApplicationData\Drumkits\Default\config.xml" /> <None Include="Build\ApplicationData\Drumkits\Default\config.xml" />
<None Include="Build\ApplicationData\Drumkits\Default\drumkit.xml" /> <None Include="Build\ApplicationData\Drumkits\Default\drumkit.xml" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\drum.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\drum.png" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\drumPressed.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\drumPressed.png" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\kick.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\kick.png" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\kickPressed.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\kickPressed.png" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\pedal.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\pedal.png" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\pedalPressed.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\pedalPressed.png" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\plate.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\plate.png" />
<None Include="Build\ApplicationData\Drumkits\Default\Images\platePressed.png" /> <None Include="Build\ApplicationData\Drumkits\Default\Images\platePressed.png" />
<None Include="Build\ApplicationData\Drumkits\Default\layout.xml" /> <None Include="Build\ApplicationData\Drumkits\Default\layout.xml" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\Crash05.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\Crash05.wav" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\Floor04.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\Floor04.wav" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\Hat04.WAV" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\Hat04.WAV" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\HiHatClosed04.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\HiHatClosed04.wav" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\HiHatOpen04.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\HiHatOpen04.wav" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\Kick07.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\Kick07.wav" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\Ride04.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\Ride04.wav" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\Snare08.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\Snare08.wav" />
<None Include="Build\ApplicationData\Drumkits\Default\Sounds\TomHigh04.wav" /> <None Include="Build\ApplicationData\Drumkits\Default\Sounds\TomHigh04.wav" />
<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" />
</ItemGroup> <None Include="packages.config" />
<ItemGroup> </ItemGroup>
<Content Include="Assets\bg.png" /> <ItemGroup>
<Content Include="Assets\Logos\BadgeIcon.png" /> <Content Include="Assets\bg.png" />
<Content Include="Assets\Logos\SplashScreen.scale-140.png" /> <Content Include="Assets\Logos\BadgeIcon.png" />
<Content Include="Assets\Logos\SplashScreen.scale-180.png" /> <Content Include="Assets\Logos\SplashScreen.scale-140.png" />
<Content Include="Assets\Logos\WideLogo.png" /> <Content Include="Assets\Logos\SplashScreen.scale-180.png" />
<Content Include="Assets\Logos\Logo.png" /> <Content Include="Assets\Logos\WideLogo.png" />
<Content Include="Assets\Logos\SmallLogo.png" /> <Content Include="Assets\Logos\Logo.png" />
<Content Include="Assets\Logos\SplashScreen.scale-100.png" /> <Content Include="Assets\Logos\SmallLogo.png" />
<Content Include="Assets\Logos\StoreLogo.png" /> <Content Include="Assets\Logos\SplashScreen.scale-100.png" />
<None Include="Package.StoreAssociation.xml" /> <Content Include="Assets\Logos\StoreLogo.png" />
</ItemGroup> <None Include="Package.StoreAssociation.xml" />
<ItemGroup> </ItemGroup>
<ApplicationDefinition Include="App.xaml"> <ItemGroup>
<Generator>MSBuild:Compile</Generator> <ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator>
</ApplicationDefinition> <SubType>Designer</SubType>
<Page Include="Common\StandardStyles.xaml"> </ApplicationDefinition>
<Generator>MSBuild:Compile</Generator> <Page Include="Common\StandardStyles.xaml">
<SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator>
</Page> <SubType>Designer</SubType>
<Page Include="Common\TextButtonStyles.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="Common\TextButtonStyles.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <Generator>MSBuild:Compile</Generator>
</Page> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Page Include="UI\DrumPlayUI.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\DrumPlayUI.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\DrumEditUI.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\DrumEditUI.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\EditorPage.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\EditorPage.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\Settings\LayoutsSettingsControl.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\Settings\LayoutsSettingsControl.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\Settings\ExperimentsSettingsControl.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\Settings\ExperimentsSettingsControl.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\CommonControls\FileControl.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\CommonControls\FileControl.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\Settings\DrumsSettingsControl.xaml"> </Page>
<Generator>MSBuild:Compile</Generator> <Page Include="UI\Settings\DrumsSettingsControl.xaml">
<SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator>
</Page> <SubType>Designer</SubType>
<Page Include="UI\Settings\DrumkitsSettingsControl.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\Settings\DrumkitsSettingsControl.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\Settings\GeneralSettingsControl.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\Settings\GeneralSettingsControl.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\SettingsPage.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\SettingsPage.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\LoadingPage.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\LoadingPage.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
<Page Include="UI\MainPage.xaml"> </Page>
<Generator>MSBuild:Compile</Generator> <Page Include="UI\MainPage.xaml">
<SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator>
</Page> <SubType>Designer</SubType>
<Page Include="UI\Settings\LogControl.xaml"> </Page>
<SubType>Designer</SubType> <Page Include="UI\Settings\LogControl.xaml">
<Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType>
</Page> <Generator>MSBuild:Compile</Generator>
</ItemGroup> </Page>
<ItemGroup> </ItemGroup>
<Reference Include="SharpDX, Version=2.4.2.0, Culture=neutral, PublicKeyToken=627a3d6d1956f55a, processorArchitecture=MSIL"> <ItemGroup>
<SpecificVersion>False</SpecificVersion> <ProjectReference Include="..\Tarball\Tarball.csproj">
<HintPath>..\..\..\..\WebDownloads\SharpDX242\Bin\Signed-winrt\SharpDX.dll</HintPath> <Project>{5cb567d7-572e-4bae-802f-7e3f62cddf64}</Project>
</Reference> <Name>Tarball</Name>
<Reference Include="SharpDX.XAudio2, Version=2.4.2.0, Culture=neutral, PublicKeyToken=627a3d6d1956f55a, processorArchitecture=MSIL"> </ProjectReference>
<SpecificVersion>False</SpecificVersion> </ItemGroup>
<HintPath>..\..\..\..\WebDownloads\SharpDX242\Bin\Signed-winrt\SharpDX.XAudio2.dll</HintPath> <ItemGroup>
</Reference> <WCFMetadata Include="Service References\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Tarball\Tarball.csproj"> <Reference Include="SharpDX">
<Project>{5cb567d7-572e-4bae-802f-7e3f62cddf64}</Project> <HintPath>..\packages\SharpDX.2.5.0\lib\win8\SharpDX.dll</HintPath>
<Name>Tarball</Name> </Reference>
</ProjectReference> <Reference Include="SharpDX.XAudio2">
</ItemGroup> <HintPath>..\packages\SharpDX.XAudio2.2.5.0\lib\win8\SharpDX.XAudio2.dll</HintPath>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' "> </Reference>
<VisualStudioVersion>11.0</VisualStudioVersion> </ItemGroup>
</PropertyGroup> <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> <VisualStudioVersion>11.0</VisualStudioVersion>
<PropertyGroup> </PropertyGroup>
<PreBuildEvent>"$(ProjectDir)\Build\7z.exe" a -ttar -y "$(ProjectDir)\Assets\ApplicationData.tar" "$(ProjectDir)\Build\ApplicationData\*"</PreBuildEvent> <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
</PropertyGroup> <PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <PreBuildEvent>"$(ProjectDir)\Build\7z.exe" a -ttar -y "$(ProjectDir)\Assets\ApplicationData.tar" "$(ProjectDir)\Build\ApplicationData\*"</PreBuildEvent>
Other similar extension points exist, see Microsoft.Common.targets. </PropertyGroup>
<Target Name="BeforeBuild"> <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
</Target> Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="AfterBuild"> <Target Name="BeforeBuild">
</Target> </Target>
--> <Target Name="AfterBuild">
</Target>
-->
</Project> </Project>

View File

@ -1,65 +1,88 @@
<UserControl <UserControl
x:Class="DrumKit.DrumPlayUI" x:Class="DrumKit.DrumPlayUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit" xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" mc:Ignorable="d"
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>
<VisualStateGroup x:Name="DrumGroups">
<VisualStateGroup x:Name="DrumGroups">
<VisualState x:Name="DrumNormal">
<VisualState x:Name="DrumNormal"> <Storyboard>
<Storyboard> <DoubleAnimation Storyboard.TargetName="imagePressed"
<DoubleAnimation Storyboard.TargetName="imagePressed" Storyboard.TargetProperty="Opacity"
Storyboard.TargetProperty="Opacity" BeginTime="0:0:0.1" Duration="0:0:0.7" To="0" >
BeginTime="0:0:0.1" Duration="0:0:0.7" To="0" > <DoubleAnimation.EasingFunction>
<DoubleAnimation.EasingFunction> <SineEase EasingMode="EaseInOut" />
<SineEase EasingMode="EaseInOut" /> </DoubleAnimation.EasingFunction>
</DoubleAnimation.EasingFunction> </DoubleAnimation>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image"
<DoubleAnimation Storyboard.TargetName="image" Storyboard.TargetProperty="Opacity"
Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" To="1" >
Duration="0:0:0.3" To="1" > <DoubleAnimation.EasingFunction>
<DoubleAnimation.EasingFunction> <SineEase EasingMode="EaseIn" />
<SineEase EasingMode="EaseIn" /> </DoubleAnimation.EasingFunction>
</DoubleAnimation.EasingFunction> </DoubleAnimation>
</DoubleAnimation> </Storyboard>
</Storyboard> </VisualState>
</VisualState>
<VisualState x:Name="DrumHit">
<VisualState x:Name="DrumHit"> <Storyboard>
<Storyboard> <DoubleAnimation Storyboard.TargetName="imagePressed"
<DoubleAnimation Storyboard.TargetName="imagePressed" Storyboard.TargetProperty="Opacity"
Storyboard.TargetProperty="Opacity" Duration="0" To="1" />
Duration="0" To="1" /> <DoubleAnimation Storyboard.TargetName="image"
<DoubleAnimation Storyboard.TargetName="image" Storyboard.TargetProperty="Opacity"
Storyboard.TargetProperty="Opacity" Duration="0" To=".3" />
Duration="0" To=".3" /> </Storyboard>
</Storyboard> </VisualState>
</VisualState>
</VisualStateGroup>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</VisualStateManager.VisualStateGroups>
<Image Name="image" IsHitTestVisible="False" <Grid Name="grid" Background="Transparent"
HorizontalAlignment="Stretch" PointerPressed="Grid_PointerPressed">
VerticalAlignment="Stretch" />
<Image Name="image" IsHitTestVisible="False"
<Image Name="imagePressed" IsHitTestVisible="False" HorizontalAlignment="Stretch"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
VerticalAlignment="Stretch"
Opacity="0" /> <Image Name="imagePressed" IsHitTestVisible="False"
HorizontalAlignment="Stretch"
</Grid> VerticalAlignment="Stretch"
</UserControl> 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>
</UserControl>

View File

@ -1,122 +1,162 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation; using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DrumKit namespace DrumKit
{ {
public sealed partial class DrumPlayUI : UserControl public sealed partial class DrumPlayUI : UserControl
{ {
#region Public events #region Public events
public event PointerEventHandler Hit; public event PointerEventHandler Hit;
#endregion #endregion
#region Properties #region Properties
/// <summary> /// <summary>
/// Gets or sets the rotation of the drum /// Gets or sets the rotation of the drum
/// </summary> /// </summary>
public double Angle public double Angle
{ {
get get
{ {
// Get rotated grid // Get rotated grid
var transform = grid.RenderTransform as RotateTransform; var transform = grid.RenderTransform as RotateTransform;
// Get angle // Get angle
if (transform != null) if (transform != null)
return transform.Angle; return transform.Angle;
// No rotation // No rotation
return 0; return 0;
} }
set set
{ {
// Set rotation transformation // Set rotation transformation
RotateTransform rot = new RotateTransform(); RotateTransform rot = new RotateTransform();
rot.CenterX = this.Width / 2; rot.CenterX = this.Width / 2;
rot.CenterY = this.Height / 2; rot.CenterY = this.Height / 2;
rot.Angle = value; rot.Angle = value;
grid.RenderTransform = rot; grid.RenderTransform = rot;
} }
} }
/// <summary> /// <summary>
/// Gets the drum id. /// Gets the drum id.
/// </summary> /// </summary>
public string DrumID { get; private set; } public string DrumID { get; private set; }
/// <summary> /// <summary>
/// Enables or disables the hit animation. /// Enables or disables the hit animation.
/// </summary> /// </summary>
private bool IsAnimationEnabled { private bool IsAnimationEnabled
get { {
return DataController.Settings.Animations; get
} {
} return DataController.Settings.Animations;
#endregion }
}
#region Constructor
/// <summary>
/// <summary> /// Sets the key string for display
/// Creates a new instance of DrumPlayUI /// </summary>
/// </summary> public string KeyString
/// <param name="drum"></param> {
public DrumPlayUI(Drum drum) set
{ {
// Initialize if (!String.IsNullOrEmpty(value))
this.InitializeComponent(); this.textKey.Text = String.Format("{0} [{1}]", DrumName, value);
// Set drum properties else this.textKey.Text = DrumName;
this.DrumID = drum.Id; }
// TODO: key }
this.image.Source = drum.LoadedImageSource;
this.imagePressed.Source = drum.LoadedImagePressedSource; /// <summary>
} /// Gets or sets a value indicating if the key is visible
/// </summary>
#endregion public bool IsKeyVisible
{
#region UI handlers get
/// <summary> {
/// Handles the drum pressed event. return this.textKey.Visibility == Windows.UI.Xaml.Visibility.Visible;
/// </summary> }
private void Grid_PointerPressed(object sender, PointerRoutedEventArgs e) set
{ {
// Call hit event immediately this.textKey.Visibility = (value) ? Visibility.Visible : Visibility.Collapsed;
if (this.Hit != null) this.textKeyShadow.Visibility = (value) ? Visibility.Visible : Visibility.Collapsed;
this.Hit(this, e); }
}
// Play animation
this.PerformHit();
} /// <summary>
/// Gets or sets the drum name
#endregion /// </summary>
private string DrumName { get; set; }
#region Misc
#endregion
public void PerformHit()
{ #region Constructor
// Play animation
if (this.IsAnimationEnabled) /// <summary>
{ /// Creates a new instance of DrumPlayUI
VisualStateManager.GoToState(this, "DrumHit", true); /// </summary>
VisualStateManager.GoToState(this, "DrumNormal", true); /// <param name="drum"></param>
} public DrumPlayUI(Drum drum)
} {
// Initialize
#endregion this.InitializeComponent();
}
} // Set drum properties
this.DrumID = drum.Id;
this.DrumName = drum.Name;
this.KeyString = null;
this.image.Source = drum.LoadedImageSource;
this.imagePressed.Source = drum.LoadedImagePressedSource;
}
#endregion
#region UI handlers
/// <summary>
/// Handles the drum pressed event.
/// </summary>
private void Grid_PointerPressed(object sender, PointerRoutedEventArgs e)
{
// Call hit event immediately
if (this.Hit != null)
this.Hit(this, e);
// Play animation
this.PerformHit();
}
#endregion
#region Misc
public void PerformHit()
{
// Play animation
if (this.IsAnimationEnabled)
{
VisualStateManager.GoToState(this, "DrumHit", true);
VisualStateManager.GoToState(this, "DrumNormal", true);
}
}
#endregion
}
}

View File

@ -1,97 +1,104 @@
<Page <Page
x:Class="DrumKit.MainPage" x:Class="DrumKit.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit" xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ImageBrush x:Key="MainpageBackgroundBrush" ImageSource="ms-appx:///Assets/bg.png" Stretch="UniformToFill" /> <ImageBrush x:Key="MainpageBackgroundBrush" ImageSource="ms-appx:///Assets/bg.png" Stretch="UniformToFill" />
</Page.Resources> </Page.Resources>
<Grid <Grid
Background="{StaticResource MainpageBackgroundBrush}"> Background="{StaticResource MainpageBackgroundBrush}">
<Canvas Name="canvas" /> <Canvas Name="canvas" />
<!--<Grid Visibility="Collapsed"> <!--<Grid Visibility="Collapsed">
<Border Margin="7" <Border Margin="7"
CornerRadius="10" CornerRadius="10"
BorderBrush="Red" BorderBrush="Red"
BorderThickness="5" /> BorderThickness="5" />
<Canvas Name="recCanvas"> <Canvas Name="recCanvas">
<Ellipse Width="18" Height="18" Fill="Red" <Ellipse Width="18" Height="18" Fill="Red"
Canvas.Left="20" Canvas.Left="20"
Canvas.Top="20"/> Canvas.Top="20"/>
<TextBlock <TextBlock
FontFamily="Consolas" FontFamily="Consolas"
FontSize="16" FontSize="16"
Foreground="Red" Foreground="Red"
Canvas.Left="42" Canvas.Left="42"
Canvas.Top="19">REC Canvas.Top="19">REC
</TextBlock> </TextBlock>
<Canvas.Triggers> <Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded"> <EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard> <BeginStoryboard>
<Storyboard RepeatBehavior="Forever" > <Storyboard RepeatBehavior="Forever" >
<DoubleAnimation <DoubleAnimation
Storyboard.TargetName="recCanvas" Storyboard.TargetName="recCanvas"
Storyboard.TargetProperty="Opacity" Storyboard.TargetProperty="Opacity"
Duration="0:0:1" BeginTime="0:0:1" From="1" To="0.1" /> Duration="0:0:1" BeginTime="0:0:1" From="1" To="0.1" />
</Storyboard> </Storyboard>
</BeginStoryboard> </BeginStoryboard>
</EventTrigger> </EventTrigger>
</Canvas.Triggers> </Canvas.Triggers>
</Canvas> </Canvas>
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Top"> VerticalAlignment="Top">
<Button>Record</Button> <Button>Record</Button>
<Button>Stop</Button> <Button>Stop</Button>
</StackPanel> </StackPanel>
</Grid>--> </Grid>-->
</Grid> </Grid>
<Page.BottomAppBar> <Page.BottomAppBar>
<AppBar> <AppBar>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal"> <StackPanel Grid.Column="0" Orientation="Horizontal">
<ToggleButton <ToggleButton
Name="buttonAnimations" Name="buttonAnimations"
Click="buttonAnimations_Click" Click="buttonAnimations_Click"
AutomationProperties.Name="Animations" AutomationProperties.Name="Animations"
IsChecked="True" IsChecked="True"
Style="{StaticResource VideoAppBarButtonStyle}" /> Style="{StaticResource VideoAppBarButtonStyle}" />
<Button <Button
Name="buttonEditMode" Name="buttonEditMode"
Click="ButtonEditMode_Click" Click="ButtonEditMode_Click"
Style="{StaticResource EditAppBarButtonStyle}" /> Style="{StaticResource EditAppBarButtonStyle}" />
</StackPanel> <ToggleButton
Name="buttonKeys"
<StackPanel Grid.Column="1" Orientation="Horizontal" > Click="buttonKeys_Click"
<Button AutomationProperties.Name="Show keys"
Name="buttonSettings" IsChecked="True"
Click="ButtonSettings_Click" Style="{StaticResource KeyboardAppBarButtonStyle}" />
AutomationProperties.Name="Settings"
Style="{StaticResource SettingsAppBarButtonStyle}" /> </StackPanel>
</StackPanel>
</Grid> <StackPanel Grid.Column="1" Orientation="Horizontal" >
</AppBar> <Button
</Page.BottomAppBar> Name="buttonSettings"
</Page> Click="ButtonSettings_Click"
AutomationProperties.Name="Settings"
Style="{StaticResource SettingsAppBarButtonStyle}" />
</StackPanel>
</Grid>
</AppBar>
</Page.BottomAppBar>
</Page>

View File

@ -1,350 +1,389 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.Storage; using Windows.Storage;
using Windows.System; using Windows.System;
using Windows.UI.ApplicationSettings; using Windows.UI.ApplicationSettings;
using Windows.UI.ViewManagement; using Windows.UI.ViewManagement;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation; using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace DrumKit namespace DrumKit
{ {
/// <summary> /// <summary>
/// An empty page that can be used on its own or navigated to within a Frame. /// An empty page that can be used on its own or navigated to within a Frame.
/// </summary> /// </summary>
public sealed partial class MainPage : Page public sealed partial class MainPage : Page
{ {
#region Fields: Private members #region Fields: Private members
private Dictionary<string, DrumPlayUI> DrumUIs { get; set; } private Dictionary<string, DrumPlayUI> DrumUIs { get; set; }
private Dictionary<VirtualKey, string> Keymap { get; set; } private Dictionary<VirtualKey, string> Keymap { get; set; }
private int CurrentLayout { get; set; } private int CurrentLayout { get; set; }
#endregion #endregion
#region Initialization #region Initialization
/// <summary> /// <summary>
/// Creates a new instance of MainPage. /// Creates a new instance of MainPage.
/// </summary> /// </summary>
public MainPage() public MainPage()
{ {
// Create private members // Create private members
this.DrumUIs = new Dictionary<string, DrumPlayUI>(); this.DrumUIs = new Dictionary<string, DrumPlayUI>();
this.Keymap = new Dictionary<VirtualKey, string>(); this.Keymap = new Dictionary<VirtualKey, string>();
CurrentLayout = 0; CurrentLayout = 0;
// Initialize page // Initialize page
this.InitializeComponent(); this.InitializeComponent();
this.SizeChanged += MainPage_SizeChanged; this.SizeChanged += MainPage_SizeChanged;
this.Loaded += MainPage_Loaded; this.Loaded += MainPage_Loaded;
SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested; SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
// Initialize drums // Initialize drums
this.InitializeDrums(); this.InitializeDrums();
} }
/// <summary> /// <summary>
/// Sets up a single drum /// Sets up a single drum
/// </summary> /// </summary>
/// <param name="drum">The drum.</param> /// <param name="drum">The drum.</param>
private void InitializeDrum(Drum drum) private void InitializeDrum(Drum drum)
{ {
// Create object // Create object
DrumPlayUI d = new DrumPlayUI(drum); DrumPlayUI d = new DrumPlayUI(drum);
// Set up callbacks // Set up callbacks
d.Hit += HandlerDrumPointerPressed; d.Hit += HandlerDrumPointerPressed;
// Add to lists // Add to lists
canvas.Children.Add(d); canvas.Children.Add(d);
this.DrumUIs.Add(drum.Id, d); this.DrumUIs.Add(drum.Id, d);
} }
/// <summary> /// <summary>
/// Sets up the drums. /// Sets up the drums.
/// </summary> /// </summary>
private void InitializeDrums() private void InitializeDrums()
{ {
// 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();
// Load drum configurations }
foreach (var i in DataController.CurrentConfig.DrumsList)
{ /// <summary>
// Unload if disabled /// Sets up the drum configurations
if (!i.IsEnabled) /// </summary>
{ private void UpdateDrumConfig()
canvas.Children.Remove(this.DrumUIs[i.TargetId]); {
this.DrumUIs.Remove(i.TargetId); this.Keymap.Clear();
}
// Load drum configurations
// Keyboard mapping foreach (var i in DataController.CurrentConfig.DrumsList)
if (!Keymap.ContainsKey(i.Key)) {
Keymap.Add(i.Key, i.TargetId); // Unload if disabled
} if (!i.IsEnabled)
} {
canvas.Children.Remove(this.DrumUIs[i.TargetId]);
#endregion this.DrumUIs.Remove(i.TargetId);
}
#region UI: Settings charm
/// <summary> else
/// Triggered when the settings pane requests commands/ {
/// </summary> // Set drum key
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) this.DrumUIs[i.TargetId].KeyString = UIHelper.GetPrettifiedVKeyName(i.Key);
{ this.DrumUIs[i.TargetId].IsKeyVisible = DataController.Settings.ShowKeyBindings;
args.Request.ApplicationCommands.Clear();
SettingsCommand general = new SettingsCommand("general", "General", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand)); // Keyboard mapping
SettingsCommand drumkits = new SettingsCommand("drumkits", "Manage drumkits", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand)); if (!Keymap.ContainsKey(i.Key))
SettingsCommand drums = new SettingsCommand("drums", "Manage drums", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand)); Keymap.Add(i.Key, i.TargetId);
SettingsCommand layouts = new SettingsCommand("layouts", "Layouts", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand)); }
}
args.Request.ApplicationCommands.Add(general); }
args.Request.ApplicationCommands.Add(drumkits);
args.Request.ApplicationCommands.Add(drums); #endregion
args.Request.ApplicationCommands.Add(layouts);
} #region UI: Settings charm
/// <summary>
/// <summary> /// Triggered when the settings pane requests commands/
/// Handles the settings charms /// </summary>
/// </summary> void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
void MainPage_SettingsCommand(Windows.UI.Popups.IUICommand command) {
{ args.Request.ApplicationCommands.Clear();
Frame.Navigate(typeof(SettingsPage), command.Id); SettingsCommand general = new SettingsCommand("general", "General", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand));
} SettingsCommand drumkits = new SettingsCommand("drumkits", "Manage drumkits", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand));
SettingsCommand drums = new SettingsCommand("drums", "Manage drums", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand));
#endregion SettingsCommand layouts = new SettingsCommand("layouts", "Layouts", new Windows.UI.Popups.UICommandInvokedHandler(MainPage_SettingsCommand));
#region Layouts args.Request.ApplicationCommands.Add(general);
args.Request.ApplicationCommands.Add(drumkits);
/// <summary> args.Request.ApplicationCommands.Add(drums);
/// Figures out which is the best layout available, and uses it. args.Request.ApplicationCommands.Add(layouts);
/// </summary> }
private int PickBestLayout()
{ /// <summary>
// Smaller index is better /// Handles the settings charms
int[] picks = {-1, -1, -1, -1, -1, -1}; /// </summary>
void MainPage_SettingsCommand(Windows.UI.Popups.IUICommand command)
// Get current layout {
var view = UIHelper.ToDrumkitLayoutView(Windows.UI.ViewManagement.ApplicationView.Value); Frame.Navigate(typeof(SettingsPage), command.Id);
}
// Find best option
for (int index = 0; index < DataController.CurrentLayouts.Items.Count; index++ ) #endregion
{
var i = DataController.CurrentLayouts.Items[index]; #region Layouts
bool isSame = (i.TargetView == view); /// <summary>
bool contains = (i.TargetView & view) > 0; /// Figures out which is the best layout available, and uses it.
bool all = i.TargetView == DrumkitLayoutTargetView.All; /// </summary>
private int PickBestLayout()
if (i.IsDefault) {
{ // Smaller index is better
if (isSame) picks[0] = index; int[] picks = {-1, -1, -1, -1, -1, -1};
if (contains) picks[1] = index;
if (all) picks[2] = index; // Get current layout
} var view = UIHelper.ToDrumkitLayoutView(Windows.UI.ViewManagement.ApplicationView.Value);
else // Find best option
{ for (int index = 0; index < DataController.CurrentLayouts.Items.Count; index++ )
if (isSame) picks[3] = index; {
if (contains) picks[4] = index; var i = DataController.CurrentLayouts.Items[index];
if (all) picks[5] = index;
} bool isSame = (i.TargetView == view);
} bool contains = (i.TargetView & view) > 0;
bool all = i.TargetView == DrumkitLayoutTargetView.All;
// Return first value different than -1, or 0
foreach (var i in picks) if (i.IsDefault)
if (i != -1) return i; {
if (isSame) picks[0] = index;
return 0; if (contains) picks[1] = index;
} if (all) picks[2] = index;
}
/// <summary>
/// Sets up the layout else
/// </summary> {
private void ReloadLayout() if (isSame) picks[3] = index;
{ if (contains) picks[4] = index;
// Get current size if (all) picks[5] = index;
double w = canvas.ActualWidth; }
double h = canvas.ActualHeight; }
if (double.IsNaN(w) || double.IsNaN(h) || double.IsInfinity(w) || double.IsInfinity(h)) // Return first value different than -1, or 0
return; foreach (var i in picks)
if (i != -1) return i;
// Pick a layout
this.CurrentLayout = PickBestLayout(); return 0;
}
Log.Write("Layout change: picked_layout={0}, w={1}, h={2}", this.CurrentLayout, w, h);
/// <summary>
// Apply layout /// Sets up the layout
foreach (var i in DataController.CurrentLayouts.Items[CurrentLayout].Drums) /// </summary>
{ private void ReloadLayout()
if (!DrumUIs.ContainsKey(i.Key)) {
continue; // Get current size
double w = canvas.ActualWidth;
// Set angle double h = canvas.ActualHeight;
DrumUIs[i.Key].Angle = i.Value.Angle;
if (double.IsNaN(w) || double.IsNaN(h) || double.IsInfinity(w) || double.IsInfinity(h))
// Set scale return;
DrumUIs[i.Key].Width = i.Value.Size * w;
DrumUIs[i.Key].Height = i.Value.Size * w; // Pick a layout
this.CurrentLayout = PickBestLayout();
// Set position
Canvas.SetLeft(DrumUIs[i.Key], w * i.Value.X); Log.Write("Layout change: picked_layout={0}, w={1}, h={2}", this.CurrentLayout, w, h);
Canvas.SetTop(DrumUIs[i.Key], h * i.Value.Y);
} // Apply layout
} foreach (var i in DataController.CurrentLayouts.Items[CurrentLayout].Drums)
{
#endregion if (!DrumUIs.ContainsKey(i.Key))
continue;
#region UI: Drums
/// <summary> // Set angle
/// Handles drum hit using mouse/finger DrumUIs[i.Key].Angle = i.Value.Angle;
/// </summary>
void HandlerDrumPointerPressed(object sender, PointerRoutedEventArgs e) // Set scale
{ DrumUIs[i.Key].Width = i.Value.Size * w;
var button = sender as DrumPlayUI; DrumUIs[i.Key].Height = i.Value.Size * w;
if (button != null) // Set position
this.HandlerDrumClickedCommon(button.DrumID); Canvas.SetLeft(DrumUIs[i.Key], w * i.Value.X);
} Canvas.SetTop(DrumUIs[i.Key], h * i.Value.Y);
}
/// <summary> }
/// Handles drum hit using keyboard
/// </summary> #endregion
public void HandlerKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
{ #region UI: Drums
string drum; /// <summary>
/// Handles drum hit using mouse/finger
// Key repeat or something /// </summary>
if (args.KeyStatus.WasKeyDown) void HandlerDrumPointerPressed(object sender, PointerRoutedEventArgs e)
return; {
var button = sender as DrumPlayUI;
// If key in key map, perform "click"
if (this.Keymap.TryGetValue(args.VirtualKey, out drum)) if (button != null)
HandlerDrumClickedCommon(drum); this.HandlerDrumClickedCommon(button.DrumID);
} }
/// <summary> /// <summary>
/// Handles drum hit. /// Handles drum hit using keyboard
/// </summary> /// </summary>
private void HandlerDrumClickedCommon(string drum_id) public void HandlerKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
{ {
try string drum;
{
DataController.PlaySound(drum_id, 0); // Key repeat or something
if (args.KeyStatus.WasKeyDown)
if (DataController.Settings.Animations) return;
this.DrumUIs[drum_id].PerformHit();
} // If key in key map, perform "click"
if (this.Keymap.TryGetValue(args.VirtualKey, out drum))
catch (Exception ex) HandlerDrumClickedCommon(drum);
{ }
Log.Error("Error at playback!!! Drum id: {0}", drum_id);
Log.Except(ex); /// <summary>
} /// Handles drum hit.
} /// </summary>
private void HandlerDrumClickedCommon(string drum_id)
#endregion {
try
#region UI: Page events {
/// <summary> DataController.PlaySound(drum_id, 0);
/// Handles page size change event.
/// </summary> if (DataController.Settings.Animations)
void MainPage_SizeChanged(object sender, SizeChangedEventArgs e) this.DrumUIs[drum_id].PerformHit();
{ }
this.ReloadLayout();
this.ReloadLayout(); catch (Exception ex)
} {
Log.Error("Error at playback!!! Drum id: {0}", drum_id);
/// <summary> Log.Except(ex);
/// Handles page load event. }
/// </summary> }
void MainPage_Loaded(object sender, RoutedEventArgs e)
{ #endregion
// Set layout
this.ReloadLayout(); #region UI: Page events
/// <summary>
// Set toggles /// Handles page size change event.
buttonAnimations.IsChecked = DataController.Settings.Animations; /// </summary>
} void MainPage_SizeChanged(object sender, SizeChangedEventArgs e)
{
/// <summary> this.ReloadLayout();
/// Invoked when this page is about to be displayed in a Frame. this.ReloadLayout();
/// </summary> }
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param> /// <summary>
protected override void OnNavigatedTo(NavigationEventArgs e) /// Handles page load event.
{ /// </summary>
Log.Write("Navigated to main page."); void MainPage_Loaded(object sender, RoutedEventArgs e)
{
Window.Current.CoreWindow.KeyDown += this.HandlerKeyDown; // Set layout
} this.ReloadLayout();
/// <summary> // Set toggles
/// Invoked when the page is about to be destroyed. buttonAnimations.IsChecked = DataController.Settings.Animations;
/// </summary> buttonKeys.IsChecked = DataController.Settings.ShowKeyBindings;
protected override void OnNavigatedFrom(NavigationEventArgs e) }
{
Window.Current.CoreWindow.KeyDown -= this.HandlerKeyDown; /// <summary>
} /// Invoked when this page is about to be displayed in a Frame.
/// </summary>
#endregion /// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
#region UI: Buttons protected override void OnNavigatedTo(NavigationEventArgs e)
/// <summary> {
/// Handles the edit button, going into the editor. Log.Write("Navigated to main page.");
/// </summary>
private void ButtonEditMode_Click(object sender, RoutedEventArgs e) Window.Current.CoreWindow.KeyDown += this.HandlerKeyDown;
{ }
Frame.Navigate(typeof(EditorPage), DataController.CurrentLayouts.Items[CurrentLayout]);
} /// <summary>
/// Invoked when the page is about to be destroyed.
/// <summary> /// </summary>
/// Handles the animations enabled toggle button. protected override void OnNavigatedFrom(NavigationEventArgs e)
/// </summary> {
private void buttonAnimations_Click(object sender, RoutedEventArgs e) Window.Current.CoreWindow.KeyDown -= this.HandlerKeyDown;
{ }
var button = sender as ToggleButton;
if (button == null) return; #endregion
bool isChecked = (button.IsChecked.HasValue && button.IsChecked.Value); #region UI: Buttons
/// <summary>
// Fix togglebuton style bug /// Handles the edit button, going into the editor.
VisualStateManager.GoToState(button, isChecked ? "Checked" : "Unchecked", false); /// </summary>
private void ButtonEditMode_Click(object sender, RoutedEventArgs e)
// Change animation setting {
DataController.Settings.Animations = isChecked; Frame.Navigate(typeof(EditorPage), DataController.CurrentLayouts.Items[CurrentLayout]);
}
// Save modified setting
DataController.SaveSettings(); /// <summary>
} /// Handles the animations enabled toggle button.
/// </summary>
/// <summary> private void buttonAnimations_Click(object sender, RoutedEventArgs e)
/// Goes to application settings. {
/// </summary> var button = sender as ToggleButton;
private void ButtonSettings_Click(object sender, RoutedEventArgs e) if (button == null) return;
{
Frame.Navigate(typeof(SettingsPage), this); bool isChecked = (button.IsChecked.HasValue && button.IsChecked.Value);
}
// Fix togglebuton style bug
#endregion VisualStateManager.GoToState(button, isChecked ? "Checked" : "Unchecked", false);
} // Change animation setting
} DataController.Settings.Animations = isChecked;
// Save modified setting
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>
/// Goes to application settings.
/// </summary>
private void ButtonSettings_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(SettingsPage), this);
}
#endregion
}
}

View File

@ -1,164 +1,164 @@
<UserControl <UserControl
x:Class="DrumKit.DrumsSettingsControl" x:Class="DrumKit.DrumsSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit" xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="400" d:DesignHeight="400"
d:DesignWidth="400"> d:DesignWidth="400">
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Common/TextButtonStyles.xaml" /> <ResourceDictionary Source="/Common/TextButtonStyles.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="DrumsListDataTemplate"> <DataTemplate x:Key="DrumsListDataTemplate">
<Grid Name="theGrid" <Grid Name="theGrid"
MinWidth="380"> MinWidth="380">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Left thing --> <!-- Left thing -->
<Border Name="yellowBorder" <Border Name="yellowBorder"
Grid.Column="0" Grid.RowSpan="3" Grid.Column="0" Grid.RowSpan="3"
Background="Yellow" Width="10" /> Background="Yellow" Width="10" />
<!-- Thumbnail --> <!-- Thumbnail -->
<Image Grid.Row="0" Grid.RowSpan="2" <Image Grid.Row="0" Grid.RowSpan="2"
Grid.Column="2" Grid.Column="2"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Width="60" Height="60" Width="60" Height="60"
Source="{Binding LoadedImageSource}" Source="{Binding LoadedImageSource}"
Stretch="Uniform" /> Stretch="Uniform" />
<!-- Name --> <!-- Name -->
<TextBox Grid.Column="1" Grid.Row="0" Margin="15,2,15,0" <TextBox Grid.Column="1" Grid.Row="0" Margin="15,2,15,0"
FontSize="15.3" FontSize="15.3"
Style="{StaticResource MyTextBoxStyle}" Style="{StaticResource MyTextBoxStyle}"
Text="{Binding Name}" Text="{Binding Name}"
IsReadOnly="True" /> IsReadOnly="True" />
<!-- Configuration --> <!-- Configuration -->
<Grid <Grid
Grid.Column="1" Grid.Row="1" Margin="15,0,15,2"> Grid.Column="1" Grid.Row="1" Margin="15,0,15,2">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<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
Grid.Column="1" Grid.Column="1"
Style="{StaticResource TitleTextStyle}" Style="{StaticResource TitleTextStyle}"
Text="Key:" /> Text="Key:" />
<TextBox <TextBox
Grid.Column="2" Grid.Column="2"
Name="textKey" Name="textKey"
Style="{StaticResource MyTextBoxStyle}" Style="{StaticResource MyTextBoxStyle}"
KeyUp="TextKey_KeyUp" /> KeyUp="TextKey_KeyUp" />
</Grid> </Grid>
<Grid Grid.Column="1" Grid.Row="2" Margin="15,2,15,0"> <Grid Grid.Column="1" Grid.Row="2" Margin="15,2,15,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
Style="{StaticResource TitleTextStyle}" Style="{StaticResource TitleTextStyle}"
Text="Volume left:" /> Text="Volume left:" />
<Slider Name="sliderVolumeL" <Slider Name="sliderVolumeL"
Grid.Column="1" Grid.Column="1"
Margin="5,-8,5,0" Margin="5,-8,5,0"
Height="34" Height="34"
Minimum="0" Maximum="1" Minimum="0" Maximum="1"
StepFrequency=".01" StepFrequency=".01"
ValueChanged="sliderVolumeL_ValueChanged"/> ValueChanged="sliderVolumeL_ValueChanged"/>
<TextBlock <TextBlock
Margin="10,0,0,0" Margin="10,0,0,0"
Grid.Column="2" Grid.Column="2"
Style="{StaticResource TitleTextStyle}" Style="{StaticResource TitleTextStyle}"
Text="Right:" /> Text="Right:" />
<Slider Name="sliderVolumeR" <Slider Name="sliderVolumeR"
Grid.Column="3" Grid.Column="3"
Margin="5,-8,5,0" Margin="5,-8,5,0"
Height="34" Height="34"
Minimum="0" Maximum="1" Minimum="0" Maximum="1"
StepFrequency=".01" StepFrequency=".01"
ValueChanged="sliderVolumeR_ValueChanged" /> ValueChanged="sliderVolumeR_ValueChanged" />
</Grid> </Grid>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
<Style x:Key="GridViewStretchItemStyle" TargetType="GridViewItem"> <Style x:Key="GridViewStretchItemStyle" TargetType="GridViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Drums list --> <!-- Drums list -->
<GridView Name="listDrums" <GridView Name="listDrums"
Grid.Row="0" Grid.Column="0" Grid.Row="0" Grid.Column="0"
ItemTemplate="{StaticResource DrumsListDataTemplate}" ItemTemplate="{StaticResource DrumsListDataTemplate}"
ItemContainerStyle="{StaticResource GridViewStretchItemStyle}" ItemContainerStyle="{StaticResource GridViewStretchItemStyle}"
SelectionMode="Single" > SelectionMode="Single" >
<local:Drum ImageSource="/Assets/bg.png" Id="adda" Name="Hello world!" /> <local:Drum ImageSource="/Assets/bg.png" Id="adda" Name="Hello world!" />
</GridView> </GridView>
<!-- Buttons --> <!-- Buttons -->
<!--<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal"> <!--<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonCreate_Click">Create</Button> <Button Style="{StaticResource MyButtonStyle}" Click="ButtonCreate_Click">Create</Button>
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonDelete_Click">Delete</Button> <Button Style="{StaticResource MyButtonStyle}" Click="ButtonDelete_Click">Delete</Button>
</StackPanel>--> </StackPanel>-->
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -1,236 +1,221 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.System; using Windows.System;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation; using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DrumKit namespace DrumKit
{ {
public sealed partial class DrumsSettingsControl : UserControl public sealed partial class DrumsSettingsControl : UserControl
{ {
#region Initialization #region Initialization
/// <summary> /// <summary>
/// Creates a new instance of DrumsSettingsControl /// Creates a new instance of DrumsSettingsControl
/// </summary> /// </summary>
public DrumsSettingsControl() public DrumsSettingsControl()
{ {
this.InitializeComponent(); this.InitializeComponent();
this.Loaded += DrumsSettingsControl_Loaded; this.Loaded += DrumsSettingsControl_Loaded;
} }
/// <summary> /// <summary>
/// Loads drum list at startup /// Loads drum list at startup
/// </summary> /// </summary>
void DrumsSettingsControl_Loaded(object sender, RoutedEventArgs e) void DrumsSettingsControl_Loaded(object sender, RoutedEventArgs e)
{ {
ReloadDrums(); ReloadDrums();
} }
#endregion #endregion
#region Reloads the list of drums #region Reloads the list of drums
/// <summary> /// <summary>
/// Reloads the list of drums /// Reloads the list of drums
/// </summary> /// </summary>
async void ReloadDrums() async void ReloadDrums()
{ {
// Clear previous stuff // Clear previous stuff
listDrums.Items.Clear(); listDrums.Items.Clear();
// Add new stuff // Add new stuff
foreach (var i in DataController.CurrentDrumkit.Drums) foreach (var i in DataController.CurrentDrumkit.Drums)
this.listDrums.Items.Add(i.Value); this.listDrums.Items.Add(i.Value);
// Wait for containers to be generated // Wait for containers to be generated
await System.Threading.Tasks.Task.Delay(50); await System.Threading.Tasks.Task.Delay(50);
// Update visual stuff // Update visual stuff
DrumConfig config = null; DrumConfig config = null;
foreach (var i in this.listDrums.Items) foreach (var i in this.listDrums.Items)
{ {
// Get drum and configuration // Get drum and configuration
var drum = i as Drum; var drum = i as Drum;
if (drum != null) if (drum != null)
DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config); DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config);
// No drum, no configuration? // No drum, no configuration?
if (drum == null || config == null) if (drum == null || config == null)
continue; continue;
// Set up other properties // Set up other properties
var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement; var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement;
ToggleButton enabled = UIHelper.FindChildByName(container, "toggleEnabled") as ToggleButton; ToggleButton enabled = UIHelper.FindChildByName(container, "toggleEnabled") as ToggleButton;
if (enabled != null) enabled.IsChecked = config.IsEnabled; if (enabled != null) enabled.IsChecked = config.IsEnabled;
Slider volumeL = UIHelper.FindChildByName(container, "sliderVolumeL") as Slider; Slider volumeL = UIHelper.FindChildByName(container, "sliderVolumeL") as Slider;
if (volumeL != null) volumeL.Value = config.VolumeL; if (volumeL != null) volumeL.Value = config.VolumeL;
Slider volumeR = UIHelper.FindChildByName(container, "sliderVolumeR") as Slider; Slider volumeR = UIHelper.FindChildByName(container, "sliderVolumeR") as Slider;
if (volumeR != null) volumeR.Value = config.VolumeR; if (volumeR != null) volumeR.Value = config.VolumeR;
} }
ReloadKeys(); ReloadKeys();
} }
void ReloadKeys() void ReloadKeys()
{ {
DrumConfig config = null; DrumConfig config = null;
foreach (var i in this.listDrums.Items) foreach (var i in this.listDrums.Items)
{ {
// Get drum and configuration // Get drum and configuration
var drum = i as Drum; var drum = i as Drum;
if (drum != null) if (drum != null)
DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config); DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config);
// No drum, no configuration? // No drum, no configuration?
if (drum == null || config == null) if (drum == null || config == null)
continue; continue;
// Set up key // Set up key
var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement; var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement;
TextBox key = UIHelper.FindChildByName(container, "textKey") as TextBox; TextBox key = UIHelper.FindChildByName(container, "textKey") as TextBox;
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 #endregion
if (text.StartsWith("Number"))
text = text.Substring("Number".Length); #region UI Handlers: Items
text = System.Text.RegularExpressions.Regex.Replace(text, "([a-z])([A-Z])", "${1} ${2}"); /// <summary>
/// Handles "Landscape" toggle button.
// Set the text /// </summary>
key.Text = text; private void ToggleEnabled_Click(object sender, RoutedEventArgs e)
} {
// Get drum object
else key.Text = string.Format("Unnamed ({0})", (int)config.Key); var button = sender as ToggleButton;
} var drum = (sender as FrameworkElement).DataContext as Drum;
}
} // Change enabled property
if (drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
#endregion {
DataController.CurrentConfig.Drums[drum.Id].IsEnabled = button.IsChecked.HasValue && button.IsChecked.Value;
#region UI Handlers: Items
DataController.SaveConfig();
/// <summary> }
/// Handles "Landscape" toggle button. }
/// </summary>
private void ToggleEnabled_Click(object sender, RoutedEventArgs e) /// <summary>
{ /// Handles the "key press" event in the textbox
// Get drum object /// </summary>
var button = sender as ToggleButton; /// <param name="sender"></param>
var drum = (sender as FrameworkElement).DataContext as Drum; /// <param name="e"></param>
private void TextKey_KeyUp(object sender, KeyRoutedEventArgs e)
// Change enabled property {
if (drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id)) // Get drum object
{ var text = sender as TextBox;
DataController.CurrentConfig.Drums[drum.Id].IsEnabled = button.IsChecked.HasValue && button.IsChecked.Value; var drum = (sender as FrameworkElement).DataContext as Drum;
DataController.SaveConfig(); // Set key
} if (text != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
} {
// Remove duplicates
/// <summary> RemoveKeys(e.Key, drum.Id);
/// Handles the "key press" event in the textbox
/// </summary> // Set key
/// <param name="sender"></param> DataController.CurrentConfig.Drums[drum.Id].Key = e.Key;
/// <param name="e"></param>
private void TextKey_KeyUp(object sender, KeyRoutedEventArgs e) // Display
{ ReloadKeys();
// Get drum object
var text = sender as TextBox; // Save
var drum = (sender as FrameworkElement).DataContext as Drum; DataController.SaveConfig();
}
// Set key }
if (text != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
{ private void sliderVolumeL_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
// Remove duplicates {
RemoveKeys(e.Key, drum.Id); // Get drum object
var slider = sender as Slider;
// Set key var drum = (sender as FrameworkElement).DataContext as Drum;
DataController.CurrentConfig.Drums[drum.Id].Key = e.Key;
// Set value
// Display if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
ReloadKeys(); {
DataController.CurrentConfig.Drums[drum.Id].VolumeL = e.NewValue;
// Save DataController.SaveConfig();
DataController.SaveConfig(); }
} }
}
private void sliderVolumeR_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
private void sliderVolumeL_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) {
{ // Get drum object
// Get drum object var slider = sender as Slider;
var slider = sender as Slider; var drum = (sender as FrameworkElement).DataContext as Drum;
var drum = (sender as FrameworkElement).DataContext as Drum;
// Set value
// Set value if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id)) {
{ DataController.CurrentConfig.Drums[drum.Id].VolumeR = e.NewValue;
DataController.CurrentConfig.Drums[drum.Id].VolumeL = e.NewValue; DataController.SaveConfig();
DataController.SaveConfig(); }
} }
}
#endregion
private void sliderVolumeR_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{ #region Misc
// Get drum object /// <summary>
var slider = sender as Slider; /// Sets the keyboart shortcut to None for all the drums that have this key.
var drum = (sender as FrameworkElement).DataContext as Drum; /// </summary>
/// <param name="key">The keyboard shortcut</param>
// Set value private void RemoveKeys(VirtualKey key, string exception_id=null)
if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id)) {
{ // See if any other drum has the same key
DataController.CurrentConfig.Drums[drum.Id].VolumeR = e.NewValue; foreach (var i in DataController.CurrentConfig.Drums)
DataController.SaveConfig(); if (i.Value.Key == key && i.Key != exception_id)
} {
} // Set to none
i.Value.Key = VirtualKey.None;
#endregion
// Get drum
#region Misc var drum = DataController.CurrentDrumkit.Drums[i.Key];
/// <summary>
/// Sets the keyboart shortcut to None for all the drums that have this key. // Get key text box
/// </summary> var container = listDrums.ItemContainerGenerator.ContainerFromItem(drum) as FrameworkElement;
/// <param name="key">The keyboard shortcut</param> TextBox keytxt = UIHelper.FindChildByName(container, "textKey") as TextBox;
private void RemoveKeys(VirtualKey key, string exception_id=null) keytxt.Text = Enum.GetName(typeof(VirtualKey), i.Value.Key);
{ }
// See if any other drum has the same key }
foreach (var i in DataController.CurrentConfig.Drums)
if (i.Value.Key == key && i.Key != exception_id) #endregion
{
// Set to none }
i.Value.Key = VirtualKey.None; }
// Get drum
var drum = DataController.CurrentDrumkit.Drums[i.Key];
// Get key text box
var container = listDrums.ItemContainerGenerator.ContainerFromItem(drum) as FrameworkElement;
TextBox keytxt = UIHelper.FindChildByName(container, "textKey") as TextBox;
keytxt.Text = Enum.GetName(typeof(VirtualKey), i.Value.Key);
}
}
#endregion
}
}

View File

@ -1,174 +1,174 @@
<UserControl <UserControl
x:Class="DrumKit.GeneralSettingsControl" x:Class="DrumKit.GeneralSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit" xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="635.463" d:DesignHeight="635.463"
d:DesignWidth="1075.987"> d:DesignWidth="1075.987">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.Resources> <Grid.Resources>
<Style x:Key="MyTitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleTextStyle}"> <Style x:Key="MyTitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleTextStyle}">
<Setter Property="Margin" Value="20,24,2,2" /> <Setter Property="Margin" Value="20,24,2,2" />
<Setter Property="Foreground" Value="#59FFFF" /> <Setter Property="Foreground" Value="#59FFFF" />
</Style> </Style>
<Style x:Key="MyItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource ItemTextStyle}"> <Style x:Key="MyItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource ItemTextStyle}">
<Setter Property="Margin" Value="2,12,2,2" /> <Setter Property="Margin" Value="2,12,2,2" />
</Style> </Style>
</Grid.Resources> </Grid.Resources>
<!-- About section --> <!-- About section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}" <TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="0" Margin="20,4,2,2"> Grid.Row="0" Margin="20,4,2,2">
About</TextBlock> About</TextBlock>
<!-- About section: Website --> <!-- About section: Website -->
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="1" Margin="2,12,2,2"> Grid.Row="1" Margin="2,12,2,2">
Drumkit website</TextBlock> Drumkit website</TextBlock>
<Button Name="buttonWebsite" <Button Name="buttonWebsite"
Style="{StaticResource TextButtonStyle}" Style="{StaticResource TextButtonStyle}"
Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom"> Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom">
drumkit8.blogspot.com</Button> drumkit8.blogspot.com</Button>
<!-- About section: Support --> <!-- About section: Support -->
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="2" Margin="2,12,2,2"> Grid.Row="2" Margin="2,12,2,2">
Support</TextBlock> Support</TextBlock>
<Button Name="buttonSupport" <Button Name="buttonSupport"
Style="{StaticResource TextButtonStyle}" Style="{StaticResource TextButtonStyle}"
Grid.Row="2" Grid.Column="1" VerticalAlignment="Bottom"> Grid.Row="2" Grid.Column="1" VerticalAlignment="Bottom">
chibicitiberiu@outlook.com</Button> chibicitiberiu@outlook.com</Button>
<!-- About section: Version --> <!-- About section: Version -->
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="3" Margin="2,12,2,2"> Grid.Row="3" Margin="2,12,2,2">
Version</TextBlock> Version</TextBlock>
<TextBlock Name="textVersion" <TextBlock Name="textVersion"
Grid.Row="3" Grid.Column="1" VerticalAlignment="Bottom" Grid.Row="3" Grid.Column="1" VerticalAlignment="Bottom"
Margin="0,2,2,2" Margin="0,2,2,2"
Style="{StaticResource BodyTextStyle}" > Style="{StaticResource BodyTextStyle}" >
1.0 1.0
</TextBlock> </TextBlock>
<!-- Sound section --> <!-- Sound section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}" <TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="6"> Grid.Row="6">
Sound</TextBlock> Sound</TextBlock>
<!-- Sound section: Master volume --> <!-- Sound section: Master volume -->
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="7" Margin="2,7,2,2"> Grid.Row="7" Margin="2,7,2,2">
Master volume</TextBlock> Master volume</TextBlock>
<Slider Name="masterVolumeSlider" <Slider Name="masterVolumeSlider"
Grid.Row="7" Grid.Column="1" Grid.Row="7" Grid.Column="1"
Minimum="0" Maximum="100" Minimum="0" Maximum="100"
StepFrequency="1" StepFrequency="1"
SmallChange=".05" LargeChange=".2" SmallChange=".05" LargeChange=".2"
Width="100" Height="48" Width="100" Height="48"
HorizontalAlignment="Left"/> HorizontalAlignment="Left"/>
<!-- Sound section: Polyphony --> <!-- Sound section: Polyphony -->
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="8" Margin="2,7,2,2"> Grid.Row="8" Margin="2,7,2,2">
Polyphony*</TextBlock> Polyphony*</TextBlock>
<Slider Name="polyphonySlider" <Slider Name="polyphonySlider"
Grid.Row="8" Grid.Column="1" Grid.Row="8" Grid.Column="1"
Minimum="1" Maximum="256" Minimum="1" Maximum="256"
StepFrequency="1" StepFrequency="1"
SmallChange="1" LargeChange="5" SmallChange="1" LargeChange="5"
Width="100" Height="48" Width="100" Height="48"
HorizontalAlignment="Left"/> HorizontalAlignment="Left"/>
<!-- Interface section --> <!-- Interface section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}" <TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="9"> Grid.Row="9">
Interface</TextBlock> Interface</TextBlock>
<!-- Interface section: Animations --> <!-- Interface section: Animations -->
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="10" Margin="2,12,2,2"> Grid.Row="10" Margin="2,12,2,2">
Animations</TextBlock> Animations</TextBlock>
<ToggleSwitch Name="animationsToggle" <ToggleSwitch Name="animationsToggle"
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}"
Grid.Row="12"> Grid.Row="12">
Miscellaneous</TextBlock> Miscellaneous</TextBlock>
<!-- Miscellaneous section: Debugging mode --> <!-- Miscellaneous section: Debugging mode -->
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="13" Margin="2,12,2,2"> Grid.Row="13" Margin="2,12,2,2">
Debugging mode</TextBlock> Debugging mode</TextBlock>
<ToggleSwitch Name="debuggingModeToggle" <ToggleSwitch Name="debuggingModeToggle"
Grid.Row="13" Grid.Column="1"/> Grid.Row="13" Grid.Column="1"/>
<TextBlock Style="{StaticResource ItemTextStyle}" <TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="14" Margin="2,12,2,2"> Grid.Row="14" Margin="2,12,2,2">
Factory reset*</TextBlock> Factory reset*</TextBlock>
<Button Name="buttonReset" <Button Name="buttonReset"
Style="{StaticResource TextButtonStyle}" Style="{StaticResource TextButtonStyle}"
Grid.Row="14" Grid.Column="1" VerticalAlignment="Bottom"> Grid.Row="14" Grid.Column="1" VerticalAlignment="Bottom">
Reset</Button> Reset</Button>
<!-- Notes section --> <!-- Notes section -->
<TextBlock Grid.Row="100" Style="{StaticResource MyItemTextStyle}" <TextBlock Grid.Row="100" Style="{StaticResource MyItemTextStyle}"
FontSize="11" FontSize="11"
Foreground="Silver"> Foreground="Silver">
* Will be applied after the application is restarted. * Will be applied after the application is restarted.
</TextBlock> </TextBlock>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -1,120 +1,120 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation; using Windows.UI.Xaml.Navigation;
using System.Reflection; using System.Reflection;
using Windows.UI.Popups; using Windows.UI.Popups;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DrumKit namespace DrumKit
{ {
public sealed partial class GeneralSettingsControl : UserControl public sealed partial class GeneralSettingsControl : UserControl
{ {
public GeneralSettingsControl() public GeneralSettingsControl()
{ {
this.InitializeComponent(); this.InitializeComponent();
this.LoadSettings(); this.LoadSettings();
} }
private void LoadSettings() private void LoadSettings()
{ {
// Version // Version
var version = typeof(GeneralSettingsControl).GetTypeInfo().Assembly.GetName().Version; var version = typeof(GeneralSettingsControl).GetTypeInfo().Assembly.GetName().Version;
this.textVersion.Text = String.Format("{0}.{1}", version.Major, version.Minor); this.textVersion.Text = String.Format("{0}.{1}", version.Major, version.Minor);
// Other // Other
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;
debuggingModeToggle.Toggled += debuggingModeToggle_Toggled; debuggingModeToggle.Toggled += debuggingModeToggle_Toggled;
} }
private void masterVolumeSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) private void masterVolumeSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{ {
DataController.MasterVolume = Convert.ToSingle(masterVolumeSlider.Value) / 100.0f; DataController.MasterVolume = Convert.ToSingle(masterVolumeSlider.Value) / 100.0f;
DataController.SaveSettings(); DataController.SaveSettings();
} }
void polyphonySlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) void polyphonySlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{ {
DataController.Settings.Polyphony = Convert.ToInt32(polyphonySlider.Value); DataController.Settings.Polyphony = Convert.ToInt32(polyphonySlider.Value);
DataController.SaveSettings(); DataController.SaveSettings();
} }
private void animationsToggle_Toggled(object sender, RoutedEventArgs e) private void animationsToggle_Toggled(object sender, RoutedEventArgs e)
{ {
DataController.Settings.Animations = this.animationsToggle.IsOn; DataController.Settings.Animations = this.animationsToggle.IsOn;
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)
{ {
await Windows.System.Launcher.LaunchUriAsync(new Uri("http://drumkit8.blogspot.com/")); await Windows.System.Launcher.LaunchUriAsync(new Uri("http://drumkit8.blogspot.com/"));
} }
private async void buttonSupport_Click(object sender, RoutedEventArgs e) private async void buttonSupport_Click(object sender, RoutedEventArgs e)
{ {
await Windows.System.Launcher.LaunchUriAsync(new Uri("mailto:chibicitiberiu@outlook.com")); await Windows.System.Launcher.LaunchUriAsync(new Uri("mailto:chibicitiberiu@outlook.com"));
} }
private async void buttonReset_Click(object sender, RoutedEventArgs e) private async void buttonReset_Click(object sender, RoutedEventArgs e)
{ {
// Notify that the application needs to be restarted // Notify that the application needs to be restarted
MessageDialog dialog = new MessageDialog("The application needs to be restarted in " + MessageDialog dialog = new MessageDialog("The application needs to be restarted in " +
"order to reset to factory settings. Note that every customisation will be deleted.", "order to reset to factory settings. Note that every customisation will be deleted.",
"Application restart required"); "Application restart required");
dialog.Commands.Add(new UICommand("Continue", new UICommandInvokedHandler(UICommandFactoryResetHandler))); dialog.Commands.Add(new UICommand("Continue", new UICommandInvokedHandler(UICommandFactoryResetHandler)));
dialog.Commands.Add(new UICommand("Cancel")); dialog.Commands.Add(new UICommand("Cancel"));
dialog.DefaultCommandIndex = 1; dialog.DefaultCommandIndex = 1;
await dialog.ShowAsync(); await dialog.ShowAsync();
} }
/// <summary> /// <summary>
/// UI Command that restarts the application, when current drumkit changes /// UI Command that restarts the application, when current drumkit changes
/// </summary> /// </summary>
private void UICommandFactoryResetHandler(Windows.UI.Popups.IUICommand cmd) private void UICommandFactoryResetHandler(Windows.UI.Popups.IUICommand cmd)
{ {
if (Window.Current.Content is Frame) if (Window.Current.Content is Frame)
{ {
Frame frame = (Frame) Window.Current.Content; Frame frame = (Frame) Window.Current.Content;
frame.Navigate(typeof(LoadingPage), "reset"); frame.Navigate(typeof(LoadingPage), "reset");
} }
} }
private void debuggingModeToggle_Toggled(object sender, RoutedEventArgs e) private void debuggingModeToggle_Toggled(object sender, RoutedEventArgs e)
{ {
DataController.Settings.DebugMode = this.debuggingModeToggle.IsOn; DataController.Settings.DebugMode = this.debuggingModeToggle.IsOn;
DataController.SaveSettings(); DataController.SaveSettings();
} }
} }
} }

View File

@ -1,55 +1,75 @@
using System; using System;
using System.Collections.Generic; 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.UI.ViewManagement; using Windows.System;
using Windows.UI.Xaml; using Windows.UI.ViewManagement;
using Windows.UI.Xaml.Media; using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
namespace DrumKit
{ namespace DrumKit
static class UIHelper {
{ static class UIHelper
public static DrumkitLayoutTargetView ToDrumkitLayoutView(ApplicationViewState state) {
{ public static DrumkitLayoutTargetView ToDrumkitLayoutView(ApplicationViewState state)
switch (state) {
{ switch (state)
case ApplicationViewState.Filled: {
return DrumkitLayoutTargetView.Filled; case ApplicationViewState.Filled:
return DrumkitLayoutTargetView.Filled;
case ApplicationViewState.FullScreenLandscape:
return DrumkitLayoutTargetView.Landscape; case ApplicationViewState.FullScreenLandscape:
return DrumkitLayoutTargetView.Landscape;
case ApplicationViewState.FullScreenPortrait:
return DrumkitLayoutTargetView.Portrait; case ApplicationViewState.FullScreenPortrait:
return DrumkitLayoutTargetView.Portrait;
case ApplicationViewState.Snapped:
return DrumkitLayoutTargetView.Snapped; case ApplicationViewState.Snapped:
} return DrumkitLayoutTargetView.Snapped;
}
return DrumkitLayoutTargetView.None;
} return DrumkitLayoutTargetView.None;
}
public static FrameworkElement FindChildByName(FrameworkElement el, string name)
{ public static FrameworkElement FindChildByName(FrameworkElement el, string name)
if (el == null || string.IsNullOrEmpty(name)) {
return null; if (el == null || string.IsNullOrEmpty(name))
return null;
if (name == el.Name)
return el; if (name == el.Name)
return el;
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(el); i++)
{ for (int i = 0; i < VisualTreeHelper.GetChildrenCount(el); i++)
var element = VisualTreeHelper.GetChild(el, i) as FrameworkElement; {
var result = FindChildByName(element, name); var element = VisualTreeHelper.GetChild(el, i) as FrameworkElement;
var result = FindChildByName(element, name);
if (result != null)
return result; if (result != null)
} return result;
}
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
View 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>