* Added auto-expand sections on open setting
* Changed all sections to be expanded unless the new setting is disabled * Tidied up some casting in ItemFilterScriptViewModel by using pattern matching
This commit is contained in:
parent
6838cb12a8
commit
ba6d50cf45
|
@ -55,9 +55,12 @@
|
||||||
<setting name="WindowHeight" serializeAs="String">
|
<setting name="WindowHeight" serializeAs="String">
|
||||||
<value>800</value>
|
<value>800</value>
|
||||||
</setting>
|
</setting>
|
||||||
<setting name="LastActiveDocument" serializeAs="String">
|
<setting name="LastOpenScripts" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="BlocksExpandedOnOpen" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
</Filtration.Properties.Settings>
|
</Filtration.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<runtime>
|
<runtime>
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<copyright>Copyright 2018</copyright>
|
<copyright>Copyright 2018</copyright>
|
||||||
<releaseNotes>* All open filter scripts are now remembered on exit and reopened when the application is started rather than just the last opened one (#95)
|
<releaseNotes>* All open filter scripts are now remembered on exit and reopened when the application is started rather than just the last opened one (#95)
|
||||||
|
* Filter sections are once again now expanded by default when scripts are opened, unless the new "Auto-expand all sections when opening scripts" setting is disabled
|
||||||
* A new Clear Styles button has been added which removes all styles from the selected block (#96)
|
* A new Clear Styles button has been added which removes all styles from the selected block (#96)
|
||||||
|
* Fixed theme saving (blank theme files were being saved) (#83)
|
||||||
* Fixed checkboxes in Block Group Browser (#97)
|
* Fixed checkboxes in Block Group Browser (#97)
|
||||||
* Fixed the Select Path of Exile data directory dialog appearing after every upgrade (#94)
|
* Fixed the Select Path of Exile data directory dialog appearing after every upgrade (#94)
|
||||||
* Fixed an issue where custom sounds were only populated from the default Path of Exile data directory rather than the configured directory
|
* Fixed an issue where custom sounds were only populated from the default Path of Exile data directory rather than the configured directory
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Filtration.Properties {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
@ -229,5 +229,17 @@ namespace Filtration.Properties {
|
||||||
this["LastOpenScripts"] = value;
|
this["LastOpenScripts"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool BlocksExpandedOnOpen {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["BlocksExpandedOnOpen"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["BlocksExpandedOnOpen"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,11 @@
|
||||||
<Setting Name="WindowHeight" Type="System.Int32" Scope="User">
|
<Setting Name="WindowHeight" Type="System.Int32" Scope="User">
|
||||||
<Value Profile="(Default)">800</Value>
|
<Value Profile="(Default)">800</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting Name="LastActiveDocument" Type="System.String" Scope="User">
|
<Setting Name="LastOpenScripts" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="BlocksExpandedOnOpen" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
|
@ -12,6 +12,8 @@ namespace Filtration.ViewModels.DesignTime
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool BlocksExpandedOnOpen { get; set; }
|
||||||
|
|
||||||
public bool ExtraLineBetweenBlocks
|
public bool ExtraLineBetweenBlocks
|
||||||
{
|
{
|
||||||
get => true;
|
get => true;
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
internal interface IItemFilterBlockViewModelBase
|
internal interface IItemFilterBlockViewModelBase
|
||||||
{
|
{
|
||||||
void Initialise(IItemFilterBlockBase itemfilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel);
|
void Initialise(IItemFilterBlockBase itemFilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel);
|
||||||
IItemFilterBlockBase BaseBlock { get; }
|
IItemFilterBlockBase BaseBlock { get; }
|
||||||
bool IsDirty { get; set; }
|
bool IsDirty { get; set; }
|
||||||
bool IsVisible { get; set; }
|
bool IsVisible { get; set; }
|
||||||
|
@ -25,9 +25,9 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void Initialise(IItemFilterBlockBase itemfilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel)
|
public virtual void Initialise(IItemFilterBlockBase itemFilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel)
|
||||||
{
|
{
|
||||||
BaseBlock = itemfilterBlock;
|
BaseBlock = itemFilterBlock;
|
||||||
_parentScriptViewModel = itemFilterScriptViewModel;
|
_parentScriptViewModel = itemFilterScriptViewModel;
|
||||||
|
|
||||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand);
|
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand);
|
||||||
|
|
|
@ -10,7 +10,8 @@ namespace Filtration.ViewModels
|
||||||
IItemFilterCommentBlock ItemFilterCommentBlock { get; }
|
IItemFilterCommentBlock ItemFilterCommentBlock { get; }
|
||||||
string Comment { get; }
|
string Comment { get; }
|
||||||
bool IsExpanded { get; set; }
|
bool IsExpanded { get; set; }
|
||||||
bool HasVisibleChild { get; }
|
bool HasVisibleChild { get; }
|
||||||
|
int ChildCount { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ItemFilterCommentBlockViewModel : ItemFilterBlockViewModelBase, IItemFilterCommentBlockViewModel
|
internal class ItemFilterCommentBlockViewModel : ItemFilterBlockViewModelBase, IItemFilterCommentBlockViewModel
|
||||||
|
@ -28,13 +29,13 @@ namespace Filtration.ViewModels
|
||||||
ToggleSectionCommand = new RelayCommand(OnToggleSectionCommand);
|
ToggleSectionCommand = new RelayCommand(OnToggleSectionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialise(IItemFilterBlockBase itemfilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel)
|
public override void Initialise(IItemFilterBlockBase itemFilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel)
|
||||||
{
|
{
|
||||||
_parentScriptViewModel = itemFilterScriptViewModel;
|
_parentScriptViewModel = itemFilterScriptViewModel;
|
||||||
ItemFilterCommentBlock = itemfilterBlock as IItemFilterCommentBlock;
|
ItemFilterCommentBlock = itemFilterBlock as IItemFilterCommentBlock;
|
||||||
BaseBlock = ItemFilterCommentBlock;
|
BaseBlock = ItemFilterCommentBlock;
|
||||||
|
|
||||||
base.Initialise(itemfilterBlock, itemFilterScriptViewModel);
|
base.Initialise(itemFilterBlock, itemFilterScriptViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelayCommand ToggleSectionCommand { get; }
|
public RelayCommand ToggleSectionCommand { get; }
|
||||||
|
@ -43,10 +44,7 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
public string Comment
|
public string Comment
|
||||||
{
|
{
|
||||||
get
|
get => ItemFilterCommentBlock.Comment;
|
||||||
{
|
|
||||||
return ItemFilterCommentBlock.Comment;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (ItemFilterCommentBlock.Comment != value)
|
if (ItemFilterCommentBlock.Comment != value)
|
||||||
|
|
|
@ -37,11 +37,11 @@ namespace Filtration.ViewModels
|
||||||
IEnumerable<IItemFilterCommentBlockViewModel> ItemFilterCommentBlockViewModels { get; }
|
IEnumerable<IItemFilterCommentBlockViewModel> ItemFilterCommentBlockViewModels { get; }
|
||||||
ObservableCollection<string> CustomSoundsAvailable { get; }
|
ObservableCollection<string> CustomSoundsAvailable { get; }
|
||||||
Predicate<IItemFilterBlockViewModel> BlockFilterPredicate { get; set; }
|
Predicate<IItemFilterBlockViewModel> BlockFilterPredicate { get; set; }
|
||||||
|
|
||||||
bool ShowAdvanced { get; }
|
bool ShowAdvanced { get; }
|
||||||
string Description { get; set; }
|
string Description { get; set; }
|
||||||
string DisplayName { get; }
|
string DisplayName { get; }
|
||||||
|
|
||||||
void Initialise(IItemFilterScript itemFilterScript, bool newScript);
|
void Initialise(IItemFilterScript itemFilterScript, bool newScript);
|
||||||
void RemoveDirtyFlag();
|
void RemoveDirtyFlag();
|
||||||
void SetDirtyFlag();
|
void SetDirtyFlag();
|
||||||
|
@ -63,7 +63,7 @@ namespace Filtration.ViewModels
|
||||||
RelayCommand MoveBlockUpCommand { get; }
|
RelayCommand MoveBlockUpCommand { get; }
|
||||||
RelayCommand MoveBlockDownCommand { get; }
|
RelayCommand MoveBlockDownCommand { get; }
|
||||||
RelayCommand MoveBlockToTopCommand { get; }
|
RelayCommand MoveBlockToTopCommand { get; }
|
||||||
RelayCommand MoveBlockToBottomCommand { get;}
|
RelayCommand MoveBlockToBottomCommand { get; }
|
||||||
RelayCommand CopyBlockCommand { get; }
|
RelayCommand CopyBlockCommand { get; }
|
||||||
RelayCommand PasteBlockCommand { get; }
|
RelayCommand PasteBlockCommand { get; }
|
||||||
RelayCommand CopyBlockStyleCommand { get; }
|
RelayCommand CopyBlockStyleCommand { get; }
|
||||||
|
@ -105,17 +105,13 @@ namespace Filtration.ViewModels
|
||||||
private readonly IItemFilterPersistenceService _persistenceService;
|
private readonly IItemFilterPersistenceService _persistenceService;
|
||||||
private readonly IMessageBoxService _messageBoxService;
|
private readonly IMessageBoxService _messageBoxService;
|
||||||
private readonly IClipboardService _clipboardService;
|
private readonly IClipboardService _clipboardService;
|
||||||
private readonly IBlockGroupHierarchyBuilder _blockGroupHierarchyBuilder;
|
|
||||||
|
|
||||||
private bool _isDirty;
|
private bool _isDirty;
|
||||||
private readonly ObservableCollection<IItemFilterBlockViewModelBase> _selectedBlockViewModels;
|
|
||||||
private IItemFilterCommentBlockViewModel _sectionBrowserSelectedBlockViewModel;
|
private IItemFilterCommentBlockViewModel _sectionBrowserSelectedBlockViewModel;
|
||||||
private readonly ObservableCollection<IItemFilterBlockViewModelBase> _itemFilterBlockViewModels;
|
|
||||||
private Predicate<IItemFilterBlockViewModel> _blockFilterPredicate;
|
private Predicate<IItemFilterBlockViewModel> _blockFilterPredicate;
|
||||||
private ICommandManager _scriptCommandManager;
|
private ICommandManager _scriptCommandManager;
|
||||||
|
|
||||||
private ObservableCollection<string> _customSoundsAvailable;
|
private ObservableCollection<string> _customSoundsAvailable;
|
||||||
private ListCollectionView _viewItemFilterBlockViewModels;
|
|
||||||
private readonly List<IItemFilterBlockViewModelBase> _lastAddedBlocks;
|
private readonly List<IItemFilterBlockViewModelBase> _lastAddedBlocks;
|
||||||
|
|
||||||
public ItemFilterScriptViewModel(IItemFilterBlockBaseViewModelFactory itemFilterBlockBaseViewModelFactory,
|
public ItemFilterScriptViewModel(IItemFilterBlockBaseViewModelFactory itemFilterBlockBaseViewModelFactory,
|
||||||
|
@ -124,8 +120,7 @@ namespace Filtration.ViewModels
|
||||||
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
||||||
IItemFilterPersistenceService persistenceService,
|
IItemFilterPersistenceService persistenceService,
|
||||||
IMessageBoxService messageBoxService,
|
IMessageBoxService messageBoxService,
|
||||||
IClipboardService clipboardService,
|
IClipboardService clipboardService)
|
||||||
IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
|
|
||||||
{
|
{
|
||||||
_itemFilterBlockBaseViewModelFactory = itemFilterBlockBaseViewModelFactory;
|
_itemFilterBlockBaseViewModelFactory = itemFilterBlockBaseViewModelFactory;
|
||||||
_blockTranslator = blockTranslator;
|
_blockTranslator = blockTranslator;
|
||||||
|
@ -135,10 +130,9 @@ namespace Filtration.ViewModels
|
||||||
_persistenceService = persistenceService;
|
_persistenceService = persistenceService;
|
||||||
_messageBoxService = messageBoxService;
|
_messageBoxService = messageBoxService;
|
||||||
_clipboardService = clipboardService;
|
_clipboardService = clipboardService;
|
||||||
_blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
|
ItemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModelBase>();
|
||||||
_itemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModelBase>();
|
SelectedBlockViewModels = new ObservableCollection<IItemFilterBlockViewModelBase>();
|
||||||
_selectedBlockViewModels = new ObservableCollection<IItemFilterBlockViewModelBase>();
|
SelectedBlockViewModels.CollectionChanged += (s, e) =>
|
||||||
_selectedBlockViewModels.CollectionChanged += (s, e) =>
|
|
||||||
{
|
{
|
||||||
RaisePropertyChanged(nameof(SelectedBlockViewModels));
|
RaisePropertyChanged(nameof(SelectedBlockViewModels));
|
||||||
RaisePropertyChanged(nameof(LastSelectedBlockViewModel));
|
RaisePropertyChanged(nameof(LastSelectedBlockViewModel));
|
||||||
|
@ -154,9 +148,9 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand);
|
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand);
|
||||||
ClearFilterCommand = new RelayCommand(OnClearFilterCommand, () => BlockFilterPredicate != null);
|
ClearFilterCommand = new RelayCommand(OnClearFilterCommand, () => BlockFilterPredicate != null);
|
||||||
ClearStylesCommand = new RelayCommand(OnClearStylesCommand, () => SelectedBlockViewModels.OfType<IItemFilterBlockViewModel>().Count() > 0);
|
ClearStylesCommand = new RelayCommand(OnClearStylesCommand, () => SelectedBlockViewModels.OfType<IItemFilterBlockViewModel>().Any());
|
||||||
CloseCommand = new RelayCommand(async () => await OnCloseCommand());
|
CloseCommand = new RelayCommand(async () => await OnCloseCommand());
|
||||||
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => CanModifySelectedBlocks());
|
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, CanModifySelectedBlocks);
|
||||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModels.Count > 0 && CanModifySelectedBlocks());
|
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModels.Count > 0 && CanModifySelectedBlocks());
|
||||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModels.Count > 0 && CanModifySelectedBlocks());
|
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModels.Count > 0 && CanModifySelectedBlocks());
|
||||||
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModels.Count == 1 && ViewItemFilterBlockViewModels.IndexOf(LastSelectedBlockViewModel) > 0);
|
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModels.Count == 1 && ViewItemFilterBlockViewModels.IndexOf(LastSelectedBlockViewModel) > 0);
|
||||||
|
@ -217,11 +211,14 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
Script.FilePath = "Untitled.filter";
|
Script.FilePath = "Untitled.filter";
|
||||||
}
|
}
|
||||||
|
|
||||||
Title = Filename;
|
Title = Filename;
|
||||||
ContentId = "ScriptContentId";
|
ContentId = "ScriptContentId";
|
||||||
|
|
||||||
CollapseAllSections();
|
if (!Settings.Default.BlocksExpandedOnOpen)
|
||||||
|
{
|
||||||
|
CollapseAllSections();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitialiseCustomSounds()
|
private void InitialiseCustomSounds()
|
||||||
|
@ -250,20 +247,20 @@ namespace Filtration.ViewModels
|
||||||
switch (notifyCollectionChangedEventArgs.Action)
|
switch (notifyCollectionChangedEventArgs.Action)
|
||||||
{
|
{
|
||||||
case NotifyCollectionChangedAction.Add:
|
case NotifyCollectionChangedAction.Add:
|
||||||
{
|
{
|
||||||
AddItemFilterBlockViewModels(notifyCollectionChangedEventArgs.NewItems.Cast<IItemFilterBlockBase>(), notifyCollectionChangedEventArgs.NewStartingIndex);
|
AddItemFilterBlockViewModels(notifyCollectionChangedEventArgs.NewItems.Cast<IItemFilterBlockBase>(), notifyCollectionChangedEventArgs.NewStartingIndex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NotifyCollectionChangedAction.Remove:
|
case NotifyCollectionChangedAction.Remove:
|
||||||
{
|
{
|
||||||
RemoveItemFilterBlockviewModels(notifyCollectionChangedEventArgs.OldItems.Cast<IItemFilterBlockBase>());
|
RemoveItemFilterBlockViewModels(notifyCollectionChangedEventArgs.OldItems.Cast<IItemFilterBlockBase>());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Debugger.Break(); // Unhandled NotifyCollectionChangedAction
|
Debugger.Break(); // Unhandled NotifyCollectionChangedAction
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateChildCount();
|
UpdateChildCount();
|
||||||
|
@ -294,8 +291,7 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
_lastAddedBlocks.Add(vm);
|
_lastAddedBlocks.Add(vm);
|
||||||
|
|
||||||
var itemBlock = itemFilterBlock as IItemFilterBlock;
|
if (itemFilterBlock is IItemFilterBlock itemBlock)
|
||||||
if (itemBlock != null)
|
|
||||||
{
|
{
|
||||||
foreach (var customSoundBlockItem in itemBlock.BlockItems.OfType<CustomSoundBlockItem>())
|
foreach (var customSoundBlockItem in itemBlock.BlockItems.OfType<CustomSoundBlockItem>())
|
||||||
{
|
{
|
||||||
|
@ -308,7 +304,7 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveItemFilterBlockviewModels(IEnumerable<IItemFilterBlockBase> itemFilterBlocks)
|
private void RemoveItemFilterBlockViewModels(IEnumerable<IItemFilterBlockBase> itemFilterBlocks)
|
||||||
{
|
{
|
||||||
foreach (var itemFilterBlock in itemFilterBlocks)
|
foreach (var itemFilterBlock in itemFilterBlocks)
|
||||||
{
|
{
|
||||||
|
@ -324,7 +320,7 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void UpdateFilteredBlockList()
|
private void UpdateFilteredBlockList()
|
||||||
{
|
{
|
||||||
ICollectionView filteredBlocks = CollectionViewSource.GetDefaultView(_itemFilterBlockViewModels);
|
ICollectionView filteredBlocks = CollectionViewSource.GetDefaultView(ItemFilterBlockViewModels);
|
||||||
filteredBlocks.Filter = BlockFilter;
|
filteredBlocks.Filter = BlockFilter;
|
||||||
|
|
||||||
ItemFilterCommentBlockViewModel previousSection = new ItemFilterCommentBlockViewModel();
|
ItemFilterCommentBlockViewModel previousSection = new ItemFilterCommentBlockViewModel();
|
||||||
|
@ -334,16 +330,16 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
previousSection.VisibleChildCount++;
|
previousSection.VisibleChildCount++;
|
||||||
}
|
}
|
||||||
else if (block is ItemFilterCommentBlockViewModel)
|
else if (block is ItemFilterCommentBlockViewModel model)
|
||||||
{
|
{
|
||||||
previousSection = block as ItemFilterCommentBlockViewModel;
|
previousSection = model;
|
||||||
previousSection.VisibleChildCount = 0;
|
previousSection.VisibleChildCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_viewItemFilterBlockViewModels = (ListCollectionView)CollectionViewSource.GetDefaultView(
|
ViewItemFilterBlockViewModels = (ListCollectionView)CollectionViewSource.GetDefaultView(
|
||||||
filteredBlocks.Cast<IItemFilterBlockViewModelBase>().ToList());
|
filteredBlocks.Cast<IItemFilterBlockViewModelBase>().ToList());
|
||||||
_viewItemFilterBlockViewModels.Filter = BlockVisibilityFilter;
|
ViewItemFilterBlockViewModels.Filter = BlockVisibilityFilter;
|
||||||
|
|
||||||
Messenger.Default.Send(new NotificationMessage("SectionsChanged"));
|
Messenger.Default.Send(new NotificationMessage("SectionsChanged"));
|
||||||
SelectedBlockViewModels.Clear();
|
SelectedBlockViewModels.Clear();
|
||||||
|
@ -360,24 +356,24 @@ namespace Filtration.ViewModels
|
||||||
previousSection.ChildCount++;
|
previousSection.ChildCount++;
|
||||||
block.IsVisible = previousSection.IsExpanded;
|
block.IsVisible = previousSection.IsExpanded;
|
||||||
}
|
}
|
||||||
else if (block is ItemFilterCommentBlockViewModel)
|
else if (block is ItemFilterCommentBlockViewModel model)
|
||||||
{
|
{
|
||||||
previousSection = block as ItemFilterCommentBlockViewModel;
|
previousSection = model;
|
||||||
previousSection.ChildCount = 0;
|
previousSection.ChildCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IItemFilterBlockViewModelBase> getChildren(IItemFilterCommentBlockViewModel targetBlockViewModel)
|
private List<IItemFilterBlockViewModelBase> GetChildren(IItemFilterCommentBlockViewModel targetBlockViewModel)
|
||||||
{
|
{
|
||||||
return ItemFilterBlockViewModels.ToList().GetRange(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1,
|
return ItemFilterBlockViewModels.ToList().GetRange(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1,
|
||||||
(targetBlockViewModel as ItemFilterCommentBlockViewModel).ChildCount);
|
targetBlockViewModel.ChildCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<int> getChildrenIndexes(IItemFilterCommentBlockViewModel targetBlockViewModel)
|
private List<int> GetChildrenIndexes(IItemFilterCommentBlockViewModel targetBlockViewModel)
|
||||||
{
|
{
|
||||||
return Enumerable.Range(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1,
|
return Enumerable.Range(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1,
|
||||||
(targetBlockViewModel as ItemFilterCommentBlockViewModel).ChildCount).ToList();
|
targetBlockViewModel.ChildCount).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ValidateSelectedBlocks()
|
private void ValidateSelectedBlocks()
|
||||||
|
@ -432,25 +428,16 @@ namespace Filtration.ViewModels
|
||||||
public ObservableCollection<string> CustomSoundsAvailable
|
public ObservableCollection<string> CustomSoundsAvailable
|
||||||
{
|
{
|
||||||
get => _customSoundsAvailable;
|
get => _customSoundsAvailable;
|
||||||
set
|
private set
|
||||||
{
|
{
|
||||||
_customSoundsAvailable = value;
|
_customSoundsAvailable = value;
|
||||||
RaisePropertyChanged();
|
RaisePropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListCollectionView ViewItemFilterBlockViewModels
|
public ListCollectionView ViewItemFilterBlockViewModels { get; private set; }
|
||||||
{
|
|
||||||
get => _viewItemFilterBlockViewModels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableCollection<IItemFilterBlockViewModelBase> ItemFilterBlockViewModels
|
public ObservableCollection<IItemFilterBlockViewModelBase> ItemFilterBlockViewModels { get; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _itemFilterBlockViewModels;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool BlockFilter(object item)
|
private bool BlockFilter(object item)
|
||||||
{
|
{
|
||||||
|
@ -555,7 +542,7 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
public bool HasSelectedCommentBlock()
|
public bool HasSelectedCommentBlock()
|
||||||
{
|
{
|
||||||
return SelectedBlockViewModels.OfType<IItemFilterCommentBlockViewModel>().Count() > 0;
|
return SelectedBlockViewModels.OfType<IItemFilterCommentBlockViewModel>().Any();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanModifySelectedBlocks()
|
public bool CanModifySelectedBlocks()
|
||||||
|
@ -586,18 +573,9 @@ namespace Filtration.ViewModels
|
||||||
return itemFilterCommentBlock.ChildCount == itemFilterCommentBlock.VisibleChildCount;
|
return itemFilterCommentBlock.ChildCount == itemFilterCommentBlock.VisibleChildCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<IItemFilterBlockViewModelBase> SelectedBlockViewModels
|
public ObservableCollection<IItemFilterBlockViewModelBase> SelectedBlockViewModels { get; }
|
||||||
{
|
|
||||||
get => _selectedBlockViewModels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IItemFilterBlockViewModelBase LastSelectedBlockViewModel
|
public IItemFilterBlockViewModelBase LastSelectedBlockViewModel => SelectedBlockViewModels.Count > 0 ? SelectedBlockViewModels.Last() : null;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return SelectedBlockViewModels.Count > 0 ? SelectedBlockViewModels.Last() : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IItemFilterCommentBlockViewModel CommentBlockBrowserBrowserSelectedBlockViewModel
|
public IItemFilterCommentBlockViewModel CommentBlockBrowserBrowserSelectedBlockViewModel
|
||||||
{
|
{
|
||||||
|
@ -657,7 +635,7 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private bool _filenameIsFake;
|
private bool _filenameIsFake;
|
||||||
private bool _showAdvanced;
|
private bool _showAdvanced;
|
||||||
|
|
||||||
public async Task SaveAsync()
|
public async Task SaveAsync()
|
||||||
{
|
{
|
||||||
if (!ValidateScript()) return;
|
if (!ValidateScript()) return;
|
||||||
|
@ -706,7 +684,7 @@ namespace Filtration.ViewModels
|
||||||
var result = saveDialog.ShowDialog();
|
var result = saveDialog.ShowDialog();
|
||||||
|
|
||||||
if (result != DialogResult.OK) return;
|
if (result != DialogResult.OK) return;
|
||||||
|
|
||||||
Messenger.Default.Send(new NotificationMessage("ShowLoadingBanner"));
|
Messenger.Default.Send(new NotificationMessage("ShowLoadingBanner"));
|
||||||
|
|
||||||
var previousFilePath = Script.FilePath;
|
var previousFilePath = Script.FilePath;
|
||||||
|
@ -802,7 +780,7 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
await Close();
|
await Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Close()
|
public async Task Close()
|
||||||
{
|
{
|
||||||
if (!IsDirty)
|
if (!IsDirty)
|
||||||
|
@ -817,24 +795,24 @@ namespace Filtration.ViewModels
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case MessageBoxResult.Yes:
|
case MessageBoxResult.Yes:
|
||||||
{
|
{
|
||||||
await SaveAsync();
|
await SaveAsync();
|
||||||
CloseScript();
|
CloseScript();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageBoxResult.No:
|
case MessageBoxResult.No:
|
||||||
{
|
{
|
||||||
CloseScript();
|
CloseScript();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageBoxResult.Cancel:
|
case MessageBoxResult.Cancel:
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseScript()
|
private void CloseScript()
|
||||||
{
|
{
|
||||||
var openMasterThemForScript =
|
var openMasterThemForScript =
|
||||||
|
@ -882,9 +860,9 @@ namespace Filtration.ViewModels
|
||||||
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterBlockViewModelBase>())
|
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterBlockViewModelBase>())
|
||||||
{
|
{
|
||||||
blocksToCopy.Add(block);
|
blocksToCopy.Add(block);
|
||||||
if (block is IItemFilterCommentBlockViewModel && !(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (block is IItemFilterCommentBlockViewModel model && !model.IsExpanded)
|
||||||
{
|
{
|
||||||
blocksToCopy.AddRange(getChildren(block as IItemFilterCommentBlockViewModel));
|
blocksToCopy.AddRange(GetChildren(model));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -901,14 +879,14 @@ namespace Filtration.ViewModels
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var blocksToCopy = new List<IItemFilterBlockViewModelBase> { targetBlockViewModelBase };
|
var blocksToCopy = new List<IItemFilterBlockViewModelBase> { targetBlockViewModelBase };
|
||||||
blocksToCopy.AddRange(getChildren(targetBlockViewModelBase as IItemFilterCommentBlockViewModel));
|
blocksToCopy.AddRange(GetChildren((IItemFilterCommentBlockViewModel)targetBlockViewModelBase));
|
||||||
CopyBlocks(blocksToCopy);
|
CopyBlocks(blocksToCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyBlocks(IEnumerable<IItemFilterBlockViewModelBase> targetBlockViewModels)
|
public void CopyBlocks(IEnumerable<IItemFilterBlockViewModelBase> targetBlockViewModels)
|
||||||
{
|
{
|
||||||
if (targetBlockViewModels.Count() < 1)
|
if (!targetBlockViewModels.Any())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -931,8 +909,7 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void OnCopyBlockStyleCommand()
|
private void OnCopyBlockStyleCommand()
|
||||||
{
|
{
|
||||||
var selectedBlockViewModel = LastSelectedBlockViewModel as IItemFilterBlockViewModel;
|
if (LastSelectedBlockViewModel is IItemFilterBlockViewModel selectedBlockViewModel)
|
||||||
if (selectedBlockViewModel != null)
|
|
||||||
{
|
{
|
||||||
CopyBlockStyle(selectedBlockViewModel);
|
CopyBlockStyle(selectedBlockViewModel);
|
||||||
}
|
}
|
||||||
|
@ -963,8 +940,7 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void OnPasteBlockStyleCommand()
|
private void OnPasteBlockStyleCommand()
|
||||||
{
|
{
|
||||||
var selectedBlockViewModel = LastSelectedBlockViewModel as IItemFilterBlockViewModel;
|
if (LastSelectedBlockViewModel is IItemFilterBlockViewModel selectedBlockViewModel)
|
||||||
if (selectedBlockViewModel != null)
|
|
||||||
{
|
{
|
||||||
PasteBlockStyle(selectedBlockViewModel);
|
PasteBlockStyle(selectedBlockViewModel);
|
||||||
}
|
}
|
||||||
|
@ -993,7 +969,7 @@ namespace Filtration.ViewModels
|
||||||
if (commentBlock != null && !commentBlock.IsExpanded)
|
if (commentBlock != null && !commentBlock.IsExpanded)
|
||||||
{
|
{
|
||||||
targetBlockViewModelBase = ItemFilterBlockViewModels[ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase) +
|
targetBlockViewModelBase = ItemFilterBlockViewModels[ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase) +
|
||||||
(commentBlock as ItemFilterCommentBlockViewModel).ChildCount];
|
commentBlock.ChildCount];
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -1051,12 +1027,12 @@ namespace Filtration.ViewModels
|
||||||
var indexToMove = ItemFilterBlockViewModels.IndexOf(
|
var indexToMove = ItemFilterBlockViewModels.IndexOf(
|
||||||
ViewItemFilterBlockViewModels.GetItemAt(blockIndex - 1) as IItemFilterBlockViewModelBase);
|
ViewItemFilterBlockViewModels.GetItemAt(blockIndex - 1) as IItemFilterBlockViewModelBase);
|
||||||
|
|
||||||
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel &&
|
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel model &&
|
||||||
!(targetBlockViewModelBase as IItemFilterCommentBlockViewModel).IsExpanded)
|
!model.IsExpanded)
|
||||||
{
|
{
|
||||||
ExecuteCommandAndSelectAdded(new MoveBlocksToIndexCommand(Script,
|
ExecuteCommandAndSelectAdded(new MoveBlocksToIndexCommand(Script,
|
||||||
Enumerable.Range(ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase),
|
Enumerable.Range(ItemFilterBlockViewModels.IndexOf(model),
|
||||||
(targetBlockViewModelBase as ItemFilterCommentBlockViewModel).ChildCount + 1).ToList(), indexToMove));
|
model.ChildCount + 1).ToList(), indexToMove));
|
||||||
if (_lastAddedBlocks.Count > 0)
|
if (_lastAddedBlocks.Count > 0)
|
||||||
{
|
{
|
||||||
ToggleSection(_lastAddedBlocks[0] as IItemFilterCommentBlockViewModel);
|
ToggleSection(_lastAddedBlocks[0] as IItemFilterCommentBlockViewModel);
|
||||||
|
@ -1072,8 +1048,8 @@ namespace Filtration.ViewModels
|
||||||
ExecuteCommandAndSelectAdded(new MoveBlocksToIndexCommand(Script, targetBlockViewModelBase.BaseBlock, indexToMove));
|
ExecuteCommandAndSelectAdded(new MoveBlocksToIndexCommand(Script, targetBlockViewModelBase.BaseBlock, indexToMove));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDirtyFlag();
|
SetDirtyFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMoveBlockDownCommand()
|
private void OnMoveBlockDownCommand()
|
||||||
{
|
{
|
||||||
|
@ -1093,13 +1069,13 @@ namespace Filtration.ViewModels
|
||||||
indexToMove += (belowBlock as ItemFilterCommentBlockViewModel).ChildCount;
|
indexToMove += (belowBlock as ItemFilterCommentBlockViewModel).ChildCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel &&
|
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel model &&
|
||||||
!(targetBlockViewModelBase as IItemFilterCommentBlockViewModel).IsExpanded)
|
!model.IsExpanded)
|
||||||
{
|
{
|
||||||
indexToMove -= (targetBlockViewModelBase as ItemFilterCommentBlockViewModel).ChildCount;
|
indexToMove -= model.ChildCount;
|
||||||
ExecuteCommandAndSelectAdded(new MoveBlocksToIndexCommand(Script,
|
ExecuteCommandAndSelectAdded(new MoveBlocksToIndexCommand(Script,
|
||||||
Enumerable.Range(ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase),
|
Enumerable.Range(ItemFilterBlockViewModels.IndexOf(model),
|
||||||
(targetBlockViewModelBase as ItemFilterCommentBlockViewModel).ChildCount + 1).ToList(), indexToMove));
|
model.ChildCount + 1).ToList(), indexToMove));
|
||||||
if (_lastAddedBlocks.Count > 0)
|
if (_lastAddedBlocks.Count > 0)
|
||||||
{
|
{
|
||||||
ToggleSection(_lastAddedBlocks[0] as IItemFilterCommentBlockViewModel);
|
ToggleSection(_lastAddedBlocks[0] as IItemFilterCommentBlockViewModel);
|
||||||
|
@ -1124,15 +1100,14 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
public void AddBlock(IItemFilterBlockViewModelBase targetBlockViewModelBase)
|
public void AddBlock(IItemFilterBlockViewModelBase targetBlockViewModelBase)
|
||||||
{
|
{
|
||||||
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel && !(targetBlockViewModelBase as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel model && !model.IsExpanded)
|
||||||
{
|
{
|
||||||
ToggleSection(targetBlockViewModelBase as IItemFilterCommentBlockViewModel);
|
ToggleSection(model);
|
||||||
targetBlockViewModelBase = ItemFilterBlockViewModels[ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase) +
|
targetBlockViewModelBase = ItemFilterBlockViewModels[ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase) + model.ChildCount];
|
||||||
(targetBlockViewModelBase as ItemFilterCommentBlockViewModel).ChildCount];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecuteCommandAndSelectAdded(new AddBlockCommand(Script, targetBlockViewModelBase?.BaseBlock));
|
ExecuteCommandAndSelectAdded(new AddBlockCommand(Script, targetBlockViewModelBase?.BaseBlock));
|
||||||
SetDirtyFlag();
|
SetDirtyFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddCommentBlockCommand()
|
private void OnAddCommentBlockCommand()
|
||||||
|
@ -1160,7 +1135,7 @@ namespace Filtration.ViewModels
|
||||||
blocksToDelete.Add(block);
|
blocksToDelete.Add(block);
|
||||||
if (block is IItemFilterCommentBlockViewModel && !(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (block is IItemFilterCommentBlockViewModel && !(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
||||||
{
|
{
|
||||||
blocksToDelete.AddRange(getChildren(block as IItemFilterCommentBlockViewModel));
|
blocksToDelete.AddRange(GetChildren(block as IItemFilterCommentBlockViewModel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1216,8 +1191,8 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
_scriptCommandManager.ExecuteCommand(new MoveBlocksToBottomCommand(Script, targetBlockViewModelBase.BaseBlock));
|
_scriptCommandManager.ExecuteCommand(new MoveBlocksToBottomCommand(Script, targetBlockViewModelBase.BaseBlock));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDirtyFlag();
|
SetDirtyFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveBlocksToBottom(IEnumerable<IItemFilterBlockViewModelBase> targetCommentBlockViewModels)
|
public void MoveBlocksToBottom(IEnumerable<IItemFilterBlockViewModelBase> targetCommentBlockViewModels)
|
||||||
|
@ -1228,7 +1203,7 @@ namespace Filtration.ViewModels
|
||||||
sourceIndexes.Add(ItemFilterBlockViewModels.IndexOf(block));
|
sourceIndexes.Add(ItemFilterBlockViewModels.IndexOf(block));
|
||||||
if (block is IItemFilterCommentBlockViewModel && !(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (block is IItemFilterCommentBlockViewModel && !(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
||||||
{
|
{
|
||||||
sourceIndexes.AddRange(getChildrenIndexes(block as IItemFilterCommentBlockViewModel));
|
sourceIndexes.AddRange(GetChildrenIndexes(block as IItemFilterCommentBlockViewModel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1251,11 +1226,11 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
public void MoveBlockToTop(IItemFilterBlockViewModelBase targetBlockViewModelBase)
|
public void MoveBlockToTop(IItemFilterBlockViewModelBase targetBlockViewModelBase)
|
||||||
{
|
{
|
||||||
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel && !(targetBlockViewModelBase as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (targetBlockViewModelBase is IItemFilterCommentBlockViewModel model && !model.IsExpanded)
|
||||||
{
|
{
|
||||||
ExecuteCommandAndSelectAdded(new MoveBlocksToTopCommand(Script,
|
ExecuteCommandAndSelectAdded(new MoveBlocksToTopCommand(Script,
|
||||||
Enumerable.Range(ItemFilterBlockViewModels.IndexOf(targetBlockViewModelBase),
|
Enumerable.Range(ItemFilterBlockViewModels.IndexOf(model),
|
||||||
(targetBlockViewModelBase as ItemFilterCommentBlockViewModel).ChildCount + 1).ToList()));
|
model.ChildCount + 1).ToList()));
|
||||||
if (_lastAddedBlocks.Count > 0)
|
if (_lastAddedBlocks.Count > 0)
|
||||||
{
|
{
|
||||||
ToggleSection(_lastAddedBlocks[0] as IItemFilterCommentBlockViewModel);
|
ToggleSection(_lastAddedBlocks[0] as IItemFilterCommentBlockViewModel);
|
||||||
|
@ -1275,23 +1250,23 @@ namespace Filtration.ViewModels
|
||||||
foreach (var block in targetCommentBlockViewModels)
|
foreach (var block in targetCommentBlockViewModels)
|
||||||
{
|
{
|
||||||
sourceIndexes.Add(ItemFilterBlockViewModels.IndexOf(block));
|
sourceIndexes.Add(ItemFilterBlockViewModels.IndexOf(block));
|
||||||
if (block is IItemFilterCommentBlockViewModel && !(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (block is IItemFilterCommentBlockViewModel model && !model.IsExpanded)
|
||||||
{
|
{
|
||||||
sourceIndexes.AddRange(getChildrenIndexes(block as IItemFilterCommentBlockViewModel));
|
sourceIndexes.AddRange(GetChildrenIndexes(model));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecuteCommandAndSelectAdded(new MoveBlocksToTopCommand(Script, sourceIndexes));
|
ExecuteCommandAndSelectAdded(new MoveBlocksToTopCommand(Script, sourceIndexes));
|
||||||
for (var i = 0; i < sourceIndexes.Count; i++)
|
for (var i = 0; i < sourceIndexes.Count; i++)
|
||||||
{
|
{
|
||||||
if (ItemFilterBlockViewModels[i] as IItemFilterCommentBlockViewModel != null)
|
if (ItemFilterBlockViewModels[i] is IItemFilterCommentBlockViewModel model)
|
||||||
{
|
{
|
||||||
ToggleSection(ItemFilterBlockViewModels[i] as IItemFilterCommentBlockViewModel);
|
ToggleSection(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDirtyFlag();
|
SetDirtyFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBlockBecameDirty(object sender, EventArgs e)
|
private void OnBlockBecameDirty(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -1318,11 +1293,11 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
foreach (var block in SelectedBlockViewModels)
|
foreach (var block in SelectedBlockViewModels)
|
||||||
{
|
{
|
||||||
if (block is IItemFilterCommentBlockViewModel)
|
if (block is IItemFilterCommentBlockViewModel model)
|
||||||
{
|
{
|
||||||
if (!(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (!model.IsExpanded)
|
||||||
{
|
{
|
||||||
foreach (var child in getChildren(block as IItemFilterCommentBlockViewModel))
|
foreach (var child in GetChildren(model))
|
||||||
{
|
{
|
||||||
((IItemFilterBlockViewModel)child).BlockEnabled = false;
|
((IItemFilterBlockViewModel)child).BlockEnabled = false;
|
||||||
}
|
}
|
||||||
|
@ -1339,11 +1314,11 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
foreach (var block in SelectedBlockViewModels)
|
foreach (var block in SelectedBlockViewModels)
|
||||||
{
|
{
|
||||||
if (block is IItemFilterCommentBlockViewModel)
|
if (block is IItemFilterCommentBlockViewModel model)
|
||||||
{
|
{
|
||||||
if (!(block as IItemFilterCommentBlockViewModel).IsExpanded)
|
if (!model.IsExpanded)
|
||||||
{
|
{
|
||||||
foreach (var child in getChildren(block as IItemFilterCommentBlockViewModel))
|
foreach (var child in GetChildren(model))
|
||||||
{
|
{
|
||||||
((IItemFilterBlockViewModel)child).BlockEnabled = true;
|
((IItemFilterBlockViewModel)child).BlockEnabled = true;
|
||||||
}
|
}
|
||||||
|
@ -1360,7 +1335,7 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterCommentBlockViewModel>())
|
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterCommentBlockViewModel>())
|
||||||
{
|
{
|
||||||
foreach (var child in getChildren(block as IItemFilterCommentBlockViewModel))
|
foreach (var child in GetChildren(block))
|
||||||
{
|
{
|
||||||
((IItemFilterBlockViewModel)child).BlockEnabled = false;
|
((IItemFilterBlockViewModel)child).BlockEnabled = false;
|
||||||
}
|
}
|
||||||
|
@ -1371,7 +1346,7 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterCommentBlockViewModel>())
|
foreach (var block in SelectedBlockViewModels.OfType<IItemFilterCommentBlockViewModel>())
|
||||||
{
|
{
|
||||||
foreach (var child in getChildren(block as IItemFilterCommentBlockViewModel))
|
foreach (var child in GetChildren(block))
|
||||||
{
|
{
|
||||||
((IItemFilterBlockViewModel)child).BlockEnabled = true;
|
((IItemFilterBlockViewModel)child).BlockEnabled = true;
|
||||||
}
|
}
|
||||||
|
@ -1404,7 +1379,7 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
var newState = !targetCommentBlockViewModelBase.IsExpanded;
|
var newState = !targetCommentBlockViewModelBase.IsExpanded;
|
||||||
targetCommentBlockViewModelBase.IsExpanded = newState;
|
targetCommentBlockViewModelBase.IsExpanded = newState;
|
||||||
foreach (var child in getChildren(targetCommentBlockViewModelBase))
|
foreach (var child in GetChildren(targetCommentBlockViewModelBase))
|
||||||
{
|
{
|
||||||
child.IsVisible = newState;
|
child.IsVisible = newState;
|
||||||
}
|
}
|
||||||
|
@ -1419,15 +1394,11 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void CollapseAllSections()
|
private void CollapseAllSections()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ItemFilterBlockViewModels.Count; i++)
|
foreach (var model in ItemFilterBlockViewModels.OfType<IItemFilterCommentBlockViewModel>())
|
||||||
{
|
{
|
||||||
var block = ItemFilterBlockViewModels[i] as IItemFilterCommentBlockViewModel;
|
if (model.IsExpanded)
|
||||||
if (block != null)
|
|
||||||
{
|
{
|
||||||
if(block.IsExpanded)
|
ToggleSection(model, true);
|
||||||
{
|
|
||||||
ToggleSection(block, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1438,12 +1409,11 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void ExpandAllSections()
|
private void ExpandAllSections()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ItemFilterBlockViewModels.Count; i++)
|
foreach (var model in ItemFilterBlockViewModels.OfType<IItemFilterCommentBlockViewModel>())
|
||||||
{
|
{
|
||||||
var block = ItemFilterBlockViewModels[i] as IItemFilterCommentBlockViewModel;
|
if (!model.IsExpanded)
|
||||||
if (block != null && !block.IsExpanded)
|
|
||||||
{
|
{
|
||||||
ToggleSection(block, true);
|
ToggleSection(model, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@ namespace Filtration.ViewModels
|
||||||
RelayCommand SetItemFilterScriptDirectoryCommand { get; }
|
RelayCommand SetItemFilterScriptDirectoryCommand { get; }
|
||||||
|
|
||||||
string DefaultFilterDirectory { get; }
|
string DefaultFilterDirectory { get; }
|
||||||
bool ExtraLineBetweenBlocks { get; set; }
|
bool BlocksExpandedOnOpen { get; set; }
|
||||||
bool DownloadPrereleaseUpdates { get; set; }
|
bool DownloadPrereleaseUpdates { get; set; }
|
||||||
|
bool ExtraLineBetweenBlocks { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class SettingsPageViewModel : ViewModelBase, ISettingsPageViewModel
|
internal class SettingsPageViewModel : ViewModelBase, ISettingsPageViewModel
|
||||||
|
@ -28,10 +29,10 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
public string DefaultFilterDirectory => Settings.Default.DefaultFilterDirectory;
|
public string DefaultFilterDirectory => Settings.Default.DefaultFilterDirectory;
|
||||||
|
|
||||||
public bool ExtraLineBetweenBlocks
|
public bool BlocksExpandedOnOpen
|
||||||
{
|
{
|
||||||
get => Settings.Default.ExtraLineBetweenBlocks;
|
get => Settings.Default.BlocksExpandedOnOpen;
|
||||||
set => Settings.Default.ExtraLineBetweenBlocks = value;
|
set => Settings.Default.BlocksExpandedOnOpen = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DownloadPrereleaseUpdates
|
public bool DownloadPrereleaseUpdates
|
||||||
|
@ -40,6 +41,12 @@ namespace Filtration.ViewModels
|
||||||
set => Settings.Default.DownloadPrereleaseUpdates = value;
|
set => Settings.Default.DownloadPrereleaseUpdates = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ExtraLineBetweenBlocks
|
||||||
|
{
|
||||||
|
get => Settings.Default.ExtraLineBetweenBlocks;
|
||||||
|
set => Settings.Default.ExtraLineBetweenBlocks = value;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnSetItemFilterScriptDirectoryCommand()
|
private void OnSetItemFilterScriptDirectoryCommand()
|
||||||
{
|
{
|
||||||
_itemFilterScriptDirectoryService.SetItemFilterScriptDirectory();
|
_itemFilterScriptDirectoryService.SetItemFilterScriptDirectory();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
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:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:designTime="clr-namespace:Filtration.ViewModels.DesignTime"
|
xmlns:designTime="clr-namespace:Filtration.ViewModels.DesignTime"
|
||||||
mc:Ignorable="d" d:DesignWidth="1200"
|
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="400"
|
||||||
d:DataContext="{d:DesignInstance Type=designTime:DesignTimeSettingsPageViewModel, IsDesignTimeCreatable=True}">
|
d:DataContext="{d:DesignInstance Type=designTime:DesignTimeSettingsPageViewModel, IsDesignTimeCreatable=True}">
|
||||||
<Border BorderBrush="Black" BorderThickness="1">
|
<Border BorderBrush="Black" BorderThickness="1">
|
||||||
<DockPanel Margin="10" MaxWidth="600" HorizontalAlignment="Left">
|
<DockPanel Margin="10" MaxWidth="600" HorizontalAlignment="Left">
|
||||||
|
@ -22,8 +22,8 @@
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="5" />
|
<RowDefinition Height="5" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition x:Name="BlankLineBetweenBlocks" Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition x:Name="DownloadPreReleases" Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
@ -40,8 +40,10 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Add blank line between blocks when saving</TextBlock>
|
<TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Add blank line between blocks when saving</TextBlock>
|
||||||
<CheckBox Grid.Row="2" Grid.Column="2" IsChecked="{Binding ExtraLineBetweenBlocks}" />
|
<CheckBox Grid.Row="2" Grid.Column="2" IsChecked="{Binding ExtraLineBetweenBlocks}" />
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Download pre-release updates (use with caution)</TextBlock>
|
<TextBlock Grid.Row="3" Grid.Column="0" VerticalAlignment="Center">Download pre-release updates (use with caution)</TextBlock>
|
||||||
<CheckBox Grid.Row="4" Grid.Column="2" IsChecked="{Binding DownloadPrereleaseUpdates}" />
|
<CheckBox Grid.Row="3" Grid.Column="2" IsChecked="{Binding DownloadPrereleaseUpdates}" />
|
||||||
|
<TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Auto-expand all sections when opening scripts</TextBlock>
|
||||||
|
<CheckBox Grid.Row="4" Grid.Column="2" IsChecked="{Binding BlocksExpandedOnOpen}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
Loading…
Reference in New Issue