diff --git a/#Resources/ApplicationData.tar b/#Resources/ApplicationData.tar new file mode 100644 index 0000000..9e9791f Binary files /dev/null and b/#Resources/ApplicationData.tar differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/drum.png b/#Resources/ApplicationData/Drumkits/Default/Images/drum.png new file mode 100644 index 0000000..fbf9357 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/drum.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/drumPressed.png b/#Resources/ApplicationData/Drumkits/Default/Images/drumPressed.png new file mode 100644 index 0000000..36c66cb Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/drumPressed.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/kick.png b/#Resources/ApplicationData/Drumkits/Default/Images/kick.png new file mode 100644 index 0000000..412a66d Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/kick.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/kickPressed.png b/#Resources/ApplicationData/Drumkits/Default/Images/kickPressed.png new file mode 100644 index 0000000..2ef7180 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/kickPressed.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/pedal.png b/#Resources/ApplicationData/Drumkits/Default/Images/pedal.png new file mode 100644 index 0000000..efedadb Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/pedal.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/pedalPressed.png b/#Resources/ApplicationData/Drumkits/Default/Images/pedalPressed.png new file mode 100644 index 0000000..cd75c96 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/pedalPressed.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/plate.png b/#Resources/ApplicationData/Drumkits/Default/Images/plate.png new file mode 100644 index 0000000..ea8fe3c Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/plate.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Images/platePressed.png b/#Resources/ApplicationData/Drumkits/Default/Images/platePressed.png new file mode 100644 index 0000000..88f4865 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Images/platePressed.png differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/Crash05.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/Crash05.wav new file mode 100644 index 0000000..ba3a8d7 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/Crash05.wav differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/Floor04.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/Floor04.wav new file mode 100644 index 0000000..d69afa6 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/Floor04.wav differ diff --git a/DrumKit/Build/ApplicationData/Drumkits/Default/Sounds/Hat04.WAV b/#Resources/ApplicationData/Drumkits/Default/Sounds/Hat04.WAV similarity index 100% rename from DrumKit/Build/ApplicationData/Drumkits/Default/Sounds/Hat04.WAV rename to #Resources/ApplicationData/Drumkits/Default/Sounds/Hat04.WAV diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/HiHatClosed04.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/HiHatClosed04.wav new file mode 100644 index 0000000..34e2c82 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/HiHatClosed04.wav differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/HiHatOpen04.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/HiHatOpen04.wav new file mode 100644 index 0000000..84ebdcb Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/HiHatOpen04.wav differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/Kick07.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/Kick07.wav new file mode 100644 index 0000000..0259a09 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/Kick07.wav differ diff --git a/DrumKit/Build/ApplicationData/Drumkits/Default/Sounds/Ride04.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/Ride04.wav similarity index 100% rename from DrumKit/Build/ApplicationData/Drumkits/Default/Sounds/Ride04.wav rename to #Resources/ApplicationData/Drumkits/Default/Sounds/Ride04.wav diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/Snare08.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/Snare08.wav new file mode 100644 index 0000000..544e22f Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/Snare08.wav differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/TomHigh04.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/TomHigh04.wav new file mode 100644 index 0000000..a5f84a9 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/TomHigh04.wav differ diff --git a/#Resources/ApplicationData/Drumkits/Default/Sounds/TomLow04.wav b/#Resources/ApplicationData/Drumkits/Default/Sounds/TomLow04.wav new file mode 100644 index 0000000..3d2f960 Binary files /dev/null and b/#Resources/ApplicationData/Drumkits/Default/Sounds/TomLow04.wav differ diff --git a/#Resources/ApplicationData/Drumkits/Default/config.xml b/#Resources/ApplicationData/Drumkits/Default/config.xml new file mode 100644 index 0000000..21313ba --- /dev/null +++ b/#Resources/ApplicationData/Drumkits/Default/config.xml @@ -0,0 +1,41 @@ + + + + + 1.0 + A + + + 1.0 + B + + + 1.0 + C + + + 1.0 + D + + + 1.0 + E + + + 1.0 + F + + + 1.0 + G + + + 1.0 + H + + + 1.0 + I + + + \ No newline at end of file diff --git a/#Resources/ApplicationData/Drumkits/Default/drumkit.xml b/#Resources/ApplicationData/Drumkits/Default/drumkit.xml new file mode 100644 index 0000000..4f5d85a --- /dev/null +++ b/#Resources/ApplicationData/Drumkits/Default/drumkit.xml @@ -0,0 +1,144 @@ + + + + + + Default + Default drums + + + config.xml + layout.xml + + + + + Kick + Images/kick.png + Images/kickPressed.png + + Sounds/Kick07.wav + + + + + Snare + Images/drum.png + Images/drumPressed.png + + Sounds/Snare08.wav + + + + + High Tom + Images/drum.png + Images/drumPressed.png + + Sounds/TomHigh04.wav + + + + + Low Tom + Images/drum.png + Images/drumPressed.png + + Sounds/TomLow04.wav + + + + + Floor Tom + Images/drum.png + Images/drumPressed.png + + Sounds/Floor04.wav + + + + + Hi-Hat Closed (pedal) + Images/pedal.png + Images/pedalPressed.png + + Sounds/HiHatClosed04.wav + + + + + Hi-Hat Opened + Images/plate.png + Images/platePressed.png + + Sounds/HiHatOpen04.wav + + + + + Crash + Images/plate.png + Images/platePressed.png + + Sounds/Crash05.wav + + + + + Ride + Images/plate.png + Images/platePressed.png + + Sounds/Ride04.wav + + + + + + + \ No newline at end of file diff --git a/#Resources/ApplicationData/Drumkits/Default/layout.xml b/#Resources/ApplicationData/Drumkits/Default/layout.xml new file mode 100644 index 0000000..8b2442f --- /dev/null +++ b/#Resources/ApplicationData/Drumkits/Default/layout.xml @@ -0,0 +1,71 @@ + + + + + + + + Standard layout + Snapped|Landscape|Filled|Portrait + true + + + + .3 + .41 + .2 + 0 + + + .25 + .16 + .34 + 2 + + + .22 + .33 + .05 + 1 + + + .22 + .55 + .05 + 1 + + + .29 + .66 + .44 + 1 + + + .05 + .10 + .87 + 3 + + + .21 + .03 + .55 + 4 + + + .26 + .1 + .02 + 4 + + + .25 + .72 + .04 + 4 + + + + + + \ No newline at end of file diff --git a/#Resources/manual.docx b/#Resources/manual.docx new file mode 100644 index 0000000..86f5b41 Binary files /dev/null and b/#Resources/manual.docx differ diff --git a/promo-414x180.png b/#Resources/promo-414x180.png similarity index 100% rename from promo-414x180.png rename to #Resources/promo-414x180.png diff --git a/promo-414x468.png b/#Resources/promo-414x468.png similarity index 100% rename from promo-414x468.png rename to #Resources/promo-414x468.png diff --git a/promo-558x756.png b/#Resources/promo-558x756.png similarity index 100% rename from promo-558x756.png rename to #Resources/promo-558x756.png diff --git a/promo-846x468.png b/#Resources/promo-846x468.png similarity index 100% rename from promo-846x468.png rename to #Resources/promo-846x468.png diff --git a/#Resources/screens/screenshot_04142013_135946.png b/#Resources/screens/screenshot_04142013_135946.png new file mode 100644 index 0000000..bfb039a Binary files /dev/null and b/#Resources/screens/screenshot_04142013_135946.png differ diff --git a/#Resources/screens/screenshot_04142013_140003.png b/#Resources/screens/screenshot_04142013_140003.png new file mode 100644 index 0000000..e2ca3f8 Binary files /dev/null and b/#Resources/screens/screenshot_04142013_140003.png differ diff --git a/#Resources/screens/screenshot_04142013_140055.png b/#Resources/screens/screenshot_04142013_140055.png new file mode 100644 index 0000000..8cb52e2 Binary files /dev/null and b/#Resources/screens/screenshot_04142013_140055.png differ diff --git a/#Resources/screens/screenshot_04142013_140107.png b/#Resources/screens/screenshot_04142013_140107.png new file mode 100644 index 0000000..868ec22 Binary files /dev/null and b/#Resources/screens/screenshot_04142013_140107.png differ diff --git a/#Resources/screens/screenshot_04142013_140115.png b/#Resources/screens/screenshot_04142013_140115.png new file mode 100644 index 0000000..6548c93 Binary files /dev/null and b/#Resources/screens/screenshot_04142013_140115.png differ diff --git a/#Resources/screens/screenshot_04142013_140131.png b/#Resources/screens/screenshot_04142013_140131.png new file mode 100644 index 0000000..03c7e3b Binary files /dev/null and b/#Resources/screens/screenshot_04142013_140131.png differ diff --git a/#Resources/screens/screenshot_04142013_140148.png b/#Resources/screens/screenshot_04142013_140148.png new file mode 100644 index 0000000..6986a69 Binary files /dev/null and b/#Resources/screens/screenshot_04142013_140148.png differ diff --git a/#Resources/screens/screenshot_04142013_140331.png b/#Resources/screens/screenshot_04142013_140331.png new file mode 100644 index 0000000..e7c16f4 Binary files /dev/null and b/#Resources/screens/screenshot_04142013_140331.png differ diff --git a/#Resources/summary.pptx b/#Resources/summary.pptx new file mode 100644 index 0000000..b6bf8a6 Binary files /dev/null and b/#Resources/summary.pptx differ diff --git a/DrumKit.sln b/DrumKit.sln index 924b763..9ed48a2 100644 --- a/DrumKit.sln +++ b/DrumKit.sln @@ -3,6 +3,8 @@ 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 @@ -39,11 +41,24 @@ Global {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 - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection EndGlobal diff --git a/DrumKit.v11.suo b/DrumKit.v11.suo index ef17176..58a8f2b 100644 Binary files a/DrumKit.v11.suo and b/DrumKit.v11.suo differ diff --git a/DrumKit/App.xaml b/DrumKit/App.xaml index 47bf33e..5220383 100644 --- a/DrumKit/App.xaml +++ b/DrumKit/App.xaml @@ -13,6 +13,7 @@ Required by Visual Studio project and item templates --> + diff --git a/DrumKit/App.xaml.cs b/DrumKit/App.xaml.cs index f7e1fd0..3d4178a 100644 --- a/DrumKit/App.xaml.cs +++ b/DrumKit/App.xaml.cs @@ -80,22 +80,10 @@ namespace DrumKit /// /// The source of the suspend request. /// Details about the suspend request. - private async void OnSuspending(object sender, SuspendingEventArgs e) + private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity - try { - await DataManager.Close(); - } - catch (Exception ex) { - Log.Error("Exception in OnSuspending method!"); - Log.Except(ex); - } - - Log.Write("Application suspended."); - - //TODO:::... deferral.Complete(); } } diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU.appxupload b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU.appxupload new file mode 100644 index 0000000..f3353a9 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU.appxupload differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.ps1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.ps1 new file mode 100644 index 0000000..9d8fb28 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.ps1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..bb478b0 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..c2591d4 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..bb478b0 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..6be2c19 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..fd72d58 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..a886f92 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..e68a131 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..2a9283e Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..048639c Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..94718e1 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..0e7123c Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.appx b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.appx new file mode 100644 index 0000000..3f2bd55 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.appx differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.appxsym b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.appxsym new file mode 100644 index 0000000..d69c9a2 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.appxsym differ diff --git a/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.cer b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.cer new file mode 100644 index 0000000..1a44942 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.1.0.26_AnyCPU_Test/DrumKit_2.1.0.26_AnyCPU.cer differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU.appxupload b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU.appxupload new file mode 100644 index 0000000..d8a3920 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU.appxupload differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.ps1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.ps1 new file mode 100644 index 0000000..9d8fb28 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.ps1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..bb478b0 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..c2591d4 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..bb478b0 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..6be2c19 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..fd72d58 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..a886f92 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..e68a131 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..2a9283e Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..048639c Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..aac5c21 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..94718e1 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 new file mode 100644 index 0000000..0e7123c Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.appx b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.appx new file mode 100644 index 0000000..023701c Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.appx differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.appxsym b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.appxsym new file mode 100644 index 0000000..c04bc0b Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.appxsym differ diff --git a/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.cer b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.cer new file mode 100644 index 0000000..1a44942 Binary files /dev/null and b/DrumKit/AppPackages/DrumKit_2.2.0.27_AnyCPU_Test/DrumKit_2.2.0.27_AnyCPU.cer differ diff --git a/DrumKit/Assets/ApplicationData.tar b/DrumKit/Assets/ApplicationData.tar index 9f703fa..01c0d9c 100644 Binary files a/DrumKit/Assets/ApplicationData.tar and b/DrumKit/Assets/ApplicationData.tar differ diff --git a/DrumKit/Build/ApplicationData/Drumkits/Default/Images/platePressed.png b/DrumKit/Build/ApplicationData/Drumkits/Default/Images/platePressed.png index 8935060..9eb6c5d 100644 Binary files a/DrumKit/Build/ApplicationData/Drumkits/Default/Images/platePressed.png and b/DrumKit/Build/ApplicationData/Drumkits/Default/Images/platePressed.png differ diff --git a/DrumKit/Build/ApplicationData/Drumkits/Default/Sounds/Ride06.wav b/DrumKit/Build/ApplicationData/Drumkits/Default/Sounds/Ride06.wav new file mode 100644 index 0000000..ca06db3 Binary files /dev/null and b/DrumKit/Build/ApplicationData/Drumkits/Default/Sounds/Ride06.wav differ diff --git a/DrumKit/Build/ApplicationData/Drumkits/Default/drumkit.xml b/DrumKit/Build/ApplicationData/Drumkits/Default/drumkit.xml index 4f5d85a..0cb601c 100644 --- a/DrumKit/Build/ApplicationData/Drumkits/Default/drumkit.xml +++ b/DrumKit/Build/ApplicationData/Drumkits/Default/drumkit.xml @@ -89,56 +89,10 @@ Images/plate.png Images/platePressed.png - Sounds/Ride04.wav + Sounds/Ride06.wav - - + \ No newline at end of file diff --git a/DrumKit/Build/ApplicationData/Drumkits/Default/layout.xml b/DrumKit/Build/ApplicationData/Drumkits/Default/layout.xml index e97306b..92776b3 100644 --- a/DrumKit/Build/ApplicationData/Drumkits/Default/layout.xml +++ b/DrumKit/Build/ApplicationData/Drumkits/Default/layout.xml @@ -2,76 +2,222 @@ - - - - Standard layout - Snapped|Landscape|Filled|Portrait - true + + + + Standard layout + All + true + + + + .3 + .41 + .2 + 0 + + + .25 + .16 + .34 + 2 + 61 + + + .22 + .33 + .05 + 1 + 150 + + + .22 + .55 + .05 + 1 + 150 + + + .29 + .66 + .44 + 1 + -30 + + + .055 + .11 + .89 + 3 + + + .21 + .03 + .55 + 4 + 80 + + + .26 + .1 + .02 + 4 + 80 + + + .25 + .72 + .04 + 4 + + + + + + Portrait layout + Portrait + true + + + + 0.53359375 + .2 + .39 + 0 + -90 + + + 0.4446614583 + .34 + .64 + 2 + -29 + + + 0.3913020833 + .05 + .47 + 1 + 60 + + + 0.3913020833 + .05 + .25 + 1 + 60 + + + 0.5158072917 + .44 + .14 + 1 + -120 + + + 0.0978255208 + .89 + .69 + 3 + -90 + + + 0.373515625 + .55 + .77 + 4 + -10 + + + 0.4624479167 + .02 + .7 + 4 + -10 + + + 0.4446614583 + .04 + .08 + 4 + -90 + + + + + + + Snapped layout + Snapped + true + + + + 0.6 + 0.49444900512695339 + 0.32627955277760762 + 0 + -90 + + + 0.5 + 0.39433132171630869 + 0.56396647930145249 + 2 + 61 + + + 0.44 + 0.057991533279419152 + 0.43292328516642276 + 1 + 60 + + + 0.44 + 0.087597298622131434 + 0.26619099378585825 + 1 + 60 + + + 0.58 + 0.47881852149963317 + 0.10023623943328863 + 1 + -120 + + + 0.11 + 0.83815117835998587 + 0.80136797269185378 + 3 + -90 + + + 0.42 + 0.45826869487762456 + 0.74660433133443138 + 4 + -10 + + + 0.52 + -0.015512061119079568 + 0.62290350516637261 + 4 + -10 + + + 0.5 + 0.019840950965881135 + 0.06086617549260457 + 4 + -90 + + + + + - - - .3 - .41 - .2 - 0 - - - .25 - .16 - .34 - 2 - 61 - - - .22 - .33 - .05 - 1 - 150 - - - .22 - .55 - .05 - 1 - 150 - - - .29 - .66 - .44 - 1 - -30 - - - .055 - .11 - .89 - 3 - - - .21 - .03 - .55 - 4 - 80 - - - .26 - .1 - .02 - 4 - 80 - - - .25 - .72 - .04 - 4 - - - - - \ No newline at end of file diff --git a/DrumKit/Common/StandardStyles.xaml b/DrumKit/Common/StandardStyles.xaml index 975f119..64bdeed 100644 --- a/DrumKit/Common/StandardStyles.xaml +++ b/DrumKit/Common/StandardStyles.xaml @@ -27,7 +27,10 @@ - + + + + + + + - --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DrumKit/UI/DrumEditUI.xaml.cs b/DrumKit/UI/DrumEditUI.xaml.cs new file mode 100644 index 0000000..8065052 --- /dev/null +++ b/DrumKit/UI/DrumEditUI.xaml.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI; +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 DrumEditUI : UserControl + { + #region Constants + const double RotationHandleOffset = 8; + #endregion + + #region Public events + /// + /// Triggered when the item was dragged. + /// + public event DragDeltaEventHandler DragDelta; + + /// + /// Triggered when the angle changes + /// + public event EventHandler AngleChanged; + + #endregion + + #region Public properties + + /// + /// Gets or sets the drum rotation + /// + public double Angle + { + get + { + // Get rotated grid + var transform = rotateGrid.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; + + rotateGrid.RenderTransform = rot; + + // Set thumb position + TranslateTransform tr = new TranslateTransform(); + double radius = this.Height / 2 + RotationHandleOffset; + double rads = Math.PI * (value - 90) / 180; + + tr.X = radius * Math.Cos(rads); + tr.Y = radius * Math.Sin(rads); + + rotationThumb.RenderTransform = tr; + + // Call event + if (AngleChanged != null) + AngleChanged(this, new EventArgs()); + } + } + + /// + /// Gets the drum id. + /// + public string DrumID { get; private set; } + + #endregion + + #region Private fields + + private double rotationDragX = 0, rotationDragY = 0; + + #endregion + + #region Constructor + + /// + /// Creates a new instance of DrumEditUI + /// + public DrumEditUI(Drum drum) + { + // Initialize + this.InitializeComponent(); + + // Set drum properties + this.DrumID = drum.Id; + this.nameText.Text = drum.Name; + + // Set image + this.image.Source = drum.LoadedImageSource; + } + + #endregion + + #region UI handlers + + /// + /// Handles the "rotation handle drag started" event. + /// + private void rotationThumb_DragStarted(object sender, DragStartedEventArgs e) + { + var transl = this.rotationThumb.RenderTransform as TranslateTransform; + + double x = (transl == null) ? 0 : transl.X; + double y = (transl == null) ? 0 : transl.Y; + + rotationDragX = x; + rotationDragY = y; + } + + /// + /// Handles the "rotation handle dragged" event. + /// + /// + /// + private void rotationThumb_DragDelta(object sender, DragDeltaEventArgs e) + { + rotationDragX += e.HorizontalChange; + rotationDragY += e.VerticalChange; + + double angle = Math.Atan2(rotationDragY, rotationDragX) * 180.0 / Math.PI + 90; + this.Angle = angle; + } + + /// + /// Handles the "scale handle dragged" event. + /// + private void scaleThumb_DragDelta(object sender, DragDeltaEventArgs e) + { + double new_w = this.Width + e.HorizontalChange; + // double new_h = this.Height + e.VerticalChange; + + this.Width = Math.Max(0, new_w); + this.Height = Math.Max(0, new_w); + } + + /// + /// Handles the translation drag delta event. + /// + private void translationThumb_DragDelta(object sender, DragDeltaEventArgs e) + { + if (this.DragDelta != null) + this.DragDelta(this, e); + } + + /// + /// Handles the size changed event. + /// + private void DrumEditUl_SizeChanged(object sender, SizeChangedEventArgs e) + { + this.Angle = Angle; + } + + #endregion + + } +} diff --git a/DrumKit/UI/DrumPlayUI.xaml b/DrumKit/UI/DrumPlayUI.xaml new file mode 100644 index 0000000..b130c15 --- /dev/null +++ b/DrumKit/UI/DrumPlayUI.xaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DrumKit/UI/DrumPlayUI.xaml.cs b/DrumKit/UI/DrumPlayUI.xaml.cs new file mode 100644 index 0000000..f480c6d --- /dev/null +++ b/DrumKit/UI/DrumPlayUI.xaml.cs @@ -0,0 +1,122 @@ +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 + /// + /// Gets or sets the rotation of the drum + /// + 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; + } + } + + /// + /// Gets the drum id. + /// + public string DrumID { get; private set; } + + /// + /// Enables or disables the hit animation. + /// + private bool IsAnimationEnabled { + get { + return DataController.Settings.Animations; + } + } + #endregion + + #region Constructor + + /// + /// Creates a new instance of DrumPlayUI + /// + /// + 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 + /// + /// Handles the drum pressed event. + /// + 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 + } +} diff --git a/DrumKit/UI/DrumUI.cs b/DrumKit/UI/DrumUI.cs deleted file mode 100644 index 0202a10..0000000 --- a/DrumKit/UI/DrumUI.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Windows.Storage; -using Windows.UI; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Animation; -using Windows.UI.Xaml.Media.Imaging; - -namespace DrumKit -{ - class DrumUI - { - #region Private attributes - private Thumb thumb; - private Image image, imagePressed; - private Grid grid; - private Storyboard hitAnimation; - #endregion - - #region Public properties - /// - /// Gets the ui element which will be put in a canvas. - /// - public FrameworkElement Element { get { return grid; } } - - /// - /// Gets the drum id. - /// - public string DrumID { get; private set; } - - public event Windows.UI.Xaml.Input.PointerEventHandler PointerPressed - { - add { - grid.PointerPressed += value; - } - - remove { - grid.PointerPressed -= value; - } - } - - public event DragDeltaEventHandler DragDelta - { - add { - thumb.DragDelta += value; - } - - remove { - thumb.DragDelta -= value; - } - - } - - #endregion - - #region Initialization - private void GridAddChild(FrameworkElement element) - { - grid.Children.Add(element); - element.HorizontalAlignment = HorizontalAlignment.Stretch; - element.VerticalAlignment = VerticalAlignment.Stretch; - } - - private void InitializeCreateObjects() - { - // Create thumb - this.thumb = new Thumb() - { - Background = new SolidColorBrush(Colors.Green), - Opacity = .3, - Visibility = Visibility.Collapsed - }; - - // Create image - this.image = new Image(); - - // Create pressed image - this.imagePressed = new Image() - { - Opacity = 0 - }; - - // Create grid - this.grid = new Grid(); - - // Create animation - DoubleAnimation fade = new DoubleAnimation(); - fade.Duration = TimeSpan.FromSeconds(.6); - fade.From = 1; - fade.To = 0; - - Storyboard.SetTarget(fade, this.imagePressed); - Storyboard.SetTargetProperty(fade, "Opacity"); - - this.hitAnimation = new Storyboard(); - this.hitAnimation.Children.Add(fade); - - // grid.Resources.Add("hitanimation", this.hitAnimation); - } - - private void InitializeParenting() - { - this.GridAddChild(this.image); - this.GridAddChild(this.imagePressed); - this.GridAddChild(this.thumb); - } - - public async Task InitializeDrum(Drum drum, StorageFolder root) - { - // Set path - Uri rootpath = new Uri(root.Path); - - // Set drum id - this.DrumID = drum.Id; - - // Set images - this.image.Source = await IOHelper.GetImageAsync(root, drum.ImageSource); - this.imagePressed.Source = await IOHelper.GetImageAsync(root, drum.ImagePressedSource); - - // Set tags - this.thumb.Tag = drum.Id; - this.grid.Tag = drum.Id; - } - - #endregion - - public DrumUI() - { - // Create objects - this.InitializeCreateObjects(); - this.InitializeParenting(); - } - - public void UpdateLayout(DrumLayout layout, double canvasWidth, double canvasHeight) - { - // Set up size - this.grid.Width = layout.Size * canvasWidth; - this.grid.Height = layout.Size * canvasWidth; - - // Set up position - Canvas.SetLeft(this.grid, layout.X * canvasWidth); - Canvas.SetTop(this.grid, layout.Y * canvasHeight); - Canvas.SetZIndex(this.grid, layout.ZIndex); - - // Rotation - RotateTransform transform = new RotateTransform(); - transform.Angle = layout.Angle; - transform.CenterX = this.grid.Width / 2; - transform.CenterY = this.grid.Height / 2; - this.image.RenderTransform = transform; - this.imagePressed.RenderTransform = transform; - } - - public void Hit() - { - // Perform a drum hit - this.hitAnimation.Begin(); - } - - public void EnableEdit() - { - // Thumb becomes visible - this.thumb.Visibility = Visibility.Visible; - } - - public void DisableEdit() - { - // Thumb becomes invisible - this.thumb.Visibility = Visibility.Collapsed; - } - } -} diff --git a/DrumKit/UI/EditorPage.xaml b/DrumKit/UI/EditorPage.xaml new file mode 100644 index 0000000..a21406d --- /dev/null +++ b/DrumKit/UI/EditorPage.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + diff --git a/DrumKit/UI/Settings/DrumkitsSettingsControl.xaml.cs b/DrumKit/UI/Settings/DrumkitsSettingsControl.xaml.cs new file mode 100644 index 0000000..8631826 --- /dev/null +++ b/DrumKit/UI/Settings/DrumkitsSettingsControl.xaml.cs @@ -0,0 +1,319 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Windows.Data.Xml.Dom; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI; +using Windows.UI.Notifications; +using Windows.UI.Popups; +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; + + +namespace DrumKit +{ + public sealed partial class DrumkitsSettingsControl : UserControl + { + #region Initialization + /// + /// Creates a new instance of DrumkitsSettingsControl + /// + public DrumkitsSettingsControl() + { + this.InitializeComponent(); + this.Loaded += DrumkitsSettingsControl_Loaded; + } + + /// + /// Loads drumkit list at startup + /// + void DrumkitsSettingsControl_Loaded(object sender, RoutedEventArgs e) + { + ReloadDrumkits(); + } + + #endregion + + #region Reload drumkit list + + /// + /// Reloads the list of drumkits from the data controller + /// + async void ReloadDrumkits() + { + // Remove previous stuff + this.listDrumkits.Items.Clear(); + + // Add new stuff + foreach (var i in DataController.AvailableDrumkits) + this.listDrumkits.Items.Add(i.Value); + + // Wait containers to be generated + await System.Threading.Tasks.Task.Delay(50); + + // Update visual stuff + foreach (var i in this.listDrumkits.Items) + { + var it = i as Drumkit; + + // Is current? + if (DataController.Settings.CurrentKit == it.Name) + { + // Get border and grid + var container = listDrumkits.ItemContainerGenerator.ContainerFromItem(it) as FrameworkElement; + Border b = UIHelper.FindChildByName(container, "orangeBorder") as Border; + Grid g = UIHelper.FindChildByName(container, "theGrid") as Grid; + + // Change look + if (b != null) b.Background = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0x78, 0x33)); + if (g != null) g.Background = new SolidColorBrush(Color.FromArgb(0x1f, 0xff, 0xef, 0xdf)); + } + } + + } + + #endregion + + #region UI Handlers: Text boxes + /// + /// Handles drumkit name change + /// + private void NameTextChanged(object sender, TextChangedEventArgs e) + { + var drumkit = (sender as FrameworkElement).DataContext as Drumkit; + + throw new NotImplementedException(); + } + + /// + /// Handles drumkit description change + /// + private void DescriptionTextChanged(object sender, TextChangedEventArgs e) + { + var drumkit = (sender as FrameworkElement).DataContext as Drumkit; + + throw new NotImplementedException(); + } + + #endregion + + #region UI Handlers: Buttons + /// + /// Handles the Create button + /// + private void ButtonCreate_Click(object sender, RoutedEventArgs e) + { + throw new NotImplementedException(); + } + + /// + /// Handles the Import button + /// + private async void ButtonImport_Click(object sender, RoutedEventArgs e) + { + // Error handling + string error = null; + + // Create file picker + Windows.Storage.Pickers.FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker(); + picker.CommitButtonText = "Select drum package"; + picker.FileTypeFilter.Add(".tar"); + picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Downloads; + + // Pick a tarball + var tarball = await picker.PickSingleFileAsync(); + + if (tarball == null) + return; + + // Enable progress ring + progressRing.IsActive = true; + + // See if it works + try + { + await DataController.InstallDrumkit(tarball); + ReloadDrumkits(); + } + + catch (Repository.RepositoryException ex) + { + error = "A drumkit package with the same name already exists!"; + Log.Except(ex); + } + + catch (ArgumentException ex) + { + error = "The selected file is not a valid drumkit package!"; + Log.Except(ex); + } + + catch (IOException ex) + { + error = "The selected file is not a valid drumkit package!"; + Log.Except(ex); + } + + catch (Exception ex) + { + error = "An unexpected error occured while importing the drumkit package!"; + Log.Except(ex); + } + + // Disable progress ring + progressRing.IsActive = false; + + // Show error if any occured + if (!string.IsNullOrEmpty(error)) + { + MessageDialog err = new MessageDialog(error, "An error occured!"); + await err.ShowAsync(); + } + } + + /// + /// Handles the Delete button + /// + private async void ButtonDelete_Click(object sender, RoutedEventArgs e) + { + // Get the selected drumkit + Drumkit selected = listDrumkits.SelectedItem as Drumkit; + string error = null; + + // Try to delete + if (selected != null) + try + { + await DataController.RemoveDrumkit(selected.Name); + ReloadDrumkits(); + } + + catch (ControllerException ex) + { + error = "There has to be at least one drumkit remaining!"; + Log.Except(ex); + } + + catch (ArgumentException ex) + { + error = "Cannot delete the currently loaded drumkit!"; + Log.Except(ex); + } + + catch (Exception ex) + { + error = "An unexpected error occured while deleting the drumkit!"; + Log.Except(ex); + } + + // Show error if any occured + if (!string.IsNullOrEmpty(error)) + { + MessageDialog err = new MessageDialog(error, "An error occured!"); + await err.ShowAsync(); + } + } + + /// + /// Handles the Export button + /// + private async void ButtonExport_Click(object sender, RoutedEventArgs e) + { + // Variables + Drumkit selected = listDrumkits.SelectedItem as Drumkit; + string error = null; + + // Make sure there is something selected + if (selected == null) return; + + // Pick a file + Windows.Storage.Pickers.FileSavePicker picker = new Windows.Storage.Pickers.FileSavePicker(); + picker.CommitButtonText = "Export drum package"; + picker.FileTypeChoices.Add("Tarball", new string[] { ".tar" } ); + picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; + var file = await picker.PickSaveFileAsync(); + + if (file == null) return; + + // Enable progress ring + progressRing.IsActive = true; + + // See if it works + try { + await DataController.ExportDrumkit(selected.Name, file); + } + + catch (IOException ex) + { + error = "An unexpected error occured while exporting the drumkit package!"; + Log.Except(ex); + } + + catch (Exception ex) + { + error = "An unexpected error occured while exporting the drumkit package!"; + Log.Except(ex); + } + + // Disable progress ring + progressRing.IsActive = false; + + // Show error if any occured + if (!string.IsNullOrEmpty(error)) + { + MessageDialog err = new MessageDialog(error, "An error occured!"); + await err.ShowAsync(); + } + } + + /// + /// Handles the SetCurrent button + /// + private async void ButtonSetCurrent_Clicked(object sender, RoutedEventArgs e) + { + var drumkit = listDrumkits.SelectedItem as Drumkit; + + if (drumkit != null && drumkit.Name != DataController.Settings.CurrentKit) + { + // Change drumkit + DataController.Settings.CurrentKit = drumkit.Name; + DataController.SaveSettings(); + + // Reload list + ReloadDrumkits(); + + // Notify that the application needs to be restarted + MessageDialog dialog = new MessageDialog("The application needs to be restarted in " + + "order to change the current drumkit. If not restarted now, the selected drumkit " + + "will be loaded the next time the application is started. ", "Application restart required"); + + dialog.Commands.Add(new UICommand("Restart application", new UICommandInvokedHandler(UICommandRestartHandler))); + dialog.Commands.Add(new UICommand("Close")); + dialog.DefaultCommandIndex = 1; + + await dialog.ShowAsync(); + } + } + + /// + /// UI Command that restarts the application, when current drumkit changes + /// + private void UICommandRestartHandler(Windows.UI.Popups.IUICommand cmd) + { + if (Window.Current.Content is Frame) + { + Frame frame = (Frame)Window.Current.Content; + frame.Navigate(typeof(LoadingPage), "drumkitchange"); + } + } + + #endregion + } +} diff --git a/DrumKit/UI/Settings/DrumsSettingsControl.xaml b/DrumKit/UI/Settings/DrumsSettingsControl.xaml new file mode 100644 index 0000000..5582867 --- /dev/null +++ b/DrumKit/UI/Settings/DrumsSettingsControl.xaml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DrumKit/UI/Settings/DrumsSettingsControl.xaml.cs b/DrumKit/UI/Settings/DrumsSettingsControl.xaml.cs new file mode 100644 index 0000000..edeb463 --- /dev/null +++ b/DrumKit/UI/Settings/DrumsSettingsControl.xaml.cs @@ -0,0 +1,236 @@ +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 + /// + /// Creates a new instance of DrumsSettingsControl + /// + public DrumsSettingsControl() + { + this.InitializeComponent(); + this.Loaded += DrumsSettingsControl_Loaded; + } + + + /// + /// Loads drum list at startup + /// + void DrumsSettingsControl_Loaded(object sender, RoutedEventArgs e) + { + ReloadDrums(); + } + + #endregion + + #region Reloads the list of drums + + /// + /// Reloads the list of drums + /// + 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 + + /// + /// Handles "Landscape" toggle button. + /// + 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(); + } + } + + /// + /// Handles the "key press" event in the textbox + /// + /// + /// + 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 + /// + /// Sets the keyboart shortcut to None for all the drums that have this key. + /// + /// The keyboard shortcut + 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 + + } +} diff --git a/DrumKit/UI/Settings/ExperimentsSettingsControl.xaml b/DrumKit/UI/Settings/ExperimentsSettingsControl.xaml new file mode 100644 index 0000000..78052c9 --- /dev/null +++ b/DrumKit/UI/Settings/ExperimentsSettingsControl.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + diff --git a/DrumKit/UI/Settings/ExperimentsSettingsControl.xaml.cs b/DrumKit/UI/Settings/ExperimentsSettingsControl.xaml.cs new file mode 100644 index 0000000..b282035 --- /dev/null +++ b/DrumKit/UI/Settings/ExperimentsSettingsControl.xaml.cs @@ -0,0 +1,31 @@ +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 ExperimentsSettingsControl : UserControl + { + public ExperimentsSettingsControl() + { + this.InitializeComponent(); + + DrumPlayUI ui = new DrumPlayUI(DataController.CurrentDrumkit.Drums.First().Value); + canvas.Children.Add(ui); + Canvas.SetTop(ui, 100); + Canvas.SetLeft(ui, 300); + } + } +} diff --git a/DrumKit/UI/Settings/GeneralSettingsControl.xaml b/DrumKit/UI/Settings/GeneralSettingsControl.xaml new file mode 100644 index 0000000..065cde8 --- /dev/null +++ b/DrumKit/UI/Settings/GeneralSettingsControl.xaml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + About + + + + Drumkit website + + + + + + Support + + + + + + + Version + + + 1.0 + + + + + + Sound + + + + Master volume + + + + + + Polyphony* + + + + + + Interface + + + + Animations + + + + + + + + + Miscellaneous + + + + Debugging mode + + + + + Factory reset* + + + + + + + * Will be applied after the application is restarted. + + + + diff --git a/DrumKit/UI/Settings/GeneralSettingsControl.xaml.cs b/DrumKit/UI/Settings/GeneralSettingsControl.xaml.cs new file mode 100644 index 0000000..943bc9b --- /dev/null +++ b/DrumKit/UI/Settings/GeneralSettingsControl.xaml.cs @@ -0,0 +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(); + } + + /// + /// UI Command that restarts the application, when current drumkit changes + /// + 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(); + } + + } +} diff --git a/DrumKit/UI/Settings/LayoutsSettingsControl.xaml b/DrumKit/UI/Settings/LayoutsSettingsControl.xaml new file mode 100644 index 0000000..74f4728 --- /dev/null +++ b/DrumKit/UI/Settings/LayoutsSettingsControl.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Landscape + Portrait + Filled + Snapped + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hello world! + + + + + + + + + + + + + diff --git a/DrumKit/UI/Settings/LayoutsSettingsControl.xaml.cs b/DrumKit/UI/Settings/LayoutsSettingsControl.xaml.cs new file mode 100644 index 0000000..c1251e6 --- /dev/null +++ b/DrumKit/UI/Settings/LayoutsSettingsControl.xaml.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI; +using Windows.UI.Popups; +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 LayoutsSettingsControl : UserControl + { + #region Initialization + /// + /// Creates a new instance of LayoutsSettingsControl + /// + public LayoutsSettingsControl() + { + this.InitializeComponent(); + this.Loaded += LayoutsSettingsControl_Loaded; + } + + /// + /// Loads layout list at startup + /// + void LayoutsSettingsControl_Loaded(object sender, RoutedEventArgs e) + { + ReloadLayouts(); + } + + #endregion + + #region Reloads the list of layouts + + /// + /// Reloads the list of layouts + /// + async void ReloadLayouts() + { + // Clear previous stuff + listLayouts.Items.Clear(); + + // Add new stuff + foreach (var i in DataController.CurrentLayouts.Items) + this.listLayouts.Items.Add(i); + + // Wait for containers to be generated + await System.Threading.Tasks.Task.Delay(50); + + // Update visual stuff + foreach (var i in this.listLayouts.Items) + { + var it = i as DrumkitLayout; + + // Set up target views + var container = listLayouts.ItemContainerGenerator.ContainerFromItem(i) as FrameworkElement; + ToggleButton fi = UIHelper.FindChildByName(container, "toggleFilled") as ToggleButton; + ToggleButton la = UIHelper.FindChildByName(container, "toggleLandscape") as ToggleButton; + ToggleButton po = UIHelper.FindChildByName(container, "togglePortrait") as ToggleButton; + ToggleButton sn = UIHelper.FindChildByName(container, "toggleSnapped") as ToggleButton; + + if (fi != null) fi.IsChecked = (it.TargetView & DrumkitLayoutTargetView.Filled) > 0; + if (la != null) la.IsChecked = (it.TargetView & DrumkitLayoutTargetView.Landscape) > 0; + if (po != null) po.IsChecked = (it.TargetView & DrumkitLayoutTargetView.Portrait) > 0; + if (sn != null) sn.IsChecked = (it.TargetView & DrumkitLayoutTargetView.Snapped) > 0; + + // Is active? + if (it.IsDefault) + { + // Change grid look + Grid g = UIHelper.FindChildByName(container, "theGrid") as Grid; + if (g != null) g.Background = new SolidColorBrush(Color.FromArgb(0x1f, 0xad, 0xff, 0x2f)); + } + } + } + + #endregion + + #region UI Handlers: Items + + /// + /// Handles layout name change. + /// + private void NameTextChanged(object sender, TextChangedEventArgs e) + { + // Get layout object + var textbox = sender as TextBox; + var layout = (sender as FrameworkElement).DataContext as DrumkitLayout; + int index = DataController.CurrentLayouts.Items.IndexOf(layout); + + // Change name + if (index != -1) + DataController.CurrentLayouts.Items[index].Name = textbox.Text; + + // Save changes + DataController.SaveLayout(); + } + + /// + /// Handles target view change. + /// + private void TogglesCommon(object sender, DrumkitLayoutTargetView view) + { + // Get layout object + var button = sender as ToggleButton; + var layout = (sender as FrameworkElement).DataContext as DrumkitLayout; + int i = DataController.CurrentLayouts.Items.IndexOf(layout); + + // Shouldn't happen + if (i == -1) + return; + + // Change target view value + if (button.IsChecked.HasValue && button.IsChecked.Value) + DataController.CurrentLayouts.Items[i].TargetView |= view; + + else DataController.CurrentLayouts.Items[i].TargetView &= ~view; + + // Save modified setting + DataController.SaveLayout(); + } + + /// + /// Handles "Landscape" toggle button. + /// + private void ToggleLandscape_Click(object sender, RoutedEventArgs e) + { + TogglesCommon(sender, DrumkitLayoutTargetView.Landscape); + } + + /// + /// Handles "Portrait" toggle button. + /// + private void TogglePortrait_Click(object sender, RoutedEventArgs e) + { + TogglesCommon(sender, DrumkitLayoutTargetView.Portrait); + } + + /// + /// Handles "Filled" toggle button. + /// + private void ToggleFilled_Click(object sender, RoutedEventArgs e) + { + TogglesCommon(sender, DrumkitLayoutTargetView.Filled); + } + + /// + /// Handles "Snapped" toggle button. + /// + private void ToggleSnapped_Click(object sender, RoutedEventArgs e) + { + TogglesCommon(sender, DrumkitLayoutTargetView.Snapped); + } + + #endregion + + #region UI Handlers: Buttons + + /// + /// Handles the "Create" button + /// + private void ButtonCreate_Click(object sender, RoutedEventArgs e) + { + // Create layout + DataController.CreateLayout(); + + // Reload list + this.ReloadLayouts(); + } + + private void ButtonEdit_Click(object sender, RoutedEventArgs e) + { + // Ignore if nothing selected + if (this.listLayouts.SelectedItem == null) + return; + + // Go to editor + if (Window.Current.Content is Frame) + { + Frame frame = (Frame)Window.Current.Content; + frame.Navigate(typeof(EditorPage), this.listLayouts.SelectedItem); + } + } + + /// + /// Handles the "Delete" button + /// + private async void ButtonDelete_Click(object sender, RoutedEventArgs e) + { + // Make sure there is at least one layout remaining + if (DataController.CurrentLayouts.Items.Count <= 1) + { + MessageDialog dialog = new MessageDialog("There has to be at least one layout remaining!", "Error"); + await dialog.ShowAsync(); + return; + } + + // Get layout object + var layout = listLayouts.SelectedItem as DrumkitLayout; + int i = DataController.CurrentLayouts.Items.IndexOf(layout); + + // Delete from list + DataController.CurrentLayouts.Items.Remove(layout); + + // Save changes + DataController.SaveLayout(); + + // Refresh list + this.ReloadLayouts(); + } + + /// + /// Handles the "Toggle active" button + /// + private void ButtonToggleActive_Click(object sender, RoutedEventArgs e) + { + // Get layout object + var layout = listLayouts.SelectedItem as DrumkitLayout; + int i = DataController.CurrentLayouts.Items.IndexOf(layout); + + // Find layout? + if (i != -1) + { + // Toggle active + DataController.CurrentLayouts.Items[i].IsDefault = !DataController.CurrentLayouts.Items[i].IsDefault; + + // Save modified setting + DataController.SaveLayout(); + + // Reload list + ReloadLayouts(); + } + } + + #endregion + + } +} diff --git a/DrumKit/UI/Settings/LogControl.xaml b/DrumKit/UI/Settings/LogControl.xaml new file mode 100644 index 0000000..48fac56 --- /dev/null +++ b/DrumKit/UI/Settings/LogControl.xaml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DrumKit/UI/Settings/LogControl.xaml.cs b/DrumKit/UI/Settings/LogControl.xaml.cs new file mode 100644 index 0000000..34b7316 --- /dev/null +++ b/DrumKit/UI/Settings/LogControl.xaml.cs @@ -0,0 +1,156 @@ +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.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 LogControl : UserControl + { + #region Constructor + /// + /// Creates a new instance of log page + /// + public LogControl() + { + this.InitializeComponent(); + this.Loaded += LogControl_Loaded; + } + + #endregion + + #region Initialization + /// + /// Initialization performed when the page is loaded. + /// + private async void LogControl_Loaded(object sender, RoutedEventArgs e) + { + // Reload entries + await ReloadEntries(); + } + + private async Task ReloadEntries() + { + // Get list of log files + await Repository.LogRepository.ReadLogFiles(); + + // Create list + this.logEntriesList.Items.Clear(); + foreach (DateTime i in Repository.LogRepository.Dates) + this.logEntriesList.Items.Add(i); + + // Set selected item + int index = Repository.LogRepository.Dates.IndexOf(Repository.LogRepository.CurrentLogDate); + this.logEntriesList.SelectedIndex = index; + } + + #endregion + + #region UI Events + + /// + /// Handles selection changed action. + /// + private void LogEntriesList_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + // Load selected log file + if (logEntriesList.SelectedItem is DateTime) + LoadLogFile((DateTime)logEntriesList.SelectedItem); + } + + /// + /// Handles clear button + /// + private async void ButtonClear_Click(object sender, RoutedEventArgs e) + { + await Repository.LogRepository.Clear(); + await this.ReloadEntries(); + } + + /// + /// Handles saving currently selected log file. + /// + /// + /// + private async void ButtonSave_Click(object sender, RoutedEventArgs e) + { + // Sanity check + if (!(logEntriesList.SelectedItem is DateTime)) return; + + // Pick a destination folder + var picker = new Windows.Storage.Pickers.FolderPicker(); + picker.FileTypeFilter.Add("*"); + picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; + var destination = await picker.PickSingleFolderAsync(); + + // Save + if (destination != null) + await Repository.LogRepository.SaveAs((DateTime)logEntriesList.SelectedItem, destination); + } + + #endregion + + #region Misc + /// + /// Loads a log file, and converts it to html for display. + /// + private async void LoadLogFile(DateTime dt) + { + // Get file contents + var lines = await Repository.LogRepository.ReadLog(dt); + + // Generate HTML + System.Text.StringBuilder html = new System.Text.StringBuilder(); + + html.Append(""); + + foreach (var i in lines) + { + if (i.Contains("ERROR")) + { + html.Append("

"); + html.Append(i); + html.Append("

"); + } + + else if (i.Contains("EXCEPTION")) + { + html.Append("

"); + html.Append(i); + html.Append("

"); + } + + else if (i.TrimStart(' ').StartsWith("at")) + { + html.Insert(html.Length - 4, "
" + i); + } + + else + { + html.Append("

"); + html.Append(i); + html.Append("

"); + } + } + + html.Append(""); + + // Set text + this.logText.NavigateToString(html.ToString()); + } + + #endregion + } +} diff --git a/DrumKit/UI/SettingsPage.xaml b/DrumKit/UI/SettingsPage.xaml new file mode 100644 index 0000000..5a590ad --- /dev/null +++ b/DrumKit/UI/SettingsPage.xaml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +