Add enable/disable DropSound buttons.
This commit is contained in:
parent
a20c988380
commit
19957659d1
@ -77,6 +77,8 @@ namespace Filtration.ViewModels
|
||||
RelayCommand<bool> ToggleShowAdvancedCommand { get; }
|
||||
RelayCommand ClearFilterCommand { get; }
|
||||
RelayCommand ClearStylesCommand { get; }
|
||||
RelayCommand EnableDropSoundsCommand { get; }
|
||||
RelayCommand DisableDropSoundsCommand { get; }
|
||||
|
||||
void AddCommentBlock(IItemFilterBlockViewModelBase targetBlockViewModelBase);
|
||||
void AddBlock(IItemFilterBlockViewModelBase targetBlockViewModelBase);
|
||||
@ -180,6 +182,8 @@ namespace Filtration.ViewModels
|
||||
CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand);
|
||||
ExpandAllSectionsCommand = new RelayCommand(ExpandAllSections);
|
||||
CollapseAllSectionsCommand = new RelayCommand(CollapseAllSections);
|
||||
EnableDropSoundsCommand = new RelayCommand(OnEnableDropSoundsCommand, CanModifySelectedBlocks);
|
||||
DisableDropSoundsCommand = new RelayCommand(OnDisableDropSoundsCommand, CanModifySelectedBlocks);
|
||||
|
||||
var icon = new BitmapImage();
|
||||
icon.BeginInit();
|
||||
@ -421,6 +425,8 @@ namespace Filtration.ViewModels
|
||||
public RelayCommand CollapseAllBlocksCommand { get; }
|
||||
public RelayCommand ExpandAllSectionsCommand { get; }
|
||||
public RelayCommand CollapseAllSectionsCommand { get; }
|
||||
public RelayCommand EnableDropSoundsCommand { get; }
|
||||
public RelayCommand DisableDropSoundsCommand { get; }
|
||||
|
||||
public bool IsActiveDocument
|
||||
{
|
||||
@ -1284,6 +1290,61 @@ namespace Filtration.ViewModels
|
||||
SetDirtyFlag();
|
||||
}
|
||||
|
||||
public void OnEnableDropSoundsCommand()
|
||||
{
|
||||
ValidateSelectedBlocks();
|
||||
|
||||
var modified = false;
|
||||
|
||||
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterBlockViewModel>())
|
||||
{
|
||||
var blockItems= block.Block.BlockItems;
|
||||
for (var i = 0; i < blockItems.Count; i++)
|
||||
{
|
||||
if (blockItems[i] is DisableDropSoundBlockItem)
|
||||
{
|
||||
blockItems.RemoveAt(i--);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (modified)
|
||||
{
|
||||
SetDirtyFlag();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDisableDropSoundsCommand()
|
||||
{
|
||||
ValidateSelectedBlocks();
|
||||
|
||||
var modified = false;
|
||||
|
||||
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterBlockViewModel>())
|
||||
{
|
||||
var blockItems = block.Block.BlockItems;
|
||||
var found = false;
|
||||
foreach (var item in blockItems)
|
||||
{
|
||||
if (item is DisableDropSoundBlockItem)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
var item = new DisableDropSoundBlockItem(true);
|
||||
blockItems.Add(item);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (modified) {
|
||||
SetDirtyFlag();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBlockBecameDirty(object sender, EventArgs e)
|
||||
{
|
||||
SetDirtyFlag();
|
||||
|
@ -129,6 +129,9 @@ namespace Filtration.ViewModels
|
||||
ApplyThemeToScriptCommand = new RelayCommand(async () => await OnApplyThemeToScriptCommandAsync(), () => ActiveDocumentIsScript);
|
||||
EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript);
|
||||
|
||||
EnableDropSoundsCommand = new RelayCommand(OnEnableDropSoundsCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock && ActiveScriptCanModifySelectedBlocks);
|
||||
DisableDropSoundsCommand = new RelayCommand(OnDisableDropSoundsCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock && ActiveScriptCanModifySelectedBlocks);
|
||||
|
||||
AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
@ -230,6 +233,9 @@ namespace Filtration.ViewModels
|
||||
public RelayCommand CreateThemeCommand { get; }
|
||||
public RelayCommand ApplyThemeToScriptCommand { get; }
|
||||
|
||||
public RelayCommand EnableDropSoundsCommand { get; }
|
||||
public RelayCommand DisableDropSoundsCommand { get; }
|
||||
|
||||
public RelayCommand AddTextColorThemeComponentCommand { get; }
|
||||
public RelayCommand AddBackgroundColorThemeComponentCommand { get; }
|
||||
public RelayCommand AddBorderColorThemeComponentCommand { get; }
|
||||
@ -402,7 +408,7 @@ namespace Filtration.ViewModels
|
||||
OpenTheme(themeViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OpenTheme(IThemeEditorViewModel themeEditorViewModel)
|
||||
{
|
||||
if (AvalonDockWorkspaceViewModel.OpenDocuments.Contains(themeEditorViewModel))
|
||||
@ -724,11 +730,37 @@ namespace Filtration.ViewModels
|
||||
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent);
|
||||
}
|
||||
|
||||
private void OnEnableDropSoundsCommand()
|
||||
{
|
||||
var result = _messageBoxService.Show("Confirm",
|
||||
"Are you sure you wish to enable drop sounds on all selected blocks?",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.EnableDropSoundsCommand.Execute(null);
|
||||
}
|
||||
|
||||
private void OnDisableDropSoundsCommand()
|
||||
{
|
||||
var result = _messageBoxService.Show("Confirm",
|
||||
"Are you sure you wish to disable drop sounds on all selected blocks?",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.DisableDropSoundsCommand.Execute(null);
|
||||
}
|
||||
|
||||
public async Task<bool> CloseAllDocumentsAsync()
|
||||
{
|
||||
Settings.Default.LastOpenScripts = string.Join("|", _avalonDockWorkspaceViewModel.OpenDocuments.OfType<IItemFilterScriptViewModel>().Select(sc => sc.Script.FilePath));
|
||||
var openDocuments = _avalonDockWorkspaceViewModel.OpenDocuments.OfType<IEditableDocument>().ToList();
|
||||
|
||||
|
||||
foreach (var document in openDocuments)
|
||||
{
|
||||
if (!_avalonDockWorkspaceViewModel.OpenDocuments.Contains(document))
|
||||
|
@ -35,4 +35,6 @@
|
||||
<Image Source="/Filtration;component/Resources/Icons/ThemeComponentDelete.ico" x:Key="ThemeComponentDeleteIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/standby_enabled_icon.png" x:Key="StandbyEnabledIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/standby_disabled_icon.png" x:Key="StandbyDisabledIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/standby_enabled_icon.png" x:Key="EnableDropSoundsIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/standby_disabled_icon.png" x:Key="DisableDropSoundsIcon" x:Shared="False" />
|
||||
</ResourceDictionary>
|
@ -2,7 +2,7 @@
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
@ -64,12 +64,12 @@
|
||||
Background="ForestGreen"
|
||||
BorderBrush="ForestGreen"
|
||||
x:Name="ScriptToolsGroup"
|
||||
IsVisibleChanged="ScriptToolsGroup_OnIsVisibleChanged"
|
||||
IsVisibleChanged="ScriptToolsGroup_OnIsVisibleChanged"
|
||||
Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}" />
|
||||
<fluent:RibbonContextualTabGroup Header="Theme"
|
||||
Background="DodgerBlue"
|
||||
BorderBrush="DodgerBlue"
|
||||
x:Name="ThemeToolsGroup"
|
||||
x:Name="ThemeToolsGroup"
|
||||
IsVisibleChanged="ThemeToolsGroup_OnIsVisibleChanged"
|
||||
Visibility="{Binding ActiveDocumentIsTheme, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}" />
|
||||
</fluent:Ribbon.ContextualGroups>
|
||||
@ -125,6 +125,10 @@
|
||||
<fluent:Button Header="Create Theme" Command="{Binding CreateThemeCommand}" Icon="{StaticResource ThemeIcon}" LargeIcon="{StaticResource ThemeIcon}" />
|
||||
<fluent:Button Header="Replace Colours" Command="{Binding ReplaceColorsCommand}" Icon="{StaticResource ReplaceColorsIcon}" LargeIcon="{StaticResource ReplaceColorsIcon}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
<fluent:RibbonGroupBox Header="Helpers">
|
||||
<fluent:Button Header="Enable Drop Sounds" Command="{Binding EnableDropSoundsCommand}" SizeDefinition="Middle" Icon="{StaticResource EnableDropSoundsIcon}" LargeIcon="{StaticResource EnableDropSoundsIcon}" />
|
||||
<fluent:Button Header="Disable Drop Sounds" Command="{Binding DisableDropSoundsCommand}" SizeDefinition="Middle" Icon="{StaticResource DisableDropSoundsIcon}" LargeIcon="{StaticResource DisableDropSoundsIcon}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
<fluent:RibbonTabItem x:Name="ThemeToolsTabItem" Header="Theme Tools" Group="{Binding ElementName=ThemeToolsGroup}" Visibility="{Binding ActiveDocumentIsTheme, Converter={StaticResource BooleanVisibilityConverter}, Mode=OneWay}">
|
||||
<fluent:RibbonGroupBox Header="Add Components">
|
||||
@ -172,5 +176,4 @@
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</fluent:RibbonWindow>
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user