mirror of
https://github.com/chibicitiberiu/drumkit.git
synced 2024-02-24 10:53:32 +00:00
Latest build (version 2.2)
This commit is contained in:
108
DrumKit/UI/Settings/DrumkitsSettingsControl.xaml
Normal file
108
DrumKit/UI/Settings/DrumkitsSettingsControl.xaml
Normal file
@ -0,0 +1,108 @@
|
||||
<UserControl
|
||||
x:Class="DrumKit.DrumkitsSettingsControl"
|
||||
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="321.429"
|
||||
d:DesignWidth="696.617">
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Common/TextButtonStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
|
||||
<DataTemplate x:Key="DrumkitListDataTemplate">
|
||||
<Grid Name="theGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Left thing -->
|
||||
<Border Name="orangeBorder"
|
||||
Grid.Column="0" Grid.RowSpan="3"
|
||||
Background="OrangeRed" Width="10" />
|
||||
|
||||
<!--<Image MinWidth="10"
|
||||
Source="{Binding Thumbnail}" />-->
|
||||
|
||||
<!-- Name -->
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Margin="15,2,15,0"
|
||||
FontSize="15.3"
|
||||
Style="{StaticResource MyTextBoxStyle}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Name}"
|
||||
TextChanged="NameTextChanged"/>
|
||||
|
||||
<!-- Description -->
|
||||
<TextBox Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Margin="15,0,15,2"
|
||||
Style="{StaticResource MyTextBoxStyle}"
|
||||
Text="{Binding Description}"
|
||||
TextChanged="DescriptionTextChanged"
|
||||
FontSize="13"
|
||||
FontStyle="Italic"
|
||||
IsReadOnly="True"
|
||||
AcceptsReturn="True"
|
||||
TextWrapping="Wrap"
|
||||
Height="80" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</DataTemplate>
|
||||
|
||||
<Style x:Key="ListViewStretchItemStyle" TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Drumkit list -->
|
||||
<ListView Name="listDrumkits"
|
||||
Grid.Row="0" Grid.Column="0"
|
||||
ItemTemplate="{StaticResource DrumkitListDataTemplate}"
|
||||
ItemContainerStyle="{StaticResource ListViewStretchItemStyle}"
|
||||
SelectionMode="Single" >
|
||||
|
||||
</ListView>
|
||||
|
||||
<ProgressRing
|
||||
Name="progressRing"
|
||||
Foreground="White"
|
||||
Width="50" Height="50" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||
<!--<Button Style="{StaticResource MyButtonStyle}" Click="ButtonCreate_Click">Create</Button>-->
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonImport_Click">Import</Button>
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonExport_Click">Export</Button>
|
||||
<Border Width="20" />
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonDelete_Click">Delete</Button>
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonSetCurrent_Clicked">Set current</Button>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
319
DrumKit/UI/Settings/DrumkitsSettingsControl.xaml.cs
Normal file
319
DrumKit/UI/Settings/DrumkitsSettingsControl.xaml.cs
Normal file
@ -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
|
||||
/// <summary>
|
||||
/// Creates a new instance of DrumkitsSettingsControl
|
||||
/// </summary>
|
||||
public DrumkitsSettingsControl()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Loaded += DrumkitsSettingsControl_Loaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads drumkit list at startup
|
||||
/// </summary>
|
||||
void DrumkitsSettingsControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ReloadDrumkits();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Reload drumkit list
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the list of drumkits from the data controller
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// Handles drumkit name change
|
||||
/// </summary>
|
||||
private void NameTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
var drumkit = (sender as FrameworkElement).DataContext as Drumkit;
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles drumkit description change
|
||||
/// </summary>
|
||||
private void DescriptionTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
var drumkit = (sender as FrameworkElement).DataContext as Drumkit;
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI Handlers: Buttons
|
||||
/// <summary>
|
||||
/// Handles the Create button
|
||||
/// </summary>
|
||||
private void ButtonCreate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Import button
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Delete button
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Export button
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SetCurrent button
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UI Command that restarts the application, when current drumkit changes
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
164
DrumKit/UI/Settings/DrumsSettingsControl.xaml
Normal file
164
DrumKit/UI/Settings/DrumsSettingsControl.xaml
Normal file
@ -0,0 +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>
|
236
DrumKit/UI/Settings/DrumsSettingsControl.xaml.cs
Normal file
236
DrumKit/UI/Settings/DrumsSettingsControl.xaml.cs
Normal file
@ -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
|
||||
/// <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
|
||||
|
||||
}
|
||||
}
|
26
DrumKit/UI/Settings/ExperimentsSettingsControl.xaml
Normal file
26
DrumKit/UI/Settings/ExperimentsSettingsControl.xaml
Normal file
@ -0,0 +1,26 @@
|
||||
<UserControl
|
||||
x:Class="DrumKit.ExperimentsSettingsControl"
|
||||
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">
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Common/TextButtonStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Canvas Name="canvas">
|
||||
<StackPanel>
|
||||
<TextBox Style="{StaticResource MyTextBoxStyle}" Width="200" Text="Hello world!"/>
|
||||
</StackPanel>
|
||||
|
||||
</Canvas>
|
||||
</UserControl>
|
31
DrumKit/UI/Settings/ExperimentsSettingsControl.xaml.cs
Normal file
31
DrumKit/UI/Settings/ExperimentsSettingsControl.xaml.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
174
DrumKit/UI/Settings/GeneralSettingsControl.xaml
Normal file
174
DrumKit/UI/Settings/GeneralSettingsControl.xaml
Normal file
@ -0,0 +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>
|
120
DrumKit/UI/Settings/GeneralSettingsControl.xaml.cs
Normal file
120
DrumKit/UI/Settings/GeneralSettingsControl.xaml.cs
Normal file
@ -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();
|
||||
}
|
||||
|
||||
/// <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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
92
DrumKit/UI/Settings/LayoutsSettingsControl.xaml
Normal file
92
DrumKit/UI/Settings/LayoutsSettingsControl.xaml
Normal file
@ -0,0 +1,92 @@
|
||||
<UserControl
|
||||
x:Class="DrumKit.LayoutsSettingsControl"
|
||||
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">
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<DataTemplate x:Key="DrumkitListDataTemplate">
|
||||
<Grid Name="theGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Left thing -->
|
||||
<Border Name="greenBorder"
|
||||
Grid.Column="0" Grid.RowSpan="3"
|
||||
Background="GreenYellow" Width="10" />
|
||||
|
||||
<!-- Name -->
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Margin="15,2,15,0"
|
||||
FontSize="15.3"
|
||||
Style="{StaticResource MyTextBoxStyle}"
|
||||
Text="{Binding Name}"
|
||||
TextChanged="NameTextChanged" />
|
||||
|
||||
<!-- Description -->
|
||||
<StackPanel Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Margin="15,0,15,2"
|
||||
Orientation="Horizontal">
|
||||
<ToggleButton Name="toggleLandscape" Click="ToggleLandscape_Click">Landscape</ToggleButton>
|
||||
<ToggleButton Name="togglePortrait" Click="TogglePortrait_Click">Portrait</ToggleButton>
|
||||
<ToggleButton Name="toggleFilled" Click="ToggleFilled_Click">Filled</ToggleButton>
|
||||
<ToggleButton Name="toggleSnapped" Click="ToggleSnapped_Click">Snapped</ToggleButton>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</DataTemplate>
|
||||
|
||||
<Style x:Key="ListViewStretchItemStyle" TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Drumkit list -->
|
||||
<ListView Name="listLayouts"
|
||||
Grid.Row="0" Grid.Column="0"
|
||||
ItemTemplate="{StaticResource DrumkitListDataTemplate}"
|
||||
ItemContainerStyle="{StaticResource ListViewStretchItemStyle}"
|
||||
SelectionMode="Single" >
|
||||
|
||||
<local:DrumkitLayout IsDefault="True" Name="Hello world" TargetViewSerialize="All" />
|
||||
|
||||
<TextBlock>Hello world!</TextBlock>
|
||||
|
||||
</ListView>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonCreate_Click">Create</Button>
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonEdit_Click">Edit</Button>
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonDelete_Click">Delete</Button>
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonToggleActive_Click">Toggle active</Button>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
248
DrumKit/UI/Settings/LayoutsSettingsControl.xaml.cs
Normal file
248
DrumKit/UI/Settings/LayoutsSettingsControl.xaml.cs
Normal file
@ -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
|
||||
/// <summary>
|
||||
/// Creates a new instance of LayoutsSettingsControl
|
||||
/// </summary>
|
||||
public LayoutsSettingsControl()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Loaded += LayoutsSettingsControl_Loaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads layout list at startup
|
||||
/// </summary>
|
||||
void LayoutsSettingsControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ReloadLayouts();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Reloads the list of layouts
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the list of layouts
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Handles layout name change.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles target view change.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles "Landscape" toggle button.
|
||||
/// </summary>
|
||||
private void ToggleLandscape_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TogglesCommon(sender, DrumkitLayoutTargetView.Landscape);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles "Portrait" toggle button.
|
||||
/// </summary>
|
||||
private void TogglePortrait_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TogglesCommon(sender, DrumkitLayoutTargetView.Portrait);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles "Filled" toggle button.
|
||||
/// </summary>
|
||||
private void ToggleFilled_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TogglesCommon(sender, DrumkitLayoutTargetView.Filled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles "Snapped" toggle button.
|
||||
/// </summary>
|
||||
private void ToggleSnapped_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TogglesCommon(sender, DrumkitLayoutTargetView.Snapped);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI Handlers: Buttons
|
||||
|
||||
/// <summary>
|
||||
/// Handles the "Create" button
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the "Delete" button
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the "Toggle active" button
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
}
|
||||
}
|
37
DrumKit/UI/Settings/LogControl.xaml
Normal file
37
DrumKit/UI/Settings/LogControl.xaml
Normal file
@ -0,0 +1,37 @@
|
||||
<UserControl
|
||||
x:Class="DrumKit.LogControl"
|
||||
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>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="2.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListView Name="logEntriesList" Grid.Column="0" Margin="5"
|
||||
Background="#3FFF"
|
||||
SelectionChanged="LogEntriesList_SelectionChanged"/>
|
||||
|
||||
<Rectangle Name="logTextPlaceholder" Grid.Column="1" Margin="0,5,5,5" />
|
||||
<WebView Name="logText" Grid.Column="1" Margin="0,5,5,5"/>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="5" Orientation="Horizontal">
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonSave_Click">Save as</Button>
|
||||
<Button Style="{StaticResource MyButtonStyle}" Click="ButtonClear_Click">Delete all</Button>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
156
DrumKit/UI/Settings/LogControl.xaml.cs
Normal file
156
DrumKit/UI/Settings/LogControl.xaml.cs
Normal file
@ -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
|
||||
/// <summary>
|
||||
/// Creates a new instance of log page
|
||||
/// </summary>
|
||||
public LogControl()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Loaded += LogControl_Loaded;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
/// <summary>
|
||||
/// Initialization performed when the page is loaded.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Handles selection changed action.
|
||||
/// </summary>
|
||||
private void LogEntriesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// Load selected log file
|
||||
if (logEntriesList.SelectedItem is DateTime)
|
||||
LoadLogFile((DateTime)logEntriesList.SelectedItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles clear button
|
||||
/// </summary>
|
||||
private async void ButtonClear_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Repository.LogRepository.Clear();
|
||||
await this.ReloadEntries();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles saving currently selected log file.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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
|
||||
/// <summary>
|
||||
/// Loads a log file, and converts it to html for display.
|
||||
/// </summary>
|
||||
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("<html><body style=\"font-family: Helvetica;\">");
|
||||
|
||||
foreach (var i in lines)
|
||||
{
|
||||
if (i.Contains("ERROR"))
|
||||
{
|
||||
html.Append("<p style=\"color: red;\">");
|
||||
html.Append(i);
|
||||
html.Append("</p>");
|
||||
}
|
||||
|
||||
else if (i.Contains("EXCEPTION"))
|
||||
{
|
||||
html.Append("<p style=\"background-color: darkred; color: white;\">");
|
||||
html.Append(i);
|
||||
html.Append("</p>");
|
||||
}
|
||||
|
||||
else if (i.TrimStart(' ').StartsWith("at"))
|
||||
{
|
||||
html.Insert(html.Length - 4, "<br />" + i);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
html.Append("<p>");
|
||||
html.Append(i);
|
||||
html.Append("</p>");
|
||||
}
|
||||
}
|
||||
|
||||
html.Append("</body></html>");
|
||||
|
||||
// Set text
|
||||
this.logText.NavigateToString(html.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user