Various changes to context menus and toolbars
This commit is contained in:
parent
7f06f271cc
commit
7b5d92bf66
|
@ -1,6 +1,7 @@
|
||||||
<Application x:Class="Filtration.App"
|
<Application x:Class="Filtration.App"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||||
Startup="Application_Startup">
|
Startup="Application_Startup">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
@ -11,6 +12,19 @@
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
||||||
<ResourceDictionary Source="Views/CrossButton.xaml" />
|
<ResourceDictionary Source="Views/CrossButton.xaml" />
|
||||||
|
<ResourceDictionary>
|
||||||
|
<!-- TODO: Fix these icons so we don't need one resource for each instance. x:Shared="False" does not work for ImageAwesome -->
|
||||||
|
<fa:ImageAwesome Icon="Plus" Height="15" Width="15" x:Key="AddBlockToolbarIcon" />
|
||||||
|
<fa:ImageAwesome Icon="ListUl" Height="15" Width="15" x:Key="AddSectionToolbarIcon" />
|
||||||
|
<fa:ImageAwesome Icon="Minus" Height="15" Width="15" x:Key="DeleteBlockToolbarIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleDoubleUp" Height="15" Width="15" x:Key="MoveBlockToTopToolbarIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleUp" Height="15" Width="15" x:Key="MoveBlockUpToolbarIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleDown" Height="15" Width="15" x:Key="MoveBlockDownToolbarIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleDoubleDown" Height="15" Width="15" x:Key="MoveBlockToBottomToolbarIcon" />
|
||||||
|
<fa:ImageAwesome Icon="FileOutlined" Height="15" Width="15" x:Key="NewIcon" />
|
||||||
|
<fa:ImageAwesome Icon="FolderOpenOutlined" Height="15" Width="15" x:Key="OpenIcon" />
|
||||||
|
<fa:ImageAwesome Icon="FloppyOutlined" Height="15" Width="15" x:Key="SaveIcon" />
|
||||||
|
</ResourceDictionary>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
<Reference Include="Castle.Windsor">
|
<Reference Include="Castle.Windsor">
|
||||||
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
|
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DragAndDropLib">
|
|
||||||
<HintPath>..\..\DragAndDrop(Complete)\DragAndDropLib\bin\Debug\DragAndDropLib.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="FontAwesome.WPF, Version=4.3.0.26714, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="FontAwesome.WPF, Version=4.3.0.26714, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\FontAwesome.WPF.4.3.0.2\lib\FontAwesome.WPF.dll</HintPath>
|
<HintPath>..\packages\FontAwesome.WPF.4.3.0.2\lib\FontAwesome.WPF.dll</HintPath>
|
||||||
|
@ -152,6 +149,7 @@
|
||||||
<Compile Include="ViewModels\ILootFilterBlockViewModelFactory.cs" />
|
<Compile Include="ViewModels\ILootFilterBlockViewModelFactory.cs" />
|
||||||
<Compile Include="ViewModels\LootFilterBlockViewModel.cs" />
|
<Compile Include="ViewModels\LootFilterBlockViewModel.cs" />
|
||||||
<Compile Include="ViewModels\LootFilterScriptViewModel.cs" />
|
<Compile Include="ViewModels\LootFilterScriptViewModel.cs" />
|
||||||
|
<Compile Include="Views\BindingProxy.cs" />
|
||||||
<Compile Include="Views\BlockTemplateSelector.cs" />
|
<Compile Include="Views\BlockTemplateSelector.cs" />
|
||||||
<Compile Include="Views\LootFilterBlockDisplaySettingsView.xaml.cs">
|
<Compile Include="Views\LootFilterBlockDisplaySettingsView.xaml.cs">
|
||||||
<DependentUpon>LootFilterBlockDisplaySettingsView.xaml</DependentUpon>
|
<DependentUpon>LootFilterBlockDisplaySettingsView.xaml</DependentUpon>
|
||||||
|
|
|
@ -50,8 +50,7 @@ using System.Windows;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
|
@ -15,7 +15,7 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
internal interface ILootFilterBlockViewModel
|
internal interface ILootFilterBlockViewModel
|
||||||
{
|
{
|
||||||
void Initialise(LootFilterBlock lootFilterBlock);
|
void Initialise(LootFilterBlock lootFilterBlock, LootFilterScriptViewModel parentScriptViewModel);
|
||||||
bool IsDirty { get; set; }
|
bool IsDirty { get; set; }
|
||||||
LootFilterBlock Block { get; }
|
LootFilterBlock Block { get; }
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ namespace Filtration.ViewModels
|
||||||
private readonly ILootFilterBlockTranslator _translator;
|
private readonly ILootFilterBlockTranslator _translator;
|
||||||
private readonly IStaticDataService _staticDataService;
|
private readonly IStaticDataService _staticDataService;
|
||||||
private readonly MediaPlayer _mediaPlayer = new MediaPlayer();
|
private readonly MediaPlayer _mediaPlayer = new MediaPlayer();
|
||||||
|
private LootFilterScriptViewModel _parentScriptViewModel;
|
||||||
|
|
||||||
private bool _displaySettingsPopupOpen;
|
private bool _displaySettingsPopupOpen;
|
||||||
|
|
||||||
|
@ -33,7 +34,11 @@ namespace Filtration.ViewModels
|
||||||
_translator = translator;
|
_translator = translator;
|
||||||
_staticDataService = staticDataService;
|
_staticDataService = staticDataService;
|
||||||
CopyBlockCommand = new RelayCommand(OnCopyConditionCommand);
|
CopyBlockCommand = new RelayCommand(OnCopyConditionCommand);
|
||||||
|
AddBlockCommand = new RelayCommand(OnAddBlockCommand);
|
||||||
|
AddSectionCommand = new RelayCommand(OnAddSectionCommand);
|
||||||
|
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand);
|
||||||
|
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand);
|
||||||
|
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand);
|
||||||
AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand);
|
AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand);
|
||||||
AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand);
|
AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand);
|
||||||
RemoveFilterBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveFilterBlockItemCommand);
|
RemoveFilterBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveFilterBlockItemCommand);
|
||||||
|
@ -41,13 +46,15 @@ namespace Filtration.ViewModels
|
||||||
PlaySoundCommand = new RelayCommand(OnPlaySoundCommand, () => HasSound);
|
PlaySoundCommand = new RelayCommand(OnPlaySoundCommand, () => HasSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(LootFilterBlock lootFilterBlock)
|
public void Initialise(LootFilterBlock lootFilterBlock, LootFilterScriptViewModel parentScriptViewModel)
|
||||||
{
|
{
|
||||||
if (lootFilterBlock == null)
|
if (lootFilterBlock == null || parentScriptViewModel == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("lootFilterBlock");
|
throw new ArgumentNullException("lootFilterBlock");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_parentScriptViewModel = parentScriptViewModel;
|
||||||
|
|
||||||
Block = lootFilterBlock;
|
Block = lootFilterBlock;
|
||||||
lootFilterBlock.BlockItems.CollectionChanged += OnBlockItemsCollectionChanged;
|
lootFilterBlock.BlockItems.CollectionChanged += OnBlockItemsCollectionChanged;
|
||||||
|
|
||||||
|
@ -58,6 +65,11 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelayCommand CopyBlockCommand { get; private set; }
|
public RelayCommand CopyBlockCommand { get; private set; }
|
||||||
|
public RelayCommand AddBlockCommand { get; private set; }
|
||||||
|
public RelayCommand AddSectionCommand { get; private set; }
|
||||||
|
public RelayCommand DeleteBlockCommand { get; private set; }
|
||||||
|
public RelayCommand MoveBlockUpCommand { get; private set; }
|
||||||
|
public RelayCommand MoveBlockDownCommand { get; private set; }
|
||||||
public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; }
|
public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; }
|
||||||
public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; }
|
public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; }
|
||||||
public RelayCommand<ILootFilterBlockItem> RemoveFilterBlockItemCommand { get; private set; }
|
public RelayCommand<ILootFilterBlockItem> RemoveFilterBlockItemCommand { get; private set; }
|
||||||
|
@ -264,6 +276,31 @@ namespace Filtration.ViewModels
|
||||||
IsDirty = true;
|
IsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnAddBlockCommand()
|
||||||
|
{
|
||||||
|
_parentScriptViewModel.AddBlock(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAddSectionCommand()
|
||||||
|
{
|
||||||
|
_parentScriptViewModel.AddSection(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDeleteBlockCommand()
|
||||||
|
{
|
||||||
|
_parentScriptViewModel.DeleteBlock(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMoveBlockUpCommand()
|
||||||
|
{
|
||||||
|
_parentScriptViewModel.MoveBlockUp(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMoveBlockDownCommand()
|
||||||
|
{
|
||||||
|
_parentScriptViewModel.MoveBlockDown(this);
|
||||||
|
}
|
||||||
|
|
||||||
private bool AddBlockItemAllowed(Type type)
|
private bool AddBlockItemAllowed(Type type)
|
||||||
{
|
{
|
||||||
var blockItem = (ILootFilterBlockItem)Activator.CreateInstance(type);
|
var blockItem = (ILootFilterBlockItem)Activator.CreateInstance(type);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -16,26 +15,25 @@ namespace Filtration.ViewModels
|
||||||
string Description { get; set; }
|
string Description { get; set; }
|
||||||
void Initialise(LootFilterScript lootFilterScript);
|
void Initialise(LootFilterScript lootFilterScript);
|
||||||
void RemoveDirtyFlag();
|
void RemoveDirtyFlag();
|
||||||
|
void AddSection(ILootFilterBlockViewModel blockViewModel);
|
||||||
|
void AddBlock(ILootFilterBlockViewModel blockViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class LootFilterScriptViewModel : FiltrationViewModelBase, ILootFilterScriptViewModel
|
internal class LootFilterScriptViewModel : FiltrationViewModelBase, ILootFilterScriptViewModel
|
||||||
{
|
{
|
||||||
private readonly ILootFilterBlockViewModelFactory _lootFilterBlockViewModelFactory;
|
private readonly ILootFilterBlockViewModelFactory _lootFilterBlockViewModelFactory;
|
||||||
private bool _isDirty;
|
private bool _isDirty;
|
||||||
|
private ILootFilterBlockViewModel _selectedBlockViewModel;
|
||||||
|
|
||||||
public LootFilterScriptViewModel(ILootFilterBlockViewModelFactory lootFilterBlockViewModelFactory )
|
public LootFilterScriptViewModel(ILootFilterBlockViewModelFactory lootFilterBlockViewModelFactory )
|
||||||
{
|
{
|
||||||
DeleteBlockCommand = new RelayCommand(OnDeleteBlock, () => SelectedBlockViewModel != null);
|
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => SelectedBlockViewModel != null);
|
||||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModel != null);
|
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModel != null);
|
||||||
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModel != null);
|
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModel != null);
|
||||||
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => SelectedBlockViewModel != null);
|
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => SelectedBlockViewModel != null);
|
||||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null);
|
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null);
|
||||||
AddBlockAboveCommand = new RelayCommand(OnAddBlockAboveCommand, () => SelectedBlockViewModel != null || LootFilterBlockViewModels.Count == 0);
|
AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => SelectedBlockViewModel != null);
|
||||||
AddBlockBelowCommand = new RelayCommand(OnAddBlockBelowCommand, () => SelectedBlockViewModel != null);
|
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null);
|
||||||
|
|
||||||
AddSectionAboveCommand = new RelayCommand(OnAddSectionAboveCommand, () => SelectedBlockViewModel != null);
|
|
||||||
|
|
||||||
SectionBrowserSelectionChangedCommand = new RelayCommand<EventArgs>(OnSectionBrowserSelectionChanged);
|
|
||||||
|
|
||||||
_lootFilterBlockViewModelFactory = lootFilterBlockViewModelFactory;
|
_lootFilterBlockViewModelFactory = lootFilterBlockViewModelFactory;
|
||||||
LootFilterBlockViewModels = new ObservableCollection<ILootFilterBlockViewModel>();
|
LootFilterBlockViewModels = new ObservableCollection<ILootFilterBlockViewModel>();
|
||||||
|
@ -47,10 +45,8 @@ namespace Filtration.ViewModels
|
||||||
public RelayCommand MoveBlockUpCommand { get; private set; }
|
public RelayCommand MoveBlockUpCommand { get; private set; }
|
||||||
public RelayCommand MoveBlockDownCommand { get; private set; }
|
public RelayCommand MoveBlockDownCommand { get; private set; }
|
||||||
public RelayCommand MoveBlockToBottomCommand { get; private set; }
|
public RelayCommand MoveBlockToBottomCommand { get; private set; }
|
||||||
public RelayCommand AddBlockAboveCommand { get; private set; }
|
public RelayCommand AddBlockCommand { get; private set; }
|
||||||
public RelayCommand AddBlockBelowCommand { get; private set; }
|
public RelayCommand AddSectionCommand { get; private set; }
|
||||||
public RelayCommand AddSectionAboveCommand { get; private set; }
|
|
||||||
public RelayCommand<EventArgs> SectionBrowserSelectionChangedCommand { get; private set; }
|
|
||||||
|
|
||||||
public ObservableCollection<ILootFilterBlockViewModel> LootFilterBlockViewModels { get; private set; }
|
public ObservableCollection<ILootFilterBlockViewModel> LootFilterBlockViewModels { get; private set; }
|
||||||
|
|
||||||
|
@ -61,11 +57,6 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
public ILootFilterBlockViewModel SectionBrowserSelectedViewModel { get; set; }
|
public ILootFilterBlockViewModel SectionBrowserSelectedViewModel { get; set; }
|
||||||
|
|
||||||
private void OnSectionBrowserSelectionChanged(EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
get { return Script.Description; }
|
get { return Script.Description; }
|
||||||
|
@ -77,7 +68,15 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LootFilterBlockViewModel SelectedBlockViewModel { get; set; }
|
public ILootFilterBlockViewModel SelectedBlockViewModel
|
||||||
|
{
|
||||||
|
get { return _selectedBlockViewModel; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedBlockViewModel = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public LootFilterScript Script { get; private set; }
|
public LootFilterScript Script { get; private set; }
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ namespace Filtration.ViewModels
|
||||||
CleanChildren();
|
CleanChildren();
|
||||||
IsDirty = false;
|
IsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DisplayName
|
public string DisplayName
|
||||||
{
|
{
|
||||||
get { return !string.IsNullOrEmpty(Filename) ? Filename : Description; }
|
get { return !string.IsNullOrEmpty(Filename) ? Filename : Description; }
|
||||||
|
@ -129,7 +128,7 @@ namespace Filtration.ViewModels
|
||||||
foreach (var block in Script.LootFilterBlocks)
|
foreach (var block in Script.LootFilterBlocks)
|
||||||
{
|
{
|
||||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
var vm = _lootFilterBlockViewModelFactory.Create();
|
||||||
vm.Initialise(block);
|
vm.Initialise(block, this);
|
||||||
LootFilterBlockViewModels.Add(vm);
|
LootFilterBlockViewModels.Add(vm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,11 +150,16 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void OnMoveBlockUpCommand()
|
private void OnMoveBlockUpCommand()
|
||||||
{
|
{
|
||||||
var currentIndex = LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel);
|
MoveBlockUp(SelectedBlockViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveBlockUp(ILootFilterBlockViewModel blockViewModel)
|
||||||
|
{
|
||||||
|
var currentIndex = LootFilterBlockViewModels.IndexOf(blockViewModel);
|
||||||
|
|
||||||
if (currentIndex > 0)
|
if (currentIndex > 0)
|
||||||
{
|
{
|
||||||
var block = SelectedBlockViewModel.Block;
|
var block = blockViewModel.Block;
|
||||||
var blockPos = Script.LootFilterBlocks.IndexOf(block);
|
var blockPos = Script.LootFilterBlocks.IndexOf(block);
|
||||||
Script.LootFilterBlocks.RemoveAt(blockPos);
|
Script.LootFilterBlocks.RemoveAt(blockPos);
|
||||||
Script.LootFilterBlocks.Insert(blockPos - 1, block);
|
Script.LootFilterBlocks.Insert(blockPos - 1, block);
|
||||||
|
@ -167,11 +171,16 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void OnMoveBlockDownCommand()
|
private void OnMoveBlockDownCommand()
|
||||||
{
|
{
|
||||||
var currentIndex = LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel);
|
MoveBlockDown(SelectedBlockViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveBlockDown(ILootFilterBlockViewModel blockViewModel)
|
||||||
|
{
|
||||||
|
var currentIndex = LootFilterBlockViewModels.IndexOf(blockViewModel);
|
||||||
|
|
||||||
if (currentIndex < LootFilterBlockViewModels.Count - 1)
|
if (currentIndex < LootFilterBlockViewModels.Count - 1)
|
||||||
{
|
{
|
||||||
var block = SelectedBlockViewModel.Block;
|
var block = blockViewModel.Block;
|
||||||
var blockPos = Script.LootFilterBlocks.IndexOf(block);
|
var blockPos = Script.LootFilterBlocks.IndexOf(block);
|
||||||
Script.LootFilterBlocks.RemoveAt(blockPos);
|
Script.LootFilterBlocks.RemoveAt(blockPos);
|
||||||
Script.LootFilterBlocks.Insert(blockPos + 1, block);
|
Script.LootFilterBlocks.Insert(blockPos + 1, block);
|
||||||
|
@ -196,16 +205,21 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddBlockAboveCommand()
|
private void OnAddBlockCommand()
|
||||||
|
{
|
||||||
|
AddBlock(SelectedBlockViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddBlock(ILootFilterBlockViewModel blockViewModel)
|
||||||
{
|
{
|
||||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
var vm = _lootFilterBlockViewModelFactory.Create();
|
||||||
var newBlock = new LootFilterBlock();
|
var newBlock = new LootFilterBlock();
|
||||||
vm.Initialise(newBlock);
|
vm.Initialise(newBlock, this);
|
||||||
|
|
||||||
if (LootFilterBlockViewModels.Count > 0)
|
if (LootFilterBlockViewModels.Count > 0)
|
||||||
{
|
{
|
||||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block), newBlock);
|
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(blockViewModel.Block) + 1, newBlock);
|
||||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel), vm);
|
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(blockViewModel) + 1, vm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -213,41 +227,42 @@ namespace Filtration.ViewModels
|
||||||
LootFilterBlockViewModels.Add(vm);
|
LootFilterBlockViewModels.Add(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectedBlockViewModel = vm;
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddBlockBelowCommand()
|
private void OnAddSectionCommand()
|
||||||
{
|
{
|
||||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
AddSection(SelectedBlockViewModel);
|
||||||
var newBlock = new LootFilterBlock();
|
|
||||||
vm.Initialise(newBlock);
|
|
||||||
|
|
||||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block) + 1, newBlock);
|
|
||||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel) + 1, vm);
|
|
||||||
_isDirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddSectionAboveCommand()
|
public void AddSection(ILootFilterBlockViewModel blockViewModel)
|
||||||
{
|
{
|
||||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
var vm = _lootFilterBlockViewModelFactory.Create();
|
||||||
var newSection = new LootFilterSection { Description = "New Section" };
|
var newSection = new LootFilterSection { Description = "New Section" };
|
||||||
vm.Initialise(newSection);
|
vm.Initialise(newSection, this);
|
||||||
|
|
||||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block), newSection);
|
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(blockViewModel.Block) + 1, newSection);
|
||||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel), vm);
|
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(blockViewModel) + 1, vm);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
SelectedBlockViewModel = vm;
|
||||||
RaisePropertyChanged("LootFilterSectionViewModels");
|
RaisePropertyChanged("LootFilterSectionViewModels");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeleteBlock()
|
private void OnDeleteBlockCommand()
|
||||||
|
{
|
||||||
|
DeleteBlock(SelectedBlockViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteBlock(ILootFilterBlockViewModel blockViewModel)
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show("Are you sure you wish to delete this block?", "Delete Confirmation",
|
var result = MessageBox.Show("Are you sure you wish to delete this block?", "Delete Confirmation",
|
||||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||||
|
|
||||||
if (result == MessageBoxResult.Yes)
|
if (result == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
Script.LootFilterBlocks.Remove(SelectedBlockViewModel.Block);
|
Script.LootFilterBlocks.Remove(blockViewModel.Block);
|
||||||
LootFilterBlockViewModels.Remove(SelectedBlockViewModel);
|
LootFilterBlockViewModels.Remove(blockViewModel);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
}
|
}
|
||||||
SelectedBlockViewModel = null;
|
SelectedBlockViewModel = null;
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Filtration.Views
|
||||||
|
{
|
||||||
|
public class BindingProxy : Freezable
|
||||||
|
{
|
||||||
|
protected override Freezable CreateInstanceCore()
|
||||||
|
{
|
||||||
|
return new BindingProxy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Data
|
||||||
|
{
|
||||||
|
get { return GetValue(DataProperty); }
|
||||||
|
set { SetValue(DataProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for Data. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty DataProperty =
|
||||||
|
DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,9 @@
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" />
|
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" />
|
||||||
|
<ResourceDictionary>
|
||||||
|
<views:BindingProxy x:Key="proxy" Data="{Binding}" />
|
||||||
|
</ResourceDictionary>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
@ -30,28 +33,35 @@
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Rectangle Width="7" >
|
<Rectangle Width="7" >
|
||||||
<Rectangle.Fill>
|
<Rectangle.Fill>
|
||||||
<SolidColorBrush Color="Gray"></SolidColorBrush>
|
<SolidColorBrush Color="Gray" />
|
||||||
<!--<DrawingBrush Viewbox="0,0,5,4" TileMode="Tile">
|
|
||||||
<DrawingBrush.Drawing>
|
|
||||||
<GeometryDrawing Brush="#FF9D9D9D">
|
|
||||||
<GeometryDrawing.Geometry>
|
|
||||||
<GeometryGroup>
|
|
||||||
<RectangleGeometry Rect="0,0,1,1" />
|
|
||||||
<RectangleGeometry Rect="4,0,1,1" />
|
|
||||||
<RectangleGeometry Rect="2,2,1,1" />
|
|
||||||
</GeometryGroup>
|
|
||||||
</GeometryDrawing.Geometry>
|
|
||||||
</GeometryDrawing>
|
|
||||||
</DrawingBrush.Drawing>
|
|
||||||
</DrawingBrush>-->
|
|
||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<Expander Grid.Column="1" Style="{StaticResource ExpanderRightAlignStyle}" x:Name="TestExpander" ToolTip="{Binding BlockDescription}">
|
<Expander Grid.Column="1" Style="{StaticResource ExpanderRightAlignStyle}" x:Name="TestExpander" ToolTip="{Binding BlockDescription}">
|
||||||
<Expander.ContextMenu>
|
<Expander.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
|
<ContextMenu.Resources>
|
||||||
|
<fa:ImageAwesome Icon="Plus" Height="15" Width="15" x:Key="AddBlockIcon" />
|
||||||
|
<fa:ImageAwesome Icon="ListUl" Height="15" Width="15" x:Key="AddSectionIcon" />
|
||||||
|
<fa:ImageAwesome Icon="Minus" Height="15" Width="15" x:Key="DeleteBlockIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleDoubleUp" Height="15" Width="15" x:Key="MoveBlockToTopIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleUp" Height="15" Width="15" x:Key="MoveBlockUpIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleDown" Height="15" Width="15" x:Key="MoveBlockDownIcon" />
|
||||||
|
<fa:ImageAwesome Icon="AngleDoubleDown" Height="15" Width="15" x:Key="MoveBlockToBottomIcon" />
|
||||||
|
<fa:ImageAwesome Icon="Copy" Height="15" Width="15" x:Key="CopyIcon" />
|
||||||
|
<fa:ImageAwesome Icon="Paste" Height="15" Width="15" x:Key="PasteIcon" />
|
||||||
|
</ContextMenu.Resources>
|
||||||
<ContextMenu.Items>
|
<ContextMenu.Items>
|
||||||
<MenuItem Header="Copy" Command="{Binding CopyBlockCommand}" />
|
<MenuItem Header="Copy" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" />
|
||||||
|
<MenuItem Header="Paste" Command="{Binding CopyBlockCommand}" Icon="{StaticResource PasteIcon}" />
|
||||||
<Separator />
|
<Separator />
|
||||||
|
<MenuItem Header="Add Block" Command="{Binding Data.AddBlockCommand, Source={StaticResource proxy}}" Icon="{StaticResource AddBlockIcon}" />
|
||||||
|
<MenuItem Header="Add Section" Command="{Binding Data.AddSectionCommand, Source={StaticResource proxy}}" Icon="{StaticResource AddSectionIcon}">
|
||||||
|
</MenuItem>
|
||||||
|
<Separator />
|
||||||
|
<MenuItem Header="Delete Block" Command="{Binding Data.DeleteBlockCommand, Source={StaticResource proxy}}" Icon="{StaticResource DeleteBlockIcon}" />
|
||||||
|
<Separator />
|
||||||
|
<MenuItem Header="Move Block Up" Command="{Binding Data.MoveBlockUpCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveBlockUpIcon}" />
|
||||||
|
<MenuItem Header="Move Block Down" Command="{Binding Data.MoveBlockDownCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveBlockDownIcon}" />
|
||||||
</ContextMenu.Items>
|
</ContextMenu.Items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Expander.ContextMenu>
|
</Expander.ContextMenu>
|
||||||
|
@ -61,8 +71,9 @@
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- BlockItems Summary Panel -->
|
||||||
<StackPanel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
|
<StackPanel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
|
||||||
<!-- BlockItems Summary Panel -->
|
|
||||||
<ItemsControl ItemsSource="{Binding SummaryBlockItems}">
|
<ItemsControl ItemsSource="{Binding SummaryBlockItems}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
|
@ -126,6 +137,7 @@
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Add Block Item Links -->
|
<!-- Add Block Item Links -->
|
||||||
<ItemsControl ItemsSource="{Binding BlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
<ItemsControl ItemsSource="{Binding BlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
|
@ -143,6 +155,7 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
||||||
<!-- Block Items -->
|
<!-- Block Items -->
|
||||||
<WrapPanel Grid.Row="1" MaxHeight="200">
|
<WrapPanel Grid.Row="1" MaxHeight="200">
|
||||||
<ItemsControl ItemsSource="{Binding FilterBlockItems}">
|
<ItemsControl ItemsSource="{Binding FilterBlockItems}">
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||||
xmlns:dragAndDropLib="clr-namespace:DragAndDropLib;assembly=DragAndDropLib"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance Type=viewModels:LootFilterScriptViewModel}"
|
d:DataContext="{d:DesignInstance Type=viewModels:LootFilterScriptViewModel}"
|
||||||
d:DesignHeight="300" d:DesignWidth="600">
|
d:DesignHeight="300" d:DesignWidth="600">
|
||||||
|
@ -59,30 +58,16 @@
|
||||||
</Style>
|
</Style>
|
||||||
</ToolBarTray.Resources>
|
</ToolBarTray.Resources>
|
||||||
<ToolBar>
|
<ToolBar>
|
||||||
<Button ToolTip="Add Block" Command="{Binding AddBlockAboveCommand}">
|
<Button ToolTip="Add Block" Command="{Binding AddBlockCommand}" Content="{StaticResource AddBlockToolbarIcon}" />
|
||||||
<fa:ImageAwesome Icon="Plus" />
|
<Button ToolTip="Add Section" Command="{Binding AddSectionCommand}" Content="{StaticResource AddSectionToolbarIcon}" />
|
||||||
</Button>
|
<Button ToolTip="Delete Block/Section" Command="{Binding DeleteBlockCommand}" Content="{StaticResource DeleteBlockToolbarIcon}" />
|
||||||
<Button ToolTip="Add Section" Command="{Binding AddSectionAboveCommand}">
|
</ToolBar>
|
||||||
<fa:ImageAwesome Icon="ListUl" />
|
<ToolBar>
|
||||||
</Button>
|
<Button ToolTip="Move Block to Top" Command="{Binding MoveBlockToTopCommand}" Content="{StaticResource MoveBlockToTopToolbarIcon}" />
|
||||||
<Button ToolTip="Delete Block/Section" Command="{Binding DeleteBlockCommand}">
|
<Button ToolTip="Move Block Up" Command="{Binding MoveBlockUpCommand}" Content="{StaticResource MoveBlockUpToolbarIcon}" />
|
||||||
<fa:ImageAwesome Icon="Minus" />
|
<Button ToolTip="Move Block Down" Command="{Binding MoveBlockDownCommand}" Content="{StaticResource MoveBlockDownToolbarIcon}" />
|
||||||
</Button>
|
<Button ToolTip="Move Block to Bottom" Command="{Binding MoveBlockToBottomCommand}" Content="{StaticResource MoveBlockToBottomToolbarIcon}" />
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ToolBar>
|
|
||||||
<Button ToolTip="Move Block to Top" Command="{Binding MoveBlockToTopCommand}">
|
|
||||||
<fa:ImageAwesome Icon="AngleDoubleUp" />
|
|
||||||
</Button>
|
|
||||||
<Button ToolTip="Move Block Up" Command="{Binding MoveBlockUpCommand}">
|
|
||||||
<fa:ImageAwesome Icon="AngleUp" />
|
|
||||||
</Button>
|
|
||||||
<Button ToolTip="Move Block Down" Command="{Binding MoveBlockDownCommand}">
|
|
||||||
<fa:ImageAwesome Icon="AngleDown" />
|
|
||||||
</Button>
|
|
||||||
<Button ToolTip="Move Block to Bottom" Command="{Binding MoveBlockToBottomCommand}">
|
|
||||||
<fa:ImageAwesome Icon="AngleDoubleDown" />
|
|
||||||
</Button>
|
|
||||||
</ToolBar>
|
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
<Expander DockPanel.Dock="Left" ExpandDirection="Right" MaxWidth="200" HorizontalAlignment="Left" >
|
<Expander DockPanel.Dock="Left" ExpandDirection="Right" MaxWidth="200" HorizontalAlignment="Left" >
|
||||||
<Expander.Header>
|
<Expander.Header>
|
||||||
|
@ -113,6 +98,9 @@
|
||||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||||
ItemTemplateSelector="{StaticResource BlockTemplateSelector}"
|
ItemTemplateSelector="{StaticResource BlockTemplateSelector}"
|
||||||
SelectedItem="{Binding SelectedBlockViewModel}" x:Name="BlocksListBox">
|
SelectedItem="{Binding SelectedBlockViewModel}" x:Name="BlocksListBox">
|
||||||
|
<ListBox.InputBindings>
|
||||||
|
<KeyBinding Key="Delete" Command="{Binding DeleteBlockCommand}" />
|
||||||
|
</ListBox.InputBindings>
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem">
|
||||||
<!--<Setter Property="BorderBrush" Value="Red"/>-->
|
<!--<Setter Property="BorderBrush" Value="Red"/>-->
|
||||||
|
@ -127,11 +115,11 @@
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem">
|
||||||
<Style.Resources>
|
<Style.Resources>
|
||||||
<!-- SelectedItem with focus -->
|
<!-- SelectedItem with focus -->
|
||||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
|
<!--<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
|
||||||
<!-- SelectedItem without focus -->
|
--><!-- SelectedItem without focus -->
|
||||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
|
<!--<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />-->
|
||||||
<!-- SelectedItem text foreground -->
|
<!-- SelectedItem text foreground --><!--
|
||||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
|
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />-->
|
||||||
</Style.Resources>
|
</Style.Resources>
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
|
@ -25,7 +25,14 @@
|
||||||
<MenuItem Header="_Copy Script to Clipboard" Command="{Binding CopyScriptCommand}" />
|
<MenuItem Header="_Copy Script to Clipboard" Command="{Binding CopyScriptCommand}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<controls:MetroTabControl ItemsSource="{Binding ScriptViewModels}" SelectedItem="{Binding CurrentScriptViewModel}" DockPanel.Dock="Bottom" Name="TabControl">
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
|
<ToolBar>
|
||||||
|
<Button Command="{Binding NewScriptCommand}" Content="{StaticResource NewIcon}" ToolTip="New Script" />
|
||||||
|
<Button Command="{Binding OpenScriptCommand}" Content="{StaticResource OpenIcon}" ToolTip="Open Script" />
|
||||||
|
<Button Command="{Binding SaveScriptCommand}" Content="{StaticResource SaveIcon}" ToolTip="Save Script" />
|
||||||
|
</ToolBar>
|
||||||
|
</ToolBarTray>
|
||||||
|
<controls:MetroTabControl ItemsSource="{Binding ScriptViewModels}" SelectedItem="{Binding CurrentScriptViewModel}" Name="TabControl">
|
||||||
<TabControl.ItemTemplate>
|
<TabControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
|
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
|
||||||
|
|
Loading…
Reference in New Issue