Added Section Browser
This commit is contained in:
parent
446fe51843
commit
d07b9bdc6b
|
@ -5,9 +5,7 @@
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Buttons.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
|
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Toolbar.xaml" />
|
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml" />
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Layout.Toolkit.dll</HintPath>
|
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Layout.Toolkit.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xaml">
|
<Reference Include="System.Xaml">
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using System.Collections.ObjectModel;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
@ -24,6 +26,8 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
AddSectionAboveCommand = new RelayCommand(OnAddSectionAboveCommand, () => 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>();
|
||||||
|
|
||||||
|
@ -37,9 +41,22 @@ namespace Filtration.ViewModels
|
||||||
public RelayCommand AddBlockAboveCommand { get; private set; }
|
public RelayCommand AddBlockAboveCommand { get; private set; }
|
||||||
public RelayCommand AddBlockBelowCommand { get; private set; }
|
public RelayCommand AddBlockBelowCommand { get; private set; }
|
||||||
public RelayCommand AddSectionAboveCommand { 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; }
|
||||||
|
|
||||||
|
public IEnumerable<ILootFilterBlockViewModel> LootFilterSectionViewModels
|
||||||
|
{
|
||||||
|
get { return LootFilterBlockViewModels.Where(b => b.Block.GetType() == typeof (LootFilterSection)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILootFilterBlockViewModel SectionBrowserSelectedViewModel { get; set; }
|
||||||
|
|
||||||
|
private void OnSectionBrowserSelectionChanged(EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
get { return Script.Description; }
|
get { return Script.Description; }
|
||||||
|
@ -119,6 +136,7 @@ namespace Filtration.ViewModels
|
||||||
Script.LootFilterBlocks.Insert(0, block);
|
Script.LootFilterBlocks.Insert(0, block);
|
||||||
LootFilterBlockViewModels.Move(currentIndex, 0);
|
LootFilterBlockViewModels.Move(currentIndex, 0);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
RaisePropertyChanged("LootFilterSectionViewModels");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +152,7 @@ namespace Filtration.ViewModels
|
||||||
Script.LootFilterBlocks.Insert(blockPos - 1, block);
|
Script.LootFilterBlocks.Insert(blockPos - 1, block);
|
||||||
LootFilterBlockViewModels.Move(currentIndex, currentIndex - 1);
|
LootFilterBlockViewModels.Move(currentIndex, currentIndex - 1);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
RaisePropertyChanged("LootFilterSectionViewModels");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +168,7 @@ namespace Filtration.ViewModels
|
||||||
Script.LootFilterBlocks.Insert(blockPos + 1, block);
|
Script.LootFilterBlocks.Insert(blockPos + 1, block);
|
||||||
LootFilterBlockViewModels.Move(currentIndex, currentIndex + 1);
|
LootFilterBlockViewModels.Move(currentIndex, currentIndex + 1);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
RaisePropertyChanged("LootFilterSectionViewModels");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +183,7 @@ namespace Filtration.ViewModels
|
||||||
Script.LootFilterBlocks.Add(block);
|
Script.LootFilterBlocks.Add(block);
|
||||||
LootFilterBlockViewModels.Move(currentIndex, LootFilterBlockViewModels.Count - 1);
|
LootFilterBlockViewModels.Move(currentIndex, LootFilterBlockViewModels.Count - 1);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
RaisePropertyChanged("LootFilterSectionViewModels");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +227,7 @@ namespace Filtration.ViewModels
|
||||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block), newSection);
|
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block), newSection);
|
||||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel), vm);
|
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel), vm);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
RaisePropertyChanged("LootFilterSectionViewModels");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeleteBlock()
|
private void OnDeleteBlock()
|
||||||
|
|
|
@ -3,10 +3,13 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
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:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||||
|
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight"
|
||||||
xmlns:views="clr-namespace:Filtration.Views"
|
xmlns:views="clr-namespace:Filtration.Views"
|
||||||
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:command="http://www.galasoft.ch/mvvmlight"
|
||||||
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">
|
||||||
|
@ -47,7 +50,7 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Grid.Row="1" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,5">
|
<Border Grid.Row="1" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,5">
|
||||||
<DockPanel>
|
<DockPanel LastChildFill="True">
|
||||||
<ToolBarTray DockPanel.Dock="Top">
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
<ToolBarTray.Resources>
|
<ToolBarTray.Resources>
|
||||||
<Style TargetType="{x:Type fa:ImageAwesome}">
|
<Style TargetType="{x:Type fa:ImageAwesome}">
|
||||||
|
@ -83,15 +86,30 @@
|
||||||
</Button>
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
|
<Expander DockPanel.Dock="Left" ExpandDirection="Right" MaxWidth="200" HorizontalAlignment="Left" >
|
||||||
|
<Expander.Header>
|
||||||
|
<TextBlock Text="Section Browser">
|
||||||
|
<TextBlock.LayoutTransform>
|
||||||
|
<RotateTransform Angle="-90"/>
|
||||||
|
</TextBlock.LayoutTransform>
|
||||||
|
</TextBlock>
|
||||||
|
</Expander.Header>
|
||||||
|
<ListBox ItemsSource="{Binding LootFilterSectionViewModels}" SelectedItem="{Binding SectionBrowserSelectedViewModel}" x:Name="SectionBrowserListBox" SelectionChanged="SectionBrowserListBox_OnSelectionChanged" >
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding BlockDescription}" ToolTip="{Binding BlockDescription}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Expander>
|
||||||
<userControls:AutoScrollingListBox ItemsSource="{Binding LootFilterBlockViewModels}"
|
<userControls:AutoScrollingListBox ItemsSource="{Binding LootFilterBlockViewModels}"
|
||||||
DockPanel.Dock="Bottom"
|
|
||||||
Margin="5,5,5,5"
|
Margin="5,5,5,5"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||||
ItemTemplateSelector="{StaticResource BlockTemplateSelector}"
|
ItemTemplateSelector="{StaticResource BlockTemplateSelector}"
|
||||||
SelectedItem="{Binding SelectedBlockViewModel}">
|
SelectedItem="{Binding SelectedBlockViewModel}" x:Name="BlocksListBox">
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem">
|
||||||
<Setter Property="BorderBrush" Value="Red"/>
|
<Setter Property="BorderBrush" Value="Red"/>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Filtration.Views
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Filtration.Views
|
||||||
{
|
{
|
||||||
public partial class LootFilterScriptView
|
public partial class LootFilterScriptView
|
||||||
{
|
{
|
||||||
|
@ -6,5 +8,10 @@
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SectionBrowserListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
BlocksListBox.ScrollIntoView(((ListBox)sender).SelectedItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue