Added 'show key bindings' feature.

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

View File

@ -1,64 +1,66 @@

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

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

View File

@ -1,65 +1,88 @@
<UserControl
x:Class="DrumKit.DrumPlayUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid Name="grid" Background="Transparent"
PointerPressed="Grid_PointerPressed">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DrumGroups">
<VisualState x:Name="DrumNormal">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="imagePressed"
Storyboard.TargetProperty="Opacity"
BeginTime="0:0:0.1" Duration="0:0:0.7" To="0" >
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image"
Storyboard.TargetProperty="Opacity"
Duration="0:0:0.3" To="1" >
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseIn" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</VisualState>
<VisualState x:Name="DrumHit">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="imagePressed"
Storyboard.TargetProperty="Opacity"
Duration="0" To="1" />
<DoubleAnimation Storyboard.TargetName="image"
Storyboard.TargetProperty="Opacity"
Duration="0" To=".3" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Image Name="image" IsHitTestVisible="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
<Image Name="imagePressed" IsHitTestVisible="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Opacity="0" />
</Grid>
</UserControl>
<UserControl
x:Class="DrumKit.DrumPlayUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DrumGroups">
<VisualState x:Name="DrumNormal">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="imagePressed"
Storyboard.TargetProperty="Opacity"
BeginTime="0:0:0.1" Duration="0:0:0.7" To="0" >
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image"
Storyboard.TargetProperty="Opacity"
Duration="0:0:0.3" To="1" >
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseIn" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</VisualState>
<VisualState x:Name="DrumHit">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="imagePressed"
Storyboard.TargetProperty="Opacity"
Duration="0" To="1" />
<DoubleAnimation Storyboard.TargetName="image"
Storyboard.TargetProperty="Opacity"
Duration="0" To=".3" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Name="grid" Background="Transparent"
PointerPressed="Grid_PointerPressed">
<Image Name="image" IsHitTestVisible="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
<Image Name="imagePressed" IsHitTestVisible="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Opacity="0" />
</Grid>
<TextBlock Name="textKeyShadow"
Text="{Binding ElementName=textKey, Path=Text}"
Style="{StaticResource TitleTextStyle}"
Foreground="Black"
IsHitTestVisible="False"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
Margin="2,0,0,13"
Opacity="0.6" />
<TextBlock Name="textKey"
IsHitTestVisible="False"
Style="{StaticResource TitleTextStyle}"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
Margin="0,0,0,14"
Opacity="0.8" />
</Grid>
</UserControl>

View File

@ -1,122 +1,162 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DrumKit
{
public sealed partial class DrumPlayUI : UserControl
{
#region Public events
public event PointerEventHandler Hit;
#endregion
#region Properties
/// <summary>
/// Gets or sets the rotation of the drum
/// </summary>
public double Angle
{
get
{
// Get rotated grid
var transform = grid.RenderTransform as RotateTransform;
// Get angle
if (transform != null)
return transform.Angle;
// No rotation
return 0;
}
set
{
// Set rotation transformation
RotateTransform rot = new RotateTransform();
rot.CenterX = this.Width / 2;
rot.CenterY = this.Height / 2;
rot.Angle = value;
grid.RenderTransform = rot;
}
}
/// <summary>
/// Gets the drum id.
/// </summary>
public string DrumID { get; private set; }
/// <summary>
/// Enables or disables the hit animation.
/// </summary>
private bool IsAnimationEnabled {
get {
return DataController.Settings.Animations;
}
}
#endregion
#region Constructor
/// <summary>
/// Creates a new instance of DrumPlayUI
/// </summary>
/// <param name="drum"></param>
public DrumPlayUI(Drum drum)
{
// Initialize
this.InitializeComponent();
// Set drum properties
this.DrumID = drum.Id;
// TODO: key
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
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DrumKit
{
public sealed partial class DrumPlayUI : UserControl
{
#region Public events
public event PointerEventHandler Hit;
#endregion
#region Properties
/// <summary>
/// Gets or sets the rotation of the drum
/// </summary>
public double Angle
{
get
{
// Get rotated grid
var transform = grid.RenderTransform as RotateTransform;
// Get angle
if (transform != null)
return transform.Angle;
// No rotation
return 0;
}
set
{
// Set rotation transformation
RotateTransform rot = new RotateTransform();
rot.CenterX = this.Width / 2;
rot.CenterY = this.Height / 2;
rot.Angle = value;
grid.RenderTransform = rot;
}
}
/// <summary>
/// Gets the drum id.
/// </summary>
public string DrumID { get; private set; }
/// <summary>
/// Enables or disables the hit animation.
/// </summary>
private bool IsAnimationEnabled
{
get
{
return DataController.Settings.Animations;
}
}
/// <summary>
/// Sets the key string for display
/// </summary>
public string KeyString
{
set
{
if (!String.IsNullOrEmpty(value))
this.textKey.Text = String.Format("{0} [{1}]", DrumName, value);
else this.textKey.Text = DrumName;
}
}
/// <summary>
/// Gets or sets a value indicating if the key is visible
/// </summary>
public bool IsKeyVisible
{
get
{
return this.textKey.Visibility == Windows.UI.Xaml.Visibility.Visible;
}
set
{
this.textKey.Visibility = (value) ? Visibility.Visible : Visibility.Collapsed;
this.textKeyShadow.Visibility = (value) ? Visibility.Visible : Visibility.Collapsed;
}
}
/// <summary>
/// Gets or sets the drum name
/// </summary>
private string DrumName { get; set; }
#endregion
#region Constructor
/// <summary>
/// Creates a new instance of DrumPlayUI
/// </summary>
/// <param name="drum"></param>
public DrumPlayUI(Drum drum)
{
// Initialize
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
x:Class="DrumKit.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ImageBrush x:Key="MainpageBackgroundBrush" ImageSource="ms-appx:///Assets/bg.png" Stretch="UniformToFill" />
</Page.Resources>
<Grid
Background="{StaticResource MainpageBackgroundBrush}">
<Canvas Name="canvas" />
<!--<Grid Visibility="Collapsed">
<Border Margin="7"
CornerRadius="10"
BorderBrush="Red"
BorderThickness="5" />
<Canvas Name="recCanvas">
<Ellipse Width="18" Height="18" Fill="Red"
Canvas.Left="20"
Canvas.Top="20"/>
<TextBlock
FontFamily="Consolas"
FontSize="16"
Foreground="Red"
Canvas.Left="42"
Canvas.Top="19">REC
</TextBlock>
<Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever" >
<DoubleAnimation
Storyboard.TargetName="recCanvas"
Storyboard.TargetProperty="Opacity"
Duration="0:0:1" BeginTime="0:0:1" From="1" To="0.1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
</Canvas>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Button>Record</Button>
<Button>Stop</Button>
</StackPanel>
</Grid>-->
</Grid>
<Page.BottomAppBar>
<AppBar>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<ToggleButton
Name="buttonAnimations"
Click="buttonAnimations_Click"
AutomationProperties.Name="Animations"
IsChecked="True"
Style="{StaticResource VideoAppBarButtonStyle}" />
<Button
Name="buttonEditMode"
Click="ButtonEditMode_Click"
Style="{StaticResource EditAppBarButtonStyle}" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" >
<Button
Name="buttonSettings"
Click="ButtonSettings_Click"
AutomationProperties.Name="Settings"
Style="{StaticResource SettingsAppBarButtonStyle}" />
</StackPanel>
</Grid>
</AppBar>
</Page.BottomAppBar>
</Page>
<Page
x:Class="DrumKit.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ImageBrush x:Key="MainpageBackgroundBrush" ImageSource="ms-appx:///Assets/bg.png" Stretch="UniformToFill" />
</Page.Resources>
<Grid
Background="{StaticResource MainpageBackgroundBrush}">
<Canvas Name="canvas" />
<!--<Grid Visibility="Collapsed">
<Border Margin="7"
CornerRadius="10"
BorderBrush="Red"
BorderThickness="5" />
<Canvas Name="recCanvas">
<Ellipse Width="18" Height="18" Fill="Red"
Canvas.Left="20"
Canvas.Top="20"/>
<TextBlock
FontFamily="Consolas"
FontSize="16"
Foreground="Red"
Canvas.Left="42"
Canvas.Top="19">REC
</TextBlock>
<Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever" >
<DoubleAnimation
Storyboard.TargetName="recCanvas"
Storyboard.TargetProperty="Opacity"
Duration="0:0:1" BeginTime="0:0:1" From="1" To="0.1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
</Canvas>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Button>Record</Button>
<Button>Stop</Button>
</StackPanel>
</Grid>-->
</Grid>
<Page.BottomAppBar>
<AppBar>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<ToggleButton
Name="buttonAnimations"
Click="buttonAnimations_Click"
AutomationProperties.Name="Animations"
IsChecked="True"
Style="{StaticResource VideoAppBarButtonStyle}" />
<Button
Name="buttonEditMode"
Click="ButtonEditMode_Click"
Style="{StaticResource EditAppBarButtonStyle}" />
<ToggleButton
Name="buttonKeys"
Click="buttonKeys_Click"
AutomationProperties.Name="Show keys"
IsChecked="True"
Style="{StaticResource KeyboardAppBarButtonStyle}" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" >
<Button
Name="buttonSettings"
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.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.System;
using Windows.UI.ApplicationSettings;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace DrumKit
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
#region Fields: Private members
private Dictionary<string, DrumPlayUI> DrumUIs { get; set; }
private Dictionary<VirtualKey, string> Keymap { get; set; }
private int CurrentLayout { get; set; }
#endregion
#region Initialization
/// <summary>
/// Creates a new instance of MainPage.
/// </summary>
public MainPage()
{
// Create private members
this.DrumUIs = new Dictionary<string, DrumPlayUI>();
this.Keymap = new Dictionary<VirtualKey, string>();
CurrentLayout = 0;
// Initialize page
this.InitializeComponent();
this.SizeChanged += MainPage_SizeChanged;
this.Loaded += MainPage_Loaded;
SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
// Initialize drums
this.InitializeDrums();
}
/// <summary>
/// Sets up a single drum
/// </summary>
/// <param name="drum">The drum.</param>
private void InitializeDrum(Drum drum)
{
// Create object
DrumPlayUI d = new DrumPlayUI(drum);
// Set up callbacks
d.Hit += HandlerDrumPointerPressed;
// Add to lists
canvas.Children.Add(d);
this.DrumUIs.Add(drum.Id, d);
}
/// <summary>
/// Sets up the drums.
/// </summary>
private void InitializeDrums()
{
// Clear previous stuff if any
this.DrumUIs.Clear();
this.Keymap.Clear();
// Load drums
foreach (var i in DataController.CurrentDrumkit.DrumsList)
InitializeDrum(i);
// Load drum configurations
foreach (var i in DataController.CurrentConfig.DrumsList)
{
// Unload if disabled
if (!i.IsEnabled)
{
canvas.Children.Remove(this.DrumUIs[i.TargetId]);
this.DrumUIs.Remove(i.TargetId);
}
// Keyboard mapping
if (!Keymap.ContainsKey(i.Key))
Keymap.Add(i.Key, i.TargetId);
}
}
#endregion
#region UI: Settings charm
/// <summary>
/// Triggered when the settings pane requests commands/
/// </summary>
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
args.Request.ApplicationCommands.Clear();
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));
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);
args.Request.ApplicationCommands.Add(layouts);
}
/// <summary>
/// Handles the settings charms
/// </summary>
void MainPage_SettingsCommand(Windows.UI.Popups.IUICommand command)
{
Frame.Navigate(typeof(SettingsPage), command.Id);
}
#endregion
#region Layouts
/// <summary>
/// Figures out which is the best layout available, and uses it.
/// </summary>
private int PickBestLayout()
{
// Smaller index is better
int[] picks = {-1, -1, -1, -1, -1, -1};
// Get current layout
var view = UIHelper.ToDrumkitLayoutView(Windows.UI.ViewManagement.ApplicationView.Value);
// Find best option
for (int index = 0; index < DataController.CurrentLayouts.Items.Count; index++ )
{
var i = DataController.CurrentLayouts.Items[index];
bool isSame = (i.TargetView == view);
bool contains = (i.TargetView & view) > 0;
bool all = i.TargetView == DrumkitLayoutTargetView.All;
if (i.IsDefault)
{
if (isSame) picks[0] = index;
if (contains) picks[1] = index;
if (all) picks[2] = index;
}
else
{
if (isSame) picks[3] = index;
if (contains) picks[4] = index;
if (all) picks[5] = index;
}
}
// Return first value different than -1, or 0
foreach (var i in picks)
if (i != -1) return i;
return 0;
}
/// <summary>
/// Sets up the layout
/// </summary>
private void ReloadLayout()
{
// Get current size
double w = canvas.ActualWidth;
double h = canvas.ActualHeight;
if (double.IsNaN(w) || double.IsNaN(h) || double.IsInfinity(w) || double.IsInfinity(h))
return;
// Pick a layout
this.CurrentLayout = PickBestLayout();
Log.Write("Layout change: picked_layout={0}, w={1}, h={2}", this.CurrentLayout, w, h);
// Apply layout
foreach (var i in DataController.CurrentLayouts.Items[CurrentLayout].Drums)
{
if (!DrumUIs.ContainsKey(i.Key))
continue;
// Set angle
DrumUIs[i.Key].Angle = i.Value.Angle;
// Set scale
DrumUIs[i.Key].Width = i.Value.Size * w;
DrumUIs[i.Key].Height = i.Value.Size * w;
// Set position
Canvas.SetLeft(DrumUIs[i.Key], w * i.Value.X);
Canvas.SetTop(DrumUIs[i.Key], h * i.Value.Y);
}
}
#endregion
#region UI: Drums
/// <summary>
/// Handles drum hit using mouse/finger
/// </summary>
void HandlerDrumPointerPressed(object sender, PointerRoutedEventArgs e)
{
var button = sender as DrumPlayUI;
if (button != null)
this.HandlerDrumClickedCommon(button.DrumID);
}
/// <summary>
/// Handles drum hit using keyboard
/// </summary>
public void HandlerKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
{
string drum;
// Key repeat or something
if (args.KeyStatus.WasKeyDown)
return;
// If key in key map, perform "click"
if (this.Keymap.TryGetValue(args.VirtualKey, out drum))
HandlerDrumClickedCommon(drum);
}
/// <summary>
/// Handles drum hit.
/// </summary>
private void HandlerDrumClickedCommon(string drum_id)
{
try
{
DataController.PlaySound(drum_id, 0);
if (DataController.Settings.Animations)
this.DrumUIs[drum_id].PerformHit();
}
catch (Exception ex)
{
Log.Error("Error at playback!!! Drum id: {0}", drum_id);
Log.Except(ex);
}
}
#endregion
#region UI: Page events
/// <summary>
/// Handles page size change event.
/// </summary>
void MainPage_SizeChanged(object sender, SizeChangedEventArgs e)
{
this.ReloadLayout();
this.ReloadLayout();
}
/// <summary>
/// Handles page load event.
/// </summary>
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
// Set layout
this.ReloadLayout();
// Set toggles
buttonAnimations.IsChecked = DataController.Settings.Animations;
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Log.Write("Navigated to main page.");
Window.Current.CoreWindow.KeyDown += this.HandlerKeyDown;
}
/// <summary>
/// Invoked when the page is about to be destroyed.
/// </summary>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
Window.Current.CoreWindow.KeyDown -= this.HandlerKeyDown;
}
#endregion
#region UI: Buttons
/// <summary>
/// Handles the edit button, going into the editor.
/// </summary>
private void ButtonEditMode_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(EditorPage), DataController.CurrentLayouts.Items[CurrentLayout]);
}
/// <summary>
/// Handles the animations enabled toggle button.
/// </summary>
private void buttonAnimations_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 animation setting
DataController.Settings.Animations = isChecked;
// 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
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.System;
using Windows.UI.ApplicationSettings;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace DrumKit
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
#region Fields: Private members
private Dictionary<string, DrumPlayUI> DrumUIs { get; set; }
private Dictionary<VirtualKey, string> Keymap { get; set; }
private int CurrentLayout { get; set; }
#endregion
#region Initialization
/// <summary>
/// Creates a new instance of MainPage.
/// </summary>
public MainPage()
{
// Create private members
this.DrumUIs = new Dictionary<string, DrumPlayUI>();
this.Keymap = new Dictionary<VirtualKey, string>();
CurrentLayout = 0;
// Initialize page
this.InitializeComponent();
this.SizeChanged += MainPage_SizeChanged;
this.Loaded += MainPage_Loaded;
SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
// Initialize drums
this.InitializeDrums();
}
/// <summary>
/// Sets up a single drum
/// </summary>
/// <param name="drum">The drum.</param>
private void InitializeDrum(Drum drum)
{
// Create object
DrumPlayUI d = new DrumPlayUI(drum);
// Set up callbacks
d.Hit += HandlerDrumPointerPressed;
// Add to lists
canvas.Children.Add(d);
this.DrumUIs.Add(drum.Id, d);
}
/// <summary>
/// Sets up the drums.
/// </summary>
private void InitializeDrums()
{
// Clear previous stuff if any
this.DrumUIs.Clear();
// Load drums
foreach (var i in DataController.CurrentDrumkit.DrumsList)
InitializeDrum(i);
UpdateDrumConfig();
}
/// <summary>
/// Sets up the drum configurations
/// </summary>
private void UpdateDrumConfig()
{
this.Keymap.Clear();
// Load drum configurations
foreach (var i in DataController.CurrentConfig.DrumsList)
{
// Unload if disabled
if (!i.IsEnabled)
{
canvas.Children.Remove(this.DrumUIs[i.TargetId]);
this.DrumUIs.Remove(i.TargetId);
}
else
{
// Set drum key
this.DrumUIs[i.TargetId].KeyString = UIHelper.GetPrettifiedVKeyName(i.Key);
this.DrumUIs[i.TargetId].IsKeyVisible = DataController.Settings.ShowKeyBindings;
// Keyboard mapping
if (!Keymap.ContainsKey(i.Key))
Keymap.Add(i.Key, i.TargetId);
}
}
}
#endregion
#region UI: Settings charm
/// <summary>
/// Triggered when the settings pane requests commands/
/// </summary>
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
args.Request.ApplicationCommands.Clear();
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));
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);
args.Request.ApplicationCommands.Add(layouts);
}
/// <summary>
/// Handles the settings charms
/// </summary>
void MainPage_SettingsCommand(Windows.UI.Popups.IUICommand command)
{
Frame.Navigate(typeof(SettingsPage), command.Id);
}
#endregion
#region Layouts
/// <summary>
/// Figures out which is the best layout available, and uses it.
/// </summary>
private int PickBestLayout()
{
// Smaller index is better
int[] picks = {-1, -1, -1, -1, -1, -1};
// Get current layout
var view = UIHelper.ToDrumkitLayoutView(Windows.UI.ViewManagement.ApplicationView.Value);
// Find best option
for (int index = 0; index < DataController.CurrentLayouts.Items.Count; index++ )
{
var i = DataController.CurrentLayouts.Items[index];
bool isSame = (i.TargetView == view);
bool contains = (i.TargetView & view) > 0;
bool all = i.TargetView == DrumkitLayoutTargetView.All;
if (i.IsDefault)
{
if (isSame) picks[0] = index;
if (contains) picks[1] = index;
if (all) picks[2] = index;
}
else
{
if (isSame) picks[3] = index;
if (contains) picks[4] = index;
if (all) picks[5] = index;
}
}
// Return first value different than -1, or 0
foreach (var i in picks)
if (i != -1) return i;
return 0;
}
/// <summary>
/// Sets up the layout
/// </summary>
private void ReloadLayout()
{
// Get current size
double w = canvas.ActualWidth;
double h = canvas.ActualHeight;
if (double.IsNaN(w) || double.IsNaN(h) || double.IsInfinity(w) || double.IsInfinity(h))
return;
// Pick a layout
this.CurrentLayout = PickBestLayout();
Log.Write("Layout change: picked_layout={0}, w={1}, h={2}", this.CurrentLayout, w, h);
// Apply layout
foreach (var i in DataController.CurrentLayouts.Items[CurrentLayout].Drums)
{
if (!DrumUIs.ContainsKey(i.Key))
continue;
// Set angle
DrumUIs[i.Key].Angle = i.Value.Angle;
// Set scale
DrumUIs[i.Key].Width = i.Value.Size * w;
DrumUIs[i.Key].Height = i.Value.Size * w;
// Set position
Canvas.SetLeft(DrumUIs[i.Key], w * i.Value.X);
Canvas.SetTop(DrumUIs[i.Key], h * i.Value.Y);
}
}
#endregion
#region UI: Drums
/// <summary>
/// Handles drum hit using mouse/finger
/// </summary>
void HandlerDrumPointerPressed(object sender, PointerRoutedEventArgs e)
{
var button = sender as DrumPlayUI;
if (button != null)
this.HandlerDrumClickedCommon(button.DrumID);
}
/// <summary>
/// Handles drum hit using keyboard
/// </summary>
public void HandlerKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
{
string drum;
// Key repeat or something
if (args.KeyStatus.WasKeyDown)
return;
// If key in key map, perform "click"
if (this.Keymap.TryGetValue(args.VirtualKey, out drum))
HandlerDrumClickedCommon(drum);
}
/// <summary>
/// Handles drum hit.
/// </summary>
private void HandlerDrumClickedCommon(string drum_id)
{
try
{
DataController.PlaySound(drum_id, 0);
if (DataController.Settings.Animations)
this.DrumUIs[drum_id].PerformHit();
}
catch (Exception ex)
{
Log.Error("Error at playback!!! Drum id: {0}", drum_id);
Log.Except(ex);
}
}
#endregion
#region UI: Page events
/// <summary>
/// Handles page size change event.
/// </summary>
void MainPage_SizeChanged(object sender, SizeChangedEventArgs e)
{
this.ReloadLayout();
this.ReloadLayout();
}
/// <summary>
/// Handles page load event.
/// </summary>
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
// Set layout
this.ReloadLayout();
// Set toggles
buttonAnimations.IsChecked = DataController.Settings.Animations;
buttonKeys.IsChecked = DataController.Settings.ShowKeyBindings;
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Log.Write("Navigated to main page.");
Window.Current.CoreWindow.KeyDown += this.HandlerKeyDown;
}
/// <summary>
/// Invoked when the page is about to be destroyed.
/// </summary>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
Window.Current.CoreWindow.KeyDown -= this.HandlerKeyDown;
}
#endregion
#region UI: Buttons
/// <summary>
/// Handles the edit button, going into the editor.
/// </summary>
private void ButtonEditMode_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(EditorPage), DataController.CurrentLayouts.Items[CurrentLayout]);
}
/// <summary>
/// Handles the animations enabled toggle button.
/// </summary>
private void buttonAnimations_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 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
x:Class="DrumKit.DrumsSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="400"
d:DesignWidth="400">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Common/TextButtonStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="DrumsListDataTemplate">
<Grid Name="theGrid"
MinWidth="380">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Left thing -->
<Border Name="yellowBorder"
Grid.Column="0" Grid.RowSpan="3"
Background="Yellow" Width="10" />
<!-- Thumbnail -->
<Image Grid.Row="0" Grid.RowSpan="2"
Grid.Column="2"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width="60" Height="60"
Source="{Binding LoadedImageSource}"
Stretch="Uniform" />
<!-- Name -->
<TextBox Grid.Column="1" Grid.Row="0" Margin="15,2,15,0"
FontSize="15.3"
Style="{StaticResource MyTextBoxStyle}"
Text="{Binding Name}"
IsReadOnly="True" />
<!-- Configuration -->
<Grid
Grid.Column="1" Grid.Row="1" Margin="15,0,15,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ToggleButton
Name="toggleEnabled" Grid.Column="0"
Margin="0,-4,20,0" Padding="5,1"
Content="Enabled"
Click="ToggleEnabled_Click" />
<TextBlock
Grid.Column="1"
Style="{StaticResource TitleTextStyle}"
Text="Key:" />
<TextBox
Grid.Column="2"
Name="textKey"
Style="{StaticResource MyTextBoxStyle}"
KeyUp="TextKey_KeyUp" />
</Grid>
<Grid Grid.Column="1" Grid.Row="2" Margin="15,2,15,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextStyle}"
Text="Volume left:" />
<Slider Name="sliderVolumeL"
Grid.Column="1"
Margin="5,-8,5,0"
Height="34"
Minimum="0" Maximum="1"
StepFrequency=".01"
ValueChanged="sliderVolumeL_ValueChanged"/>
<TextBlock
Margin="10,0,0,0"
Grid.Column="2"
Style="{StaticResource TitleTextStyle}"
Text="Right:" />
<Slider Name="sliderVolumeR"
Grid.Column="3"
Margin="5,-8,5,0"
Height="34"
Minimum="0" Maximum="1"
StepFrequency=".01"
ValueChanged="sliderVolumeR_ValueChanged" />
</Grid>
</Grid>
</DataTemplate>
<Style x:Key="GridViewStretchItemStyle" TargetType="GridViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Drums list -->
<GridView Name="listDrums"
Grid.Row="0" Grid.Column="0"
ItemTemplate="{StaticResource DrumsListDataTemplate}"
ItemContainerStyle="{StaticResource GridViewStretchItemStyle}"
SelectionMode="Single" >
<local:Drum ImageSource="/Assets/bg.png" Id="adda" Name="Hello world!" />
</GridView>
<!-- Buttons -->
<!--<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonCreate_Click">Create</Button>
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonDelete_Click">Delete</Button>
</StackPanel>-->
</Grid>
</UserControl>
<UserControl
x:Class="DrumKit.DrumsSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="400"
d:DesignWidth="400">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Common/TextButtonStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="DrumsListDataTemplate">
<Grid Name="theGrid"
MinWidth="380">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Left thing -->
<Border Name="yellowBorder"
Grid.Column="0" Grid.RowSpan="3"
Background="Yellow" Width="10" />
<!-- Thumbnail -->
<Image Grid.Row="0" Grid.RowSpan="2"
Grid.Column="2"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width="60" Height="60"
Source="{Binding LoadedImageSource}"
Stretch="Uniform" />
<!-- Name -->
<TextBox Grid.Column="1" Grid.Row="0" Margin="15,2,15,0"
FontSize="15.3"
Style="{StaticResource MyTextBoxStyle}"
Text="{Binding Name}"
IsReadOnly="True" />
<!-- Configuration -->
<Grid
Grid.Column="1" Grid.Row="1" Margin="15,0,15,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ToggleButton
Name="toggleEnabled" Grid.Column="0"
Margin="0,-4,20,0" Padding="5,1"
Content="Visible"
Click="ToggleEnabled_Click" />
<TextBlock
Grid.Column="1"
Style="{StaticResource TitleTextStyle}"
Text="Key:" />
<TextBox
Grid.Column="2"
Name="textKey"
Style="{StaticResource MyTextBoxStyle}"
KeyUp="TextKey_KeyUp" />
</Grid>
<Grid Grid.Column="1" Grid.Row="2" Margin="15,2,15,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextStyle}"
Text="Volume left:" />
<Slider Name="sliderVolumeL"
Grid.Column="1"
Margin="5,-8,5,0"
Height="34"
Minimum="0" Maximum="1"
StepFrequency=".01"
ValueChanged="sliderVolumeL_ValueChanged"/>
<TextBlock
Margin="10,0,0,0"
Grid.Column="2"
Style="{StaticResource TitleTextStyle}"
Text="Right:" />
<Slider Name="sliderVolumeR"
Grid.Column="3"
Margin="5,-8,5,0"
Height="34"
Minimum="0" Maximum="1"
StepFrequency=".01"
ValueChanged="sliderVolumeR_ValueChanged" />
</Grid>
</Grid>
</DataTemplate>
<Style x:Key="GridViewStretchItemStyle" TargetType="GridViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Drums list -->
<GridView Name="listDrums"
Grid.Row="0" Grid.Column="0"
ItemTemplate="{StaticResource DrumsListDataTemplate}"
ItemContainerStyle="{StaticResource GridViewStretchItemStyle}"
SelectionMode="Single" >
<local:Drum ImageSource="/Assets/bg.png" Id="adda" Name="Hello world!" />
</GridView>
<!-- Buttons -->
<!--<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonCreate_Click">Create</Button>
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonDelete_Click">Delete</Button>
</StackPanel>-->
</Grid>
</UserControl>

View File

@ -1,236 +1,221 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DrumKit
{
public sealed partial class DrumsSettingsControl : UserControl
{
#region Initialization
/// <summary>
/// Creates a new instance of DrumsSettingsControl
/// </summary>
public DrumsSettingsControl()
{
this.InitializeComponent();
this.Loaded += DrumsSettingsControl_Loaded;
}
/// <summary>
/// Loads drum list at startup
/// </summary>
void DrumsSettingsControl_Loaded(object sender, RoutedEventArgs e)
{
ReloadDrums();
}
#endregion
#region Reloads the list of drums
/// <summary>
/// Reloads the list of drums
/// </summary>
async void ReloadDrums()
{
// Clear previous stuff
listDrums.Items.Clear();
// Add new stuff
foreach (var i in DataController.CurrentDrumkit.Drums)
this.listDrums.Items.Add(i.Value);
// Wait for containers to be generated
await System.Threading.Tasks.Task.Delay(50);
// Update visual stuff
DrumConfig config = null;
foreach (var i in this.listDrums.Items)
{
// Get drum and configuration
var drum = i as Drum;
if (drum != null)
DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config);
// No drum, no configuration?
if (drum == null || config == null)
continue;
// Set up other properties
var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement;
ToggleButton enabled = UIHelper.FindChildByName(container, "toggleEnabled") as ToggleButton;
if (enabled != null) enabled.IsChecked = config.IsEnabled;
Slider volumeL = UIHelper.FindChildByName(container, "sliderVolumeL") as Slider;
if (volumeL != null) volumeL.Value = config.VolumeL;
Slider volumeR = UIHelper.FindChildByName(container, "sliderVolumeR") as Slider;
if (volumeR != null) volumeR.Value = config.VolumeR;
}
ReloadKeys();
}
void ReloadKeys()
{
DrumConfig config = null;
foreach (var i in this.listDrums.Items)
{
// Get drum and configuration
var drum = i as Drum;
if (drum != null)
DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config);
// No drum, no configuration?
if (drum == null || config == null)
continue;
// Set up key
var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement;
TextBox key = UIHelper.FindChildByName(container, "textKey") as TextBox;
if (key != null)
{
if (Enum.IsDefined(typeof(VirtualKey), config.Key))
{
// Get name
string text = Enum.GetName(typeof(VirtualKey), config.Key);
// Prettify the name
if (text.StartsWith("Number"))
text = text.Substring("Number".Length);
text = System.Text.RegularExpressions.Regex.Replace(text, "([a-z])([A-Z])", "${1} ${2}");
// Set the text
key.Text = text;
}
else key.Text = string.Format("Unnamed ({0})", (int)config.Key);
}
}
}
#endregion
#region UI Handlers: Items
/// <summary>
/// Handles "Landscape" toggle button.
/// </summary>
private void ToggleEnabled_Click(object sender, RoutedEventArgs e)
{
// Get drum object
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))
{
DataController.CurrentConfig.Drums[drum.Id].IsEnabled = button.IsChecked.HasValue && button.IsChecked.Value;
DataController.SaveConfig();
}
}
/// <summary>
/// Handles the "key press" event in the textbox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TextKey_KeyUp(object sender, KeyRoutedEventArgs e)
{
// Get drum object
var text = sender as TextBox;
var drum = (sender as FrameworkElement).DataContext as Drum;
// Set key
if (text != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
{
// Remove duplicates
RemoveKeys(e.Key, drum.Id);
// Set key
DataController.CurrentConfig.Drums[drum.Id].Key = e.Key;
// Display
ReloadKeys();
// Save
DataController.SaveConfig();
}
}
private void sliderVolumeL_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
// Get drum object
var slider = sender as Slider;
var drum = (sender as FrameworkElement).DataContext as Drum;
// Set value
if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
{
DataController.CurrentConfig.Drums[drum.Id].VolumeL = e.NewValue;
DataController.SaveConfig();
}
}
private void sliderVolumeR_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
// Get drum object
var slider = sender as Slider;
var drum = (sender as FrameworkElement).DataContext as Drum;
// Set value
if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
{
DataController.CurrentConfig.Drums[drum.Id].VolumeR = e.NewValue;
DataController.SaveConfig();
}
}
#endregion
#region Misc
/// <summary>
/// Sets the keyboart shortcut to None for all the drums that have this key.
/// </summary>
/// <param name="key">The keyboard shortcut</param>
private void RemoveKeys(VirtualKey key, string exception_id=null)
{
// 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)
{
// 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
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DrumKit
{
public sealed partial class DrumsSettingsControl : UserControl
{
#region Initialization
/// <summary>
/// Creates a new instance of DrumsSettingsControl
/// </summary>
public DrumsSettingsControl()
{
this.InitializeComponent();
this.Loaded += DrumsSettingsControl_Loaded;
}
/// <summary>
/// Loads drum list at startup
/// </summary>
void DrumsSettingsControl_Loaded(object sender, RoutedEventArgs e)
{
ReloadDrums();
}
#endregion
#region Reloads the list of drums
/// <summary>
/// Reloads the list of drums
/// </summary>
async void ReloadDrums()
{
// Clear previous stuff
listDrums.Items.Clear();
// Add new stuff
foreach (var i in DataController.CurrentDrumkit.Drums)
this.listDrums.Items.Add(i.Value);
// Wait for containers to be generated
await System.Threading.Tasks.Task.Delay(50);
// Update visual stuff
DrumConfig config = null;
foreach (var i in this.listDrums.Items)
{
// Get drum and configuration
var drum = i as Drum;
if (drum != null)
DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config);
// No drum, no configuration?
if (drum == null || config == null)
continue;
// Set up other properties
var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement;
ToggleButton enabled = UIHelper.FindChildByName(container, "toggleEnabled") as ToggleButton;
if (enabled != null) enabled.IsChecked = config.IsEnabled;
Slider volumeL = UIHelper.FindChildByName(container, "sliderVolumeL") as Slider;
if (volumeL != null) volumeL.Value = config.VolumeL;
Slider volumeR = UIHelper.FindChildByName(container, "sliderVolumeR") as Slider;
if (volumeR != null) volumeR.Value = config.VolumeR;
}
ReloadKeys();
}
void ReloadKeys()
{
DrumConfig config = null;
foreach (var i in this.listDrums.Items)
{
// Get drum and configuration
var drum = i as Drum;
if (drum != null)
DataController.CurrentConfig.Drums.TryGetValue(drum.Id, out config);
// No drum, no configuration?
if (drum == null || config == null)
continue;
// Set up key
var container = listDrums.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement;
TextBox key = UIHelper.FindChildByName(container, "textKey") as TextBox;
if (key != null)
{
key.Text = UIHelper.GetPrettifiedVKeyName(config.Key);
}
}
}
#endregion
#region UI Handlers: Items
/// <summary>
/// Handles "Landscape" toggle button.
/// </summary>
private void ToggleEnabled_Click(object sender, RoutedEventArgs e)
{
// Get drum object
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))
{
DataController.CurrentConfig.Drums[drum.Id].IsEnabled = button.IsChecked.HasValue && button.IsChecked.Value;
DataController.SaveConfig();
}
}
/// <summary>
/// Handles the "key press" event in the textbox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TextKey_KeyUp(object sender, KeyRoutedEventArgs e)
{
// Get drum object
var text = sender as TextBox;
var drum = (sender as FrameworkElement).DataContext as Drum;
// Set key
if (text != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
{
// Remove duplicates
RemoveKeys(e.Key, drum.Id);
// Set key
DataController.CurrentConfig.Drums[drum.Id].Key = e.Key;
// Display
ReloadKeys();
// Save
DataController.SaveConfig();
}
}
private void sliderVolumeL_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
// Get drum object
var slider = sender as Slider;
var drum = (sender as FrameworkElement).DataContext as Drum;
// Set value
if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
{
DataController.CurrentConfig.Drums[drum.Id].VolumeL = e.NewValue;
DataController.SaveConfig();
}
}
private void sliderVolumeR_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
// Get drum object
var slider = sender as Slider;
var drum = (sender as FrameworkElement).DataContext as Drum;
// Set value
if (slider != null && drum != null && DataController.CurrentConfig.Drums.ContainsKey(drum.Id))
{
DataController.CurrentConfig.Drums[drum.Id].VolumeR = e.NewValue;
DataController.SaveConfig();
}
}
#endregion
#region Misc
/// <summary>
/// Sets the keyboart shortcut to None for all the drums that have this key.
/// </summary>
/// <param name="key">The keyboard shortcut</param>
private void RemoveKeys(VirtualKey key, string exception_id=null)
{
// 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)
{
// 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
x:Class="DrumKit.GeneralSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="635.463"
d:DesignWidth="1075.987">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<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 />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style x:Key="MyTitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleTextStyle}">
<Setter Property="Margin" Value="20,24,2,2" />
<Setter Property="Foreground" Value="#59FFFF" />
</Style>
<Style x:Key="MyItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource ItemTextStyle}">
<Setter Property="Margin" Value="2,12,2,2" />
</Style>
</Grid.Resources>
<!-- About section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="0" Margin="20,4,2,2">
About</TextBlock>
<!-- About section: Website -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="1" Margin="2,12,2,2">
Drumkit website</TextBlock>
<Button Name="buttonWebsite"
Style="{StaticResource TextButtonStyle}"
Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom">
drumkit8.blogspot.com</Button>
<!-- About section: Support -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="2" Margin="2,12,2,2">
Support</TextBlock>
<Button Name="buttonSupport"
Style="{StaticResource TextButtonStyle}"
Grid.Row="2" Grid.Column="1" VerticalAlignment="Bottom">
chibicitiberiu@outlook.com</Button>
<!-- About section: Version -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="3" Margin="2,12,2,2">
Version</TextBlock>
<TextBlock Name="textVersion"
Grid.Row="3" Grid.Column="1" VerticalAlignment="Bottom"
Margin="0,2,2,2"
Style="{StaticResource BodyTextStyle}" >
1.0
</TextBlock>
<!-- Sound section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="6">
Sound</TextBlock>
<!-- Sound section: Master volume -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="7" Margin="2,7,2,2">
Master volume</TextBlock>
<Slider Name="masterVolumeSlider"
Grid.Row="7" Grid.Column="1"
Minimum="0" Maximum="100"
StepFrequency="1"
SmallChange=".05" LargeChange=".2"
Width="100" Height="48"
HorizontalAlignment="Left"/>
<!-- Sound section: Polyphony -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="8" Margin="2,7,2,2">
Polyphony*</TextBlock>
<Slider Name="polyphonySlider"
Grid.Row="8" Grid.Column="1"
Minimum="1" Maximum="256"
StepFrequency="1"
SmallChange="1" LargeChange="5"
Width="100" Height="48"
HorizontalAlignment="Left"/>
<!-- Interface section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="9">
Interface</TextBlock>
<!-- Interface section: Animations -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="10" Margin="2,12,2,2">
Animations</TextBlock>
<ToggleSwitch Name="animationsToggle"
Grid.Row="10" Grid.Column="1"/>
<!-- Interface section: Key bindings -->
<!--<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="11" Margin="2,12,2,2">
Display key bindings</TextBlock>
<ToggleSwitch Name="keyBindingsToggle"
Grid.Row="11" Grid.Column="1"/>-->
<!-- Miscellaneous section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="12">
Miscellaneous</TextBlock>
<!-- Miscellaneous section: Debugging mode -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="13" Margin="2,12,2,2">
Debugging mode</TextBlock>
<ToggleSwitch Name="debuggingModeToggle"
Grid.Row="13" Grid.Column="1"/>
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="14" Margin="2,12,2,2">
Factory reset*</TextBlock>
<Button Name="buttonReset"
Style="{StaticResource TextButtonStyle}"
Grid.Row="14" Grid.Column="1" VerticalAlignment="Bottom">
Reset</Button>
<!-- Notes section -->
<TextBlock Grid.Row="100" Style="{StaticResource MyItemTextStyle}"
FontSize="11"
Foreground="Silver">
* Will be applied after the application is restarted.
</TextBlock>
</Grid>
</UserControl>
<UserControl
x:Class="DrumKit.GeneralSettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrumKit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="635.463"
d:DesignWidth="1075.987">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<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 />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style x:Key="MyTitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleTextStyle}">
<Setter Property="Margin" Value="20,24,2,2" />
<Setter Property="Foreground" Value="#59FFFF" />
</Style>
<Style x:Key="MyItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource ItemTextStyle}">
<Setter Property="Margin" Value="2,12,2,2" />
</Style>
</Grid.Resources>
<!-- About section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="0" Margin="20,4,2,2">
About</TextBlock>
<!-- About section: Website -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="1" Margin="2,12,2,2">
Drumkit website</TextBlock>
<Button Name="buttonWebsite"
Style="{StaticResource TextButtonStyle}"
Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom">
drumkit8.blogspot.com</Button>
<!-- About section: Support -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="2" Margin="2,12,2,2">
Support</TextBlock>
<Button Name="buttonSupport"
Style="{StaticResource TextButtonStyle}"
Grid.Row="2" Grid.Column="1" VerticalAlignment="Bottom">
chibicitiberiu@outlook.com</Button>
<!-- About section: Version -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="3" Margin="2,12,2,2">
Version</TextBlock>
<TextBlock Name="textVersion"
Grid.Row="3" Grid.Column="1" VerticalAlignment="Bottom"
Margin="0,2,2,2"
Style="{StaticResource BodyTextStyle}" >
1.0
</TextBlock>
<!-- Sound section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="6">
Sound</TextBlock>
<!-- Sound section: Master volume -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="7" Margin="2,7,2,2">
Master volume</TextBlock>
<Slider Name="masterVolumeSlider"
Grid.Row="7" Grid.Column="1"
Minimum="0" Maximum="100"
StepFrequency="1"
SmallChange=".05" LargeChange=".2"
Width="100" Height="48"
HorizontalAlignment="Left"/>
<!-- Sound section: Polyphony -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="8" Margin="2,7,2,2">
Polyphony*</TextBlock>
<Slider Name="polyphonySlider"
Grid.Row="8" Grid.Column="1"
Minimum="1" Maximum="256"
StepFrequency="1"
SmallChange="1" LargeChange="5"
Width="100" Height="48"
HorizontalAlignment="Left"/>
<!-- Interface section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="9">
Interface</TextBlock>
<!-- Interface section: Animations -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="10" Margin="2,12,2,2">
Animations</TextBlock>
<ToggleSwitch Name="animationsToggle"
Grid.Row="10" Grid.Column="1"/>
<!-- Interface section: Key bindings -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="11" Margin="2,12,2,2">
Display key bindings</TextBlock>
<ToggleSwitch Name="keyBindingsToggle"
Grid.Row="11" Grid.Column="1"/>
<!-- Miscellaneous section -->
<TextBlock Style="{StaticResource MyTitleTextStyle}"
Grid.Row="12">
Miscellaneous</TextBlock>
<!-- Miscellaneous section: Debugging mode -->
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="13" Margin="2,12,2,2">
Debugging mode</TextBlock>
<ToggleSwitch Name="debuggingModeToggle"
Grid.Row="13" Grid.Column="1"/>
<TextBlock Style="{StaticResource ItemTextStyle}"
Grid.Row="14" Margin="2,12,2,2">
Factory reset*</TextBlock>
<Button Name="buttonReset"
Style="{StaticResource TextButtonStyle}"
Grid.Row="14" Grid.Column="1" VerticalAlignment="Bottom">
Reset</Button>
<!-- Notes section -->
<TextBlock Grid.Row="100" Style="{StaticResource MyItemTextStyle}"
FontSize="11"
Foreground="Silver">
* Will be applied after the application is restarted.
</TextBlock>
</Grid>
</UserControl>

View File

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

View File

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