Basic AvalonDock functionality implemented
This commit is contained in:
parent
41ecdf325c
commit
92eb8cec01
|
@ -0,0 +1,26 @@
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using Filtration.ViewModels;
|
||||||
|
|
||||||
|
namespace Filtration.Converters
|
||||||
|
{
|
||||||
|
class ActiveDocumentConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is ItemFilterScriptViewModel)
|
||||||
|
return value;
|
||||||
|
|
||||||
|
return Binding.DoNothing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is ItemFilterScriptViewModel)
|
||||||
|
return value;
|
||||||
|
|
||||||
|
return Binding.DoNothing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -79,6 +79,21 @@
|
||||||
<Reference Include="WPFToolkit">
|
<Reference Include="WPFToolkit">
|
||||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\WPFToolkit.dll</HintPath>
|
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\WPFToolkit.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Xceed.Wpf.AvalonDock">
|
||||||
|
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero">
|
||||||
|
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Expression">
|
||||||
|
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.Expression.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro">
|
||||||
|
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010">
|
||||||
|
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.Toolkit, Version=2.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||||
|
@ -89,6 +104,7 @@
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="Converters\ActiveDocumentConverter.cs" />
|
||||||
<Compile Include="Converters\BlockItemTypeToStringConverter.cs" />
|
<Compile Include="Converters\BlockItemTypeToStringConverter.cs" />
|
||||||
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||||
<Compile Include="Converters\BooleanToBlockActionInverseConverter.cs" />
|
<Compile Include="Converters\BooleanToBlockActionInverseConverter.cs" />
|
||||||
|
@ -159,7 +175,10 @@
|
||||||
<Compile Include="ViewModels\IItemFilterBlockViewModelFactory.cs" />
|
<Compile Include="ViewModels\IItemFilterBlockViewModelFactory.cs" />
|
||||||
<Compile Include="ViewModels\ItemFilterBlockViewModel.cs" />
|
<Compile Include="ViewModels\ItemFilterBlockViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ItemFilterScriptViewModel.cs" />
|
<Compile Include="ViewModels\ItemFilterScriptViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\PaneViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ReplaceColorsViewModel.cs" />
|
<Compile Include="ViewModels\ReplaceColorsViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\SectionBrowserViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\ToolViewModel.cs" />
|
||||||
<Compile Include="Views\BindingProxy.cs" />
|
<Compile Include="Views\BindingProxy.cs" />
|
||||||
<Compile Include="Views\BlockTemplateSelector.cs" />
|
<Compile Include="Views\BlockTemplateSelector.cs" />
|
||||||
<Compile Include="Views\ItemFilterBlockDisplaySettingsView.xaml.cs">
|
<Compile Include="Views\ItemFilterBlockDisplaySettingsView.xaml.cs">
|
||||||
|
@ -180,9 +199,15 @@
|
||||||
<Compile Include="Views\AboutWindow.xaml.cs">
|
<Compile Include="Views\AboutWindow.xaml.cs">
|
||||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\LayoutInitializer.cs" />
|
||||||
|
<Compile Include="Views\PanesStyleSelector.cs" />
|
||||||
|
<Compile Include="Views\PanesTemplateSelector.cs" />
|
||||||
<Compile Include="Views\ReplaceColorsWindow.xaml.cs">
|
<Compile Include="Views\ReplaceColorsWindow.xaml.cs">
|
||||||
<DependentUpon>ReplaceColorsWindow.xaml</DependentUpon>
|
<DependentUpon>ReplaceColorsWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\SectionBrowserView.xaml.cs">
|
||||||
|
<DependentUpon>SectionBrowserView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
|
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
|
||||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||||
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
|
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
|
||||||
|
@ -212,6 +237,10 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\SectionBrowserView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\SharedResourcesDictionary.xaml">
|
<Page Include="Views\SharedResourcesDictionary.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|
|
@ -19,13 +19,14 @@ namespace Filtration.ViewModels
|
||||||
void Initialise(ItemFilterScript itemFilterScript);
|
void Initialise(ItemFilterScript itemFilterScript);
|
||||||
IItemFilterBlockViewModel SelectedBlockViewModel { get; set; }
|
IItemFilterBlockViewModel SelectedBlockViewModel { get; set; }
|
||||||
void RemoveDirtyFlag();
|
void RemoveDirtyFlag();
|
||||||
|
IEnumerable<IItemFilterBlockViewModel> ItemFilterSectionViewModels { get; }
|
||||||
void AddSection(IItemFilterBlockViewModel targetBlockViewModel);
|
void AddSection(IItemFilterBlockViewModel targetBlockViewModel);
|
||||||
void AddBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
void AddBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
||||||
void CopyBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
void CopyBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
||||||
void PasteBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
void PasteBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ItemFilterScriptViewModel : FiltrationViewModelBase, IItemFilterScriptViewModel
|
internal class ItemFilterScriptViewModel : PaneViewModel, IItemFilterScriptViewModel
|
||||||
{
|
{
|
||||||
private readonly IItemFilterBlockViewModelFactory _itemFilterBlockViewModelFactory;
|
private readonly IItemFilterBlockViewModelFactory _itemFilterBlockViewModelFactory;
|
||||||
private readonly IItemFilterBlockTranslator _blockTranslator;
|
private readonly IItemFilterBlockTranslator _blockTranslator;
|
||||||
|
@ -147,6 +148,9 @@ namespace Filtration.ViewModels
|
||||||
vm.Initialise(block, this);
|
vm.Initialise(block, this);
|
||||||
ItemFilterBlockViewModels.Add(vm);
|
ItemFilterBlockViewModels.Add(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Title = Filename;
|
||||||
|
ContentId = "testcontentid";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCopyBlockCommand()
|
private void OnCopyBlockCommand()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -9,6 +10,7 @@ using Filtration.Services;
|
||||||
using Filtration.Translators;
|
using Filtration.Translators;
|
||||||
using Filtration.Views;
|
using Filtration.Views;
|
||||||
using GalaSoft.MvvmLight.CommandWpf;
|
using GalaSoft.MvvmLight.CommandWpf;
|
||||||
|
using Xceed.Wpf.AvalonDock.Layout;
|
||||||
using Clipboard = System.Windows.Clipboard;
|
using Clipboard = System.Windows.Clipboard;
|
||||||
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
|
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
|
||||||
|
|
||||||
|
@ -16,19 +18,23 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
internal interface IMainWindowViewModel
|
internal interface IMainWindowViewModel
|
||||||
{
|
{
|
||||||
|
IItemFilterScriptViewModel ActiveDocument { get; set; }
|
||||||
|
event EventHandler ActiveDocumentChanged;
|
||||||
void LoadScriptFromFile(string path);
|
void LoadScriptFromFile(string path);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel
|
internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel
|
||||||
{
|
{
|
||||||
|
|
||||||
private ItemFilterScript _loadedScript;
|
private ItemFilterScript _loadedScript;
|
||||||
|
|
||||||
private readonly IItemFilterScriptViewModelFactory _itemFilterScriptViewModelFactory;
|
private readonly IItemFilterScriptViewModelFactory _itemFilterScriptViewModelFactory;
|
||||||
private readonly IItemFilterPersistenceService _persistenceService;
|
private readonly IItemFilterPersistenceService _persistenceService;
|
||||||
private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator;
|
private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator;
|
||||||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||||
private IItemFilterScriptViewModel _currentScriptViewModel;
|
private IItemFilterScriptViewModel _activeDocument;
|
||||||
private readonly ObservableCollection<IItemFilterScriptViewModel> _scriptViewModels;
|
private readonly ObservableCollection<IItemFilterScriptViewModel> _scriptViewModels;
|
||||||
|
private readonly SectionBrowserViewModel _sectionBrowserViewModel;
|
||||||
|
|
||||||
public MainWindowViewModel(IItemFilterScriptViewModelFactory itemFilterScriptViewModelFactory,
|
public MainWindowViewModel(IItemFilterScriptViewModelFactory itemFilterScriptViewModelFactory,
|
||||||
IItemFilterPersistenceService persistenceService,
|
IItemFilterPersistenceService persistenceService,
|
||||||
|
@ -39,19 +45,21 @@ namespace Filtration.ViewModels
|
||||||
_persistenceService = persistenceService;
|
_persistenceService = persistenceService;
|
||||||
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
||||||
_replaceColorsViewModel = replaceColorsViewModel;
|
_replaceColorsViewModel = replaceColorsViewModel;
|
||||||
|
_sectionBrowserViewModel = new SectionBrowserViewModel();
|
||||||
|
_sectionBrowserViewModel.Initialise(this);
|
||||||
|
|
||||||
_scriptViewModels = new ObservableCollection<IItemFilterScriptViewModel>();
|
_scriptViewModels = new ObservableCollection<IItemFilterScriptViewModel>();
|
||||||
|
|
||||||
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
||||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||||
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, () => CurrentScriptViewModel != null);
|
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, () => ActiveDocument != null);
|
||||||
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => CurrentScriptViewModel != null);
|
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => ActiveDocument != null);
|
||||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => CurrentScriptViewModel != null);
|
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocument != null);
|
||||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => CurrentScriptViewModel != null && CurrentScriptViewModel.SelectedBlockViewModel != null);
|
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocument != null && ActiveDocument.SelectedBlockViewModel != null);
|
||||||
PasteCommand = new RelayCommand(OnPasteCommand, () => CurrentScriptViewModel != null && CurrentScriptViewModel.SelectedBlockViewModel != null);
|
PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocument != null && ActiveDocument.SelectedBlockViewModel != null);
|
||||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||||
CloseScriptCommand = new RelayCommand<IItemFilterScriptViewModel>(OnCloseScriptCommand, v => CurrentScriptViewModel != null);
|
CloseScriptCommand = new RelayCommand<IItemFilterScriptViewModel>(OnCloseScriptCommand, v => ActiveDocument != null);
|
||||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => CurrentScriptViewModel != null);
|
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocument != null);
|
||||||
|
|
||||||
//LoadScriptFromFile("C:\\ThioleLootFilter.txt");
|
//LoadScriptFromFile("C:\\ThioleLootFilter.txt");
|
||||||
|
|
||||||
|
@ -74,6 +82,29 @@ namespace Filtration.ViewModels
|
||||||
get { return _scriptViewModels; }
|
get { return _scriptViewModels; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<ToolViewModel> _tools;
|
||||||
|
|
||||||
|
public IEnumerable<ToolViewModel> Tools
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_tools == null)
|
||||||
|
{
|
||||||
|
_tools = new List<ToolViewModel> { _sectionBrowserViewModel };
|
||||||
|
}
|
||||||
|
|
||||||
|
return _tools;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SectionBrowserViewModel SectionBrowserViewModel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _sectionBrowserViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string WindowTitle
|
public string WindowTitle
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -85,22 +116,29 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
[DoNotWire]
|
[DoNotWire]
|
||||||
public IItemFilterScriptViewModel CurrentScriptViewModel
|
public IItemFilterScriptViewModel ActiveDocument
|
||||||
{
|
{
|
||||||
get { return _currentScriptViewModel; }
|
get { return _activeDocument; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_currentScriptViewModel = value;
|
_activeDocument = value;
|
||||||
RaisePropertyChanged();
|
RaisePropertyChanged();
|
||||||
|
if (ActiveDocumentChanged != null)
|
||||||
|
{
|
||||||
|
ActiveDocumentChanged(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
RaisePropertyChanged("NoScriptsOpen");
|
RaisePropertyChanged("NoScriptsOpen");
|
||||||
SaveScriptCommand.RaiseCanExecuteChanged();
|
SaveScriptCommand.RaiseCanExecuteChanged();
|
||||||
SaveScriptAsCommand.RaiseCanExecuteChanged();
|
SaveScriptAsCommand.RaiseCanExecuteChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event EventHandler ActiveDocumentChanged;
|
||||||
|
|
||||||
public bool NoScriptsOpen
|
public bool NoScriptsOpen
|
||||||
{
|
{
|
||||||
get { return _currentScriptViewModel == null; }
|
get { return _activeDocument == null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnOpenAboutWindowCommand()
|
private void OnOpenAboutWindowCommand()
|
||||||
|
@ -138,7 +176,7 @@ namespace Filtration.ViewModels
|
||||||
var newViewModel = _itemFilterScriptViewModelFactory.Create();
|
var newViewModel = _itemFilterScriptViewModelFactory.Create();
|
||||||
newViewModel.Initialise(_loadedScript);
|
newViewModel.Initialise(_loadedScript);
|
||||||
ScriptViewModels.Add(newViewModel);
|
ScriptViewModels.Add(newViewModel);
|
||||||
CurrentScriptViewModel = newViewModel;
|
ActiveDocument = newViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetItemFilterScriptDirectory()
|
private void SetItemFilterScriptDirectory()
|
||||||
|
@ -168,7 +206,7 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
if (!ValidateScript()) return;
|
if (!ValidateScript()) return;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(CurrentScriptViewModel.Script.FilePath))
|
if (string.IsNullOrEmpty(ActiveDocument.Script.FilePath))
|
||||||
{
|
{
|
||||||
OnSaveScriptAsCommand();
|
OnSaveScriptAsCommand();
|
||||||
return;
|
return;
|
||||||
|
@ -176,8 +214,8 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_persistenceService.SaveItemFilterScript(CurrentScriptViewModel.Script);
|
_persistenceService.SaveItemFilterScript(ActiveDocument.Script);
|
||||||
CurrentScriptViewModel.RemoveDirtyFlag();
|
ActiveDocument.RemoveDirtyFlag();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -202,31 +240,31 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
if (result != DialogResult.OK) return;
|
if (result != DialogResult.OK) return;
|
||||||
|
|
||||||
var previousFilePath = CurrentScriptViewModel.Script.FilePath;
|
var previousFilePath = ActiveDocument.Script.FilePath;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CurrentScriptViewModel.Script.FilePath = saveDialog.FileName;
|
ActiveDocument.Script.FilePath = saveDialog.FileName;
|
||||||
_persistenceService.SaveItemFilterScript(CurrentScriptViewModel.Script);
|
_persistenceService.SaveItemFilterScript(ActiveDocument.Script);
|
||||||
CurrentScriptViewModel.RemoveDirtyFlag();
|
ActiveDocument.RemoveDirtyFlag();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButtons.OK,
|
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxIcon.Error);
|
||||||
CurrentScriptViewModel.Script.FilePath = previousFilePath;
|
ActiveDocument.Script.FilePath = previousFilePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnReplaceColorsCommand()
|
private void OnReplaceColorsCommand()
|
||||||
{
|
{
|
||||||
_replaceColorsViewModel.Initialise(CurrentScriptViewModel.Script);
|
_replaceColorsViewModel.Initialise(ActiveDocument.Script);
|
||||||
var replaceColorsWindow = new ReplaceColorsWindow {DataContext = _replaceColorsViewModel};
|
var replaceColorsWindow = new ReplaceColorsWindow {DataContext = _replaceColorsViewModel};
|
||||||
replaceColorsWindow.ShowDialog();
|
replaceColorsWindow.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ValidateScript()
|
private bool ValidateScript()
|
||||||
{
|
{
|
||||||
var result = CurrentScriptViewModel.Script.Validate();
|
var result = ActiveDocument.Script.Validate();
|
||||||
|
|
||||||
if (result.Count == 0) return true;
|
if (result.Count == 0) return true;
|
||||||
|
|
||||||
|
@ -245,17 +283,17 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
private void OnCopyScriptCommand()
|
private void OnCopyScriptCommand()
|
||||||
{
|
{
|
||||||
Clipboard.SetText(_itemFilterScriptTranslator.TranslateItemFilterScriptToString(_currentScriptViewModel.Script));
|
Clipboard.SetText(_itemFilterScriptTranslator.TranslateItemFilterScriptToString(_activeDocument.Script));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCopyBlockCommand()
|
private void OnCopyBlockCommand()
|
||||||
{
|
{
|
||||||
_currentScriptViewModel.CopyBlock(_currentScriptViewModel.SelectedBlockViewModel);
|
_activeDocument.CopyBlock(_activeDocument.SelectedBlockViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPasteCommand()
|
private void OnPasteCommand()
|
||||||
{
|
{
|
||||||
_currentScriptViewModel.PasteBlock(_currentScriptViewModel.SelectedBlockViewModel);
|
_activeDocument.PasteBlock(_activeDocument.SelectedBlockViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnNewScriptCommand()
|
private void OnNewScriptCommand()
|
||||||
|
@ -265,15 +303,15 @@ namespace Filtration.ViewModels
|
||||||
newViewModel.Initialise(newScript);
|
newViewModel.Initialise(newScript);
|
||||||
newViewModel.Description = "New Script";
|
newViewModel.Description = "New Script";
|
||||||
ScriptViewModels.Add(newViewModel);
|
ScriptViewModels.Add(newViewModel);
|
||||||
CurrentScriptViewModel = newViewModel;
|
ActiveDocument = newViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCloseScriptCommand(IItemFilterScriptViewModel scriptViewModel)
|
private void OnCloseScriptCommand(IItemFilterScriptViewModel scriptViewModel)
|
||||||
{
|
{
|
||||||
CurrentScriptViewModel = scriptViewModel;
|
ActiveDocument = scriptViewModel;
|
||||||
if (!CurrentScriptViewModel.IsDirty)
|
if (!ActiveDocument.IsDirty)
|
||||||
{
|
{
|
||||||
ScriptViewModels.Remove(CurrentScriptViewModel);
|
ScriptViewModels.Remove(ActiveDocument);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -284,12 +322,12 @@ namespace Filtration.ViewModels
|
||||||
case DialogResult.Yes:
|
case DialogResult.Yes:
|
||||||
{
|
{
|
||||||
OnSaveScriptCommand();
|
OnSaveScriptCommand();
|
||||||
ScriptViewModels.Remove(CurrentScriptViewModel);
|
ScriptViewModels.Remove(ActiveDocument);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DialogResult.No:
|
case DialogResult.No:
|
||||||
{
|
{
|
||||||
ScriptViewModels.Remove(CurrentScriptViewModel);
|
ScriptViewModels.Remove(ActiveDocument);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DialogResult.Cancel:
|
case DialogResult.Cancel:
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Filtration.ViewModels
|
||||||
|
{
|
||||||
|
class PaneViewModel : FiltrationViewModelBase
|
||||||
|
{
|
||||||
|
private string _title;
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get { return _title; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_title != value)
|
||||||
|
{
|
||||||
|
_title = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageSource IconSource { get; protected set; }
|
||||||
|
|
||||||
|
private string _contentId;
|
||||||
|
public string ContentId
|
||||||
|
{
|
||||||
|
get { return _contentId; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_contentId != value)
|
||||||
|
{
|
||||||
|
_contentId = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isSelected;
|
||||||
|
public bool IsSelected
|
||||||
|
{
|
||||||
|
get { return _isSelected; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isSelected != value)
|
||||||
|
{
|
||||||
|
_isSelected = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isActive;
|
||||||
|
public bool IsActive
|
||||||
|
{
|
||||||
|
get { return _isActive; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isActive != value)
|
||||||
|
{
|
||||||
|
_isActive = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Filtration.ViewModels
|
||||||
|
{
|
||||||
|
internal interface ISectionBrowserViewModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class SectionBrowserViewModel : ToolViewModel, ISectionBrowserViewModel
|
||||||
|
{
|
||||||
|
private IMainWindowViewModel _mainWindowViewModel;
|
||||||
|
private IEnumerable<IItemFilterBlockViewModel> _sectionBlockViewModels;
|
||||||
|
private IItemFilterBlockViewModel _selectedSectionBlockViewModel;
|
||||||
|
|
||||||
|
public SectionBrowserViewModel() : base("Section Browser")
|
||||||
|
{
|
||||||
|
|
||||||
|
ContentId = ToolContentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise(IMainWindowViewModel mainWindowViewModel)
|
||||||
|
{
|
||||||
|
_mainWindowViewModel = mainWindowViewModel;
|
||||||
|
_mainWindowViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public const string ToolContentId = "SectionBrowserTool";
|
||||||
|
|
||||||
|
public IEnumerable<IItemFilterBlockViewModel> SectionBlockViewModels
|
||||||
|
{
|
||||||
|
get { return _sectionBlockViewModels; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_sectionBlockViewModels = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IItemFilterBlockViewModel SelectedSectionBlockViewModel
|
||||||
|
{
|
||||||
|
get { return _selectedSectionBlockViewModel; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedSectionBlockViewModel = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnActiveDocumentChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SectionBlockViewModels = _mainWindowViewModel.ActiveDocument != null ? _mainWindowViewModel.ActiveDocument.ItemFilterSectionViewModels : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
namespace Filtration.ViewModels
|
||||||
|
{
|
||||||
|
class ToolViewModel : PaneViewModel
|
||||||
|
{
|
||||||
|
public ToolViewModel(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Title = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; private set; }
|
||||||
|
|
||||||
|
private bool _isVisible = true;
|
||||||
|
public bool IsVisible
|
||||||
|
{
|
||||||
|
get { return _isVisible; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isVisible != value)
|
||||||
|
{
|
||||||
|
_isVisible = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,7 +59,7 @@
|
||||||
<Button ToolTip="Move Block to Bottom" Command="{Binding MoveBlockToBottomCommand}" Content="{StaticResource MoveToBottomIcon}" />
|
<Button ToolTip="Move Block to Bottom" Command="{Binding MoveBlockToBottomCommand}" Content="{StaticResource MoveToBottomIcon}" />
|
||||||
</ToolBar>
|
</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>
|
||||||
<TextBlock Text="Section Browser" Foreground="White" VerticalAlignment="Top">
|
<TextBlock Text="Section Browser" Foreground="White" VerticalAlignment="Top">
|
||||||
<TextBlock.LayoutTransform>
|
<TextBlock.LayoutTransform>
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
</Expander>
|
</Expander>-->
|
||||||
<userControls:AutoScrollingListBox ItemsSource="{Binding ItemFilterBlockViewModels}"
|
<userControls:AutoScrollingListBox ItemsSource="{Binding ItemFilterBlockViewModels}"
|
||||||
Margin="5,5,5,5"
|
Margin="5,5,5,5"
|
||||||
Padding="5"
|
Padding="5"
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
using System.Linq;
|
||||||
|
using Xceed.Wpf.AvalonDock.Layout;
|
||||||
|
|
||||||
|
namespace Filtration.Views
|
||||||
|
{
|
||||||
|
class LayoutInitializer : ILayoutUpdateStrategy
|
||||||
|
{
|
||||||
|
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
|
||||||
|
{
|
||||||
|
//AD wants to add the anchorable into destinationContainer
|
||||||
|
//just for test provide a new anchorablepane
|
||||||
|
//if the pane is floating let the manager go ahead
|
||||||
|
LayoutAnchorablePane destPane = destinationContainer as LayoutAnchorablePane;
|
||||||
|
if (destinationContainer != null &&
|
||||||
|
destinationContainer.FindParent<LayoutFloatingWindow>() != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "ToolsPane");
|
||||||
|
if (toolsPane != null)
|
||||||
|
{
|
||||||
|
toolsPane.Children.Add(anchorableToShow);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void AfterInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableShown)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool BeforeInsertDocument(LayoutRoot layout, LayoutDocument anchorableToShow, ILayoutContainer destinationContainer)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AfterInsertDocument(LayoutRoot layout, LayoutDocument anchorableShown)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,14 +5,16 @@
|
||||||
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:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||||
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:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"
|
||||||
|
xmlns:converters="clr-namespace:Filtration.Converters"
|
||||||
|
xmlns:views="clr-namespace:Filtration.Views"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance Type=viewModels:MainWindowViewModel}"
|
d:DataContext="{d:DesignInstance Type=viewModels:MainWindowViewModel}"
|
||||||
Title="{Binding WindowTitle}" Height="707" Width="930" BorderThickness="1" BorderBrush="Black">
|
Title="{Binding WindowTitle}" Height="707" Width="930" BorderThickness="1" BorderBrush="Black">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||||
|
<converters:ActiveDocumentConverter x:Key="ActiveDocumentConverter" />
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
|
@ -22,7 +24,7 @@
|
||||||
<MenuItem Header="_Open Script" Command="{Binding OpenScriptCommand}" Icon="{StaticResource OpenIcon}"/>
|
<MenuItem Header="_Open Script" Command="{Binding OpenScriptCommand}" Icon="{StaticResource OpenIcon}"/>
|
||||||
<MenuItem Header="_Save Script" Command="{Binding SaveScriptCommand}" Icon="{StaticResource SaveIcon}"/>
|
<MenuItem Header="_Save Script" Command="{Binding SaveScriptCommand}" Icon="{StaticResource SaveIcon}"/>
|
||||||
<MenuItem Header="Save Script _As" Command="{Binding SaveScriptAsCommand}" Icon="{StaticResource SaveIcon}"/>
|
<MenuItem Header="Save Script _As" Command="{Binding SaveScriptAsCommand}" Icon="{StaticResource SaveIcon}"/>
|
||||||
<MenuItem Header="_Close Script" Command="{Binding CloseScriptCommand}" CommandParameter="{Binding CurrentScriptViewModel}"/>
|
<MenuItem Header="_Close Script" Command="{Binding CloseScriptCommand}" CommandParameter="{Binding ActiveDocument}"/>
|
||||||
<MenuItem Header="E_xit"/>
|
<MenuItem Header="E_xit"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_Edit">
|
<MenuItem Header="_Edit">
|
||||||
|
@ -46,7 +48,63 @@
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
<Grid>
|
<Grid>
|
||||||
<controls:MetroTabControl ItemsSource="{Binding ScriptViewModels}" SelectedItem="{Binding CurrentScriptViewModel}" Name="TabControl" Background="White">
|
<avalonDock:DockingManager x:Name="dockManager"
|
||||||
|
AnchorablesSource="{Binding Tools}"
|
||||||
|
DocumentsSource="{Binding ScriptViewModels}"
|
||||||
|
ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}">
|
||||||
|
<avalonDock:DockingManager.LayoutItemTemplateSelector>
|
||||||
|
<views:PanesTemplateSelector>
|
||||||
|
<views:PanesTemplateSelector.ItemFilterScriptTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<views:ItemFilterScriptView DataContext="{Binding}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</views:PanesTemplateSelector.ItemFilterScriptTemplate>
|
||||||
|
<views:PanesTemplateSelector.SectionBrowserTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<views:SectionBrowserView DataContext="{Binding}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</views:PanesTemplateSelector.SectionBrowserTemplate>
|
||||||
|
</views:PanesTemplateSelector>
|
||||||
|
</avalonDock:DockingManager.LayoutItemTemplateSelector>
|
||||||
|
|
||||||
|
<avalonDock:DockingManager.LayoutItemContainerStyleSelector>
|
||||||
|
<views:PanesStyleSelector>
|
||||||
|
<views:PanesStyleSelector.ToolStyle>
|
||||||
|
<Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
|
||||||
|
<Setter Property="Title" Value="{Binding Model.Title}"/>
|
||||||
|
<Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
|
||||||
|
<Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
|
||||||
|
<Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
|
||||||
|
<Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
|
||||||
|
<Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
|
||||||
|
</Style>
|
||||||
|
</views:PanesStyleSelector.ToolStyle>
|
||||||
|
<views:PanesStyleSelector.ScriptStyle>
|
||||||
|
<Style TargetType="{x:Type avalonDock:LayoutItem}">
|
||||||
|
<Setter Property="Title" Value="{Binding Model.Title}"/>
|
||||||
|
<!--<Setter Property="ToolTip" Value="{Binding Model.FilePath}"/>
|
||||||
|
<Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>-->
|
||||||
|
<Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
|
||||||
|
<Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
|
||||||
|
</Style>
|
||||||
|
</views:PanesStyleSelector.ScriptStyle>
|
||||||
|
</views:PanesStyleSelector>
|
||||||
|
</avalonDock:DockingManager.LayoutItemContainerStyleSelector>
|
||||||
|
<avalonDock:DockingManager.LayoutUpdateStrategy>
|
||||||
|
<views:LayoutInitializer></views:LayoutInitializer>
|
||||||
|
</avalonDock:DockingManager.LayoutUpdateStrategy>
|
||||||
|
|
||||||
|
<avalonDock:LayoutRoot>
|
||||||
|
<avalonDock:LayoutPanel Orientation="Horizontal">
|
||||||
|
<avalonDock:LayoutAnchorablePane Name="ToolsPane" DockWidth="150" />
|
||||||
|
<avalonDock:LayoutDocumentPane/>
|
||||||
|
|
||||||
|
</avalonDock:LayoutPanel>
|
||||||
|
</avalonDock:LayoutRoot>
|
||||||
|
</avalonDock:DockingManager>
|
||||||
|
|
||||||
|
|
||||||
|
<!--<controls:MetroTabControl ItemsSource="{Binding ScriptViewModels}" SelectedItem="{Binding CurrentScriptViewModel}" Name="TabControl" Background="White">
|
||||||
<TabControl.ItemTemplate>
|
<TabControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
|
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
|
||||||
|
@ -62,7 +120,7 @@
|
||||||
</controls:MetroContentControl>
|
</controls:MetroContentControl>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</TabControl.ContentTemplate>
|
</TabControl.ContentTemplate>
|
||||||
</controls:MetroTabControl>
|
</controls:MetroTabControl>-->
|
||||||
<TextBlock FontStyle="Italic" Margin="5" FontSize="13" Visibility="{Binding NoScriptsOpen, Converter={StaticResource BooleanToVisibilityConverter}}">Welcome to Filtration, to get started either
|
<TextBlock FontStyle="Italic" Margin="5" FontSize="13" Visibility="{Binding NoScriptsOpen, Converter={StaticResource BooleanToVisibilityConverter}}">Welcome to Filtration, to get started either
|
||||||
<Hyperlink Command="{Binding NewScriptCommand}">create a new script</Hyperlink> or <Hyperlink Command="{Binding OpenScriptCommand}">open an existing script</Hyperlink></TextBlock>
|
<Hyperlink Command="{Binding NewScriptCommand}">create a new script</Hyperlink> or <Hyperlink Command="{Binding OpenScriptCommand}">open an existing script</Hyperlink></TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using Filtration.ViewModels;
|
||||||
|
|
||||||
|
namespace Filtration.Views
|
||||||
|
{
|
||||||
|
class PanesStyleSelector : StyleSelector
|
||||||
|
{
|
||||||
|
public Style ToolStyle { get; set; }
|
||||||
|
public Style ScriptStyle { get; set; }
|
||||||
|
|
||||||
|
public override Style SelectStyle(object item, DependencyObject container)
|
||||||
|
{
|
||||||
|
if (item is ToolViewModel)
|
||||||
|
{
|
||||||
|
return ToolStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item is IItemFilterScriptViewModel)
|
||||||
|
{
|
||||||
|
return ScriptStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SelectStyle(item, container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using Filtration.ViewModels;
|
||||||
|
using Xceed.Wpf.AvalonDock.Layout;
|
||||||
|
|
||||||
|
namespace Filtration.Views
|
||||||
|
{
|
||||||
|
class PanesTemplateSelector : DataTemplateSelector
|
||||||
|
{
|
||||||
|
public DataTemplate ItemFilterScriptTemplate { get; set; }
|
||||||
|
|
||||||
|
public DataTemplate SectionBrowserTemplate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||||
|
{
|
||||||
|
var itemAsLayoutContent = item as LayoutContent;
|
||||||
|
|
||||||
|
if (item is ItemFilterScriptViewModel)
|
||||||
|
{
|
||||||
|
return ItemFilterScriptTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item is SectionBrowserViewModel)
|
||||||
|
{
|
||||||
|
return SectionBrowserTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SelectTemplate(item, container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<UserControl x:Class="Filtration.Views.SectionBrowserView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||||
|
d:DataContext="{d:DesignInstance Type=viewModels:SectionBrowserViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<ListBox ItemsSource="{Binding SectionBlockViewModels}"
|
||||||
|
SelectedItem="{Binding SelectedSectionBlockViewModel}"
|
||||||
|
x:Name="SectionBrowserListBox"
|
||||||
|
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Hidden"><!--SelectionChanged="SectionBrowserListBox_OnSelectionChanged"-->
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Block.Description}" ToolTip="{Binding Block.Description}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Filtration.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for SectionBrowserView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SectionBrowserView : UserControl
|
||||||
|
{
|
||||||
|
public SectionBrowserView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,7 @@ namespace Filtration.WindsorInstallers
|
||||||
container.Register(
|
container.Register(
|
||||||
Component.For<IMainWindowViewModel>()
|
Component.For<IMainWindowViewModel>()
|
||||||
.ImplementedBy<MainWindowViewModel>()
|
.ImplementedBy<MainWindowViewModel>()
|
||||||
.LifeStyle.Transient);
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
container.Register(
|
container.Register(
|
||||||
Component.For<IItemFilterBlockViewModel>()
|
Component.For<IItemFilterBlockViewModel>()
|
||||||
|
@ -30,6 +30,11 @@ namespace Filtration.WindsorInstallers
|
||||||
.ImplementedBy<ReplaceColorsViewModel>()
|
.ImplementedBy<ReplaceColorsViewModel>()
|
||||||
.LifeStyle.Singleton);
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
|
container.Register(
|
||||||
|
Component.For<ISectionBrowserViewModel>()
|
||||||
|
.ImplementedBy<SectionBrowserViewModel>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
container.AddFacility<TypedFactoryFacility>();
|
container.AddFacility<TypedFactoryFacility>();
|
||||||
container.Register(
|
container.Register(
|
||||||
Component.For<IItemFilterBlockViewModelFactory>().AsFactory());
|
Component.For<IItemFilterBlockViewModelFactory>().AsFactory());
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="AvalonDock" version="2.0.2000" targetFramework="net451" />
|
||||||
<package id="Castle.Core" version="3.3.0" targetFramework="net451" />
|
<package id="Castle.Core" version="3.3.0" targetFramework="net451" />
|
||||||
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
|
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
|
||||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
|
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
|
||||||
|
|
Loading…
Reference in New Issue