Implemented AvalonDock, added BlockGroupBrowser
This commit is contained in:
parent
92eb8cec01
commit
f4eaba016f
|
@ -9,7 +9,7 @@ namespace Filtration.Converters
|
|||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is ItemFilterScriptViewModel)
|
||||
if (value is IDocument)
|
||||
return value;
|
||||
|
||||
return Binding.DoNothing;
|
||||
|
@ -17,7 +17,7 @@ namespace Filtration.Converters
|
|||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is ItemFilterScriptViewModel)
|
||||
if (value is IDocument)
|
||||
return value;
|
||||
|
||||
return Binding.DoNothing;
|
||||
|
|
|
@ -170,7 +170,9 @@
|
|||
<DependentUpon>ItemPreviewControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\LineReader.cs" />
|
||||
<Compile Include="ViewModels\BlockGroupBrowserViewModel.cs" />
|
||||
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||
<Compile Include="ViewModels\IDocument.cs" />
|
||||
<Compile Include="ViewModels\IItemFilterScriptViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\IItemFilterBlockViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ItemFilterBlockViewModel.cs" />
|
||||
|
@ -178,8 +180,13 @@
|
|||
<Compile Include="ViewModels\PaneViewModel.cs" />
|
||||
<Compile Include="ViewModels\ReplaceColorsViewModel.cs" />
|
||||
<Compile Include="ViewModels\SectionBrowserViewModel.cs" />
|
||||
<Compile Include="ViewModels\StartPageViewModel.cs" />
|
||||
<Compile Include="ViewModels\ToolViewModel.cs" />
|
||||
<Compile Include="Views\AttachedProperties\SelectingItemAttachedProperty.cs" />
|
||||
<Compile Include="Views\BindingProxy.cs" />
|
||||
<Compile Include="Views\BlockGroupBrowserView.xaml.cs">
|
||||
<DependentUpon>BlockGroupBrowserView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\BlockTemplateSelector.cs" />
|
||||
<Compile Include="Views\ItemFilterBlockDisplaySettingsView.xaml.cs">
|
||||
<DependentUpon>ItemFilterBlockDisplaySettingsView.xaml</DependentUpon>
|
||||
|
@ -199,15 +206,18 @@
|
|||
<Compile Include="Views\AboutWindow.xaml.cs">
|
||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LayoutInitializer.cs" />
|
||||
<Compile Include="Views\PanesStyleSelector.cs" />
|
||||
<Compile Include="Views\PanesTemplateSelector.cs" />
|
||||
<Compile Include="Views\AvalonDock\LayoutInitializer.cs" />
|
||||
<Compile Include="Views\AvalonDock\PanesStyleSelector.cs" />
|
||||
<Compile Include="Views\AvalonDock\PanesTemplateSelector.cs" />
|
||||
<Compile Include="Views\ReplaceColorsWindow.xaml.cs">
|
||||
<DependentUpon>ReplaceColorsWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\SectionBrowserView.xaml.cs">
|
||||
<DependentUpon>SectionBrowserView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\StartPageView.xaml.cs">
|
||||
<DependentUpon>StartPageView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
|
||||
|
@ -217,6 +227,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\BlockGroupBrowserView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\CrossButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -282,6 +296,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\StartPageView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
|
@ -338,6 +356,7 @@
|
|||
<Resource Include="Resources\Icons\about_icon.png" />
|
||||
<Resource Include="Resources\filtration.ico" />
|
||||
<Resource Include="Resources\Icons\replace_colors_icon.png" />
|
||||
<Resource Include="Resources\Icons\block_group_browser_icon.png" />
|
||||
<Content Include="Resources\ItemBaseTypes.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
@ -16,11 +16,16 @@ namespace Filtration.Models
|
|||
var currentBlockGroup = this;
|
||||
|
||||
var outputString = GroupName;
|
||||
|
||||
// TODO: This is retarded, fix this.
|
||||
if (currentBlockGroup.ParentGroup != null)
|
||||
{
|
||||
while (currentBlockGroup.ParentGroup.ParentGroup != null)
|
||||
{
|
||||
outputString = currentBlockGroup.ParentGroup.GroupName + " - " + outputString;
|
||||
currentBlockGroup = currentBlockGroup.ParentGroup;
|
||||
}
|
||||
}
|
||||
|
||||
return outputString;
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 158 B |
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
interface IDocument
|
||||
{
|
||||
bool IsScript { get; }
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ namespace Filtration.ViewModels
|
|||
string DisplayName { get; }
|
||||
void Initialise(ItemFilterScript itemFilterScript);
|
||||
IItemFilterBlockViewModel SelectedBlockViewModel { get; set; }
|
||||
IItemFilterBlockViewModel SectionBrowserSelectedBlockViewModel { get; set; }
|
||||
void RemoveDirtyFlag();
|
||||
IEnumerable<ItemFilterBlockGroup> BlockGroups { get; }
|
||||
IEnumerable<IItemFilterBlockViewModel> ItemFilterSectionViewModels { get; }
|
||||
void AddSection(IItemFilterBlockViewModel targetBlockViewModel);
|
||||
void AddBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
||||
|
@ -26,15 +28,18 @@ namespace Filtration.ViewModels
|
|||
void PasteBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
||||
}
|
||||
|
||||
internal class ItemFilterScriptViewModel : PaneViewModel, IItemFilterScriptViewModel
|
||||
internal class ItemFilterScriptViewModel : PaneViewModel, IItemFilterScriptViewModel, IDocument
|
||||
{
|
||||
private readonly IItemFilterBlockViewModelFactory _itemFilterBlockViewModelFactory;
|
||||
private readonly IItemFilterBlockTranslator _blockTranslator;
|
||||
private readonly IMainWindowViewModel _mainWindowViewModel;
|
||||
private bool _isDirty;
|
||||
private IItemFilterBlockViewModel _selectedBlockViewModel;
|
||||
private IItemFilterBlockViewModel _sectionBrowserSelectedBlockViewModel;
|
||||
|
||||
public ItemFilterScriptViewModel(IItemFilterBlockViewModelFactory itemFilterBlockViewModelFactory, IItemFilterBlockTranslator blockTranslator)
|
||||
public ItemFilterScriptViewModel(IItemFilterBlockViewModelFactory itemFilterBlockViewModelFactory, IItemFilterBlockTranslator blockTranslator, IMainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
CloseCommand = new RelayCommand(OnCloseCommand);
|
||||
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => SelectedBlockViewModel != null);
|
||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModel != null);
|
||||
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModel != null);
|
||||
|
@ -46,10 +51,16 @@ namespace Filtration.ViewModels
|
|||
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
|
||||
_itemFilterBlockViewModelFactory = itemFilterBlockViewModelFactory;
|
||||
_blockTranslator = blockTranslator;
|
||||
_mainWindowViewModel = mainWindowViewModel;
|
||||
ItemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModel>();
|
||||
|
||||
}
|
||||
|
||||
public bool IsScript
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public RelayCommand CloseCommand { get; private set; }
|
||||
public RelayCommand DeleteBlockCommand { get; private set; }
|
||||
public RelayCommand MoveBlockToTopCommand { get; private set; }
|
||||
public RelayCommand MoveBlockUpCommand { get; private set; }
|
||||
|
@ -67,8 +78,6 @@ namespace Filtration.ViewModels
|
|||
get { return ItemFilterBlockViewModels.Where(b => b.Block.GetType() == typeof (ItemFilterSection)); }
|
||||
}
|
||||
|
||||
public IItemFilterBlockViewModel SectionBrowserSelectedViewModel { get; set; }
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return Script.Description; }
|
||||
|
@ -90,8 +99,24 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public IItemFilterBlockViewModel SectionBrowserSelectedBlockViewModel
|
||||
{
|
||||
get { return _sectionBrowserSelectedBlockViewModel; }
|
||||
set
|
||||
{
|
||||
_sectionBrowserSelectedBlockViewModel = value;
|
||||
SelectedBlockViewModel = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemFilterScript Script { get; private set; }
|
||||
|
||||
public IEnumerable<ItemFilterBlockGroup> BlockGroups
|
||||
{
|
||||
get { return Script.ItemFilterBlockGroups; }
|
||||
}
|
||||
|
||||
public bool IsDirty
|
||||
{
|
||||
get { return _isDirty || HasDirtyChildren; }
|
||||
|
@ -153,6 +178,10 @@ namespace Filtration.ViewModels
|
|||
ContentId = "testcontentid";
|
||||
}
|
||||
|
||||
private void OnCloseCommand()
|
||||
{
|
||||
_mainWindowViewModel.Close(this);
|
||||
}
|
||||
private void OnCopyBlockCommand()
|
||||
{
|
||||
CopyBlock(SelectedBlockViewModel);
|
||||
|
|
|
@ -10,7 +10,6 @@ using Filtration.Services;
|
|||
using Filtration.Translators;
|
||||
using Filtration.Views;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using Xceed.Wpf.AvalonDock.Layout;
|
||||
using Clipboard = System.Windows.Clipboard;
|
||||
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
|
||||
|
||||
|
@ -18,9 +17,13 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
internal interface IMainWindowViewModel
|
||||
{
|
||||
IItemFilterScriptViewModel ActiveDocument { get; set; }
|
||||
IDocument ActiveDocument { get; set; }
|
||||
IItemFilterScriptViewModel ActiveScriptViewModel { get; }
|
||||
event EventHandler ActiveDocumentChanged;
|
||||
void LoadScriptFromFile(string path);
|
||||
RelayCommand OpenScriptCommand { get; }
|
||||
RelayCommand NewScriptCommand { get; }
|
||||
void Close(IDocument scriptToClose);
|
||||
}
|
||||
|
||||
internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel
|
||||
|
@ -32,38 +35,52 @@ namespace Filtration.ViewModels
|
|||
private readonly IItemFilterPersistenceService _persistenceService;
|
||||
private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator;
|
||||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||
private IItemFilterScriptViewModel _activeDocument;
|
||||
private readonly ObservableCollection<IItemFilterScriptViewModel> _scriptViewModels;
|
||||
private readonly SectionBrowserViewModel _sectionBrowserViewModel;
|
||||
private IDocument _activeDocument;
|
||||
private IItemFilterScriptViewModel _activeScriptViewModel;
|
||||
private readonly ObservableCollection<IDocument> _openDocuments;
|
||||
private readonly ISectionBrowserViewModel _sectionBrowserViewModel;
|
||||
private readonly IBlockGroupBrowserViewModel _blockGroupBrowserViewModel;
|
||||
private readonly IStartPageViewModel _startPageViewModel;
|
||||
|
||||
public MainWindowViewModel(IItemFilterScriptViewModelFactory itemFilterScriptViewModelFactory,
|
||||
IItemFilterPersistenceService persistenceService,
|
||||
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
||||
IReplaceColorsViewModel replaceColorsViewModel)
|
||||
IReplaceColorsViewModel replaceColorsViewModel,
|
||||
ISectionBrowserViewModel sectionBrowserViewModel,
|
||||
IBlockGroupBrowserViewModel blockGroupBrowserViewModel,
|
||||
IStartPageViewModel startPageViewModel)
|
||||
{
|
||||
_itemFilterScriptViewModelFactory = itemFilterScriptViewModelFactory;
|
||||
_persistenceService = persistenceService;
|
||||
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
||||
_replaceColorsViewModel = replaceColorsViewModel;
|
||||
_sectionBrowserViewModel = new SectionBrowserViewModel();
|
||||
_sectionBrowserViewModel.Initialise(this);
|
||||
_sectionBrowserViewModel = sectionBrowserViewModel;
|
||||
_blockGroupBrowserViewModel = blockGroupBrowserViewModel;
|
||||
_startPageViewModel = startPageViewModel;
|
||||
|
||||
_scriptViewModels = new ObservableCollection<IItemFilterScriptViewModel>();
|
||||
_sectionBrowserViewModel.Initialise(this);
|
||||
_blockGroupBrowserViewModel.Initialise(this);
|
||||
_startPageViewModel.Initialise(this);
|
||||
|
||||
_openDocuments = new ObservableCollection<IDocument>();
|
||||
|
||||
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, () => ActiveDocument != null);
|
||||
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => ActiveDocument != null);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocument != null);
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocument != null && ActiveDocument.SelectedBlockViewModel != null);
|
||||
PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocument != null && ActiveDocument.SelectedBlockViewModel != null);
|
||||
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, () => ActiveDocument != null && ActiveDocument.IsScript);
|
||||
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => ActiveDocument != null && ActiveDocument.IsScript);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocument != null && ActiveDocument.IsScript);
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocument != null && ActiveDocument.IsScript && ((IItemFilterScriptViewModel)ActiveDocument).SelectedBlockViewModel != null);
|
||||
PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocument != null && ActiveDocument.IsScript && ((IItemFilterScriptViewModel)ActiveDocument).SelectedBlockViewModel != null);
|
||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||
CloseScriptCommand = new RelayCommand<IItemFilterScriptViewModel>(OnCloseScriptCommand, v => ActiveDocument != null);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocument != null);
|
||||
CloseScriptCommand = new RelayCommand<IDocument>(OnCloseScriptCommand, v => ActiveDocument != null && ActiveDocument.IsScript);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocument != null && ActiveDocument.IsScript);
|
||||
|
||||
//LoadScriptFromFile("C:\\ThioleLootFilter.txt");
|
||||
|
||||
SetItemFilterScriptDirectory();
|
||||
|
||||
_openDocuments.Add(_startPageViewModel);
|
||||
ActiveDocument = startPageViewModel;
|
||||
}
|
||||
|
||||
public RelayCommand OpenScriptCommand { get; private set; }
|
||||
|
@ -73,38 +90,30 @@ namespace Filtration.ViewModels
|
|||
public RelayCommand PasteCommand { get; private set; }
|
||||
public RelayCommand CopyScriptCommand { get; private set; }
|
||||
public RelayCommand NewScriptCommand { get; private set; }
|
||||
public RelayCommand<IItemFilterScriptViewModel> CloseScriptCommand { get; private set; }
|
||||
public RelayCommand<IDocument> CloseScriptCommand { get; private set; }
|
||||
public RelayCommand OpenAboutWindowCommand { get; private set; }
|
||||
public RelayCommand ReplaceColorsCommand { get; private set; }
|
||||
|
||||
public ObservableCollection<IItemFilterScriptViewModel> ScriptViewModels
|
||||
public ObservableCollection<IDocument> OpenDocuments
|
||||
{
|
||||
get { return _scriptViewModels; }
|
||||
get { return _openDocuments; }
|
||||
}
|
||||
|
||||
private List<ToolViewModel> _tools;
|
||||
private List<IToolViewModel> _tools;
|
||||
|
||||
public IEnumerable<ToolViewModel> Tools
|
||||
public IEnumerable<IToolViewModel> Tools
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tools == null)
|
||||
{
|
||||
_tools = new List<ToolViewModel> { _sectionBrowserViewModel };
|
||||
_tools = new List<IToolViewModel> {_sectionBrowserViewModel, _blockGroupBrowserViewModel};
|
||||
}
|
||||
|
||||
return _tools;
|
||||
}
|
||||
}
|
||||
|
||||
public SectionBrowserViewModel SectionBrowserViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _sectionBrowserViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
public string WindowTitle
|
||||
{
|
||||
get
|
||||
|
@ -115,14 +124,19 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
[DoNotWire]
|
||||
public IItemFilterScriptViewModel ActiveDocument
|
||||
public IDocument ActiveDocument
|
||||
{
|
||||
get { return _activeDocument; }
|
||||
set
|
||||
{
|
||||
_activeDocument = value;
|
||||
RaisePropertyChanged();
|
||||
|
||||
if (value.IsScript)
|
||||
{
|
||||
_activeScriptViewModel = (IItemFilterScriptViewModel)value;
|
||||
}
|
||||
|
||||
if (ActiveDocumentChanged != null)
|
||||
{
|
||||
ActiveDocumentChanged(this, EventArgs.Empty);
|
||||
|
@ -134,6 +148,12 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public IItemFilterScriptViewModel ActiveScriptViewModel
|
||||
{
|
||||
get { return _activeScriptViewModel; }
|
||||
}
|
||||
|
||||
|
||||
public event EventHandler ActiveDocumentChanged;
|
||||
|
||||
public bool NoScriptsOpen
|
||||
|
@ -175,8 +195,9 @@ namespace Filtration.ViewModels
|
|||
|
||||
var newViewModel = _itemFilterScriptViewModelFactory.Create();
|
||||
newViewModel.Initialise(_loadedScript);
|
||||
ScriptViewModels.Add(newViewModel);
|
||||
ActiveDocument = newViewModel;
|
||||
_activeScriptViewModel = newViewModel;
|
||||
OpenDocuments.Add((IDocument)newViewModel);
|
||||
ActiveDocument = (IDocument)newViewModel;
|
||||
}
|
||||
|
||||
private void SetItemFilterScriptDirectory()
|
||||
|
@ -206,7 +227,7 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
if (!ValidateScript()) return;
|
||||
|
||||
if (string.IsNullOrEmpty(ActiveDocument.Script.FilePath))
|
||||
if (string.IsNullOrEmpty(_activeScriptViewModel.Script.FilePath))
|
||||
{
|
||||
OnSaveScriptAsCommand();
|
||||
return;
|
||||
|
@ -214,8 +235,8 @@ namespace Filtration.ViewModels
|
|||
|
||||
try
|
||||
{
|
||||
_persistenceService.SaveItemFilterScript(ActiveDocument.Script);
|
||||
ActiveDocument.RemoveDirtyFlag();
|
||||
_persistenceService.SaveItemFilterScript(_activeScriptViewModel.Script);
|
||||
_activeScriptViewModel.RemoveDirtyFlag();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -240,31 +261,31 @@ namespace Filtration.ViewModels
|
|||
|
||||
if (result != DialogResult.OK) return;
|
||||
|
||||
var previousFilePath = ActiveDocument.Script.FilePath;
|
||||
var previousFilePath = _activeScriptViewModel.Script.FilePath;
|
||||
try
|
||||
{
|
||||
ActiveDocument.Script.FilePath = saveDialog.FileName;
|
||||
_persistenceService.SaveItemFilterScript(ActiveDocument.Script);
|
||||
ActiveDocument.RemoveDirtyFlag();
|
||||
_activeScriptViewModel.Script.FilePath = saveDialog.FileName;
|
||||
_persistenceService.SaveItemFilterScript(_activeScriptViewModel.Script);
|
||||
_activeScriptViewModel.RemoveDirtyFlag();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
ActiveDocument.Script.FilePath = previousFilePath;
|
||||
_activeScriptViewModel.Script.FilePath = previousFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReplaceColorsCommand()
|
||||
{
|
||||
_replaceColorsViewModel.Initialise(ActiveDocument.Script);
|
||||
_replaceColorsViewModel.Initialise(_activeScriptViewModel.Script);
|
||||
var replaceColorsWindow = new ReplaceColorsWindow {DataContext = _replaceColorsViewModel};
|
||||
replaceColorsWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private bool ValidateScript()
|
||||
{
|
||||
var result = ActiveDocument.Script.Validate();
|
||||
var result = _activeScriptViewModel.Script.Validate();
|
||||
|
||||
if (result.Count == 0) return true;
|
||||
|
||||
|
@ -283,17 +304,17 @@ namespace Filtration.ViewModels
|
|||
|
||||
private void OnCopyScriptCommand()
|
||||
{
|
||||
Clipboard.SetText(_itemFilterScriptTranslator.TranslateItemFilterScriptToString(_activeDocument.Script));
|
||||
Clipboard.SetText(_itemFilterScriptTranslator.TranslateItemFilterScriptToString(_activeScriptViewModel.Script));
|
||||
}
|
||||
|
||||
private void OnCopyBlockCommand()
|
||||
{
|
||||
_activeDocument.CopyBlock(_activeDocument.SelectedBlockViewModel);
|
||||
_activeScriptViewModel.CopyBlock(_activeScriptViewModel.SelectedBlockViewModel);
|
||||
}
|
||||
|
||||
private void OnPasteCommand()
|
||||
{
|
||||
_activeDocument.PasteBlock(_activeDocument.SelectedBlockViewModel);
|
||||
_activeScriptViewModel.PasteBlock(_activeScriptViewModel.SelectedBlockViewModel);
|
||||
}
|
||||
|
||||
private void OnNewScriptCommand()
|
||||
|
@ -302,16 +323,24 @@ namespace Filtration.ViewModels
|
|||
var newViewModel = _itemFilterScriptViewModelFactory.Create();
|
||||
newViewModel.Initialise(newScript);
|
||||
newViewModel.Description = "New Script";
|
||||
ScriptViewModels.Add(newViewModel);
|
||||
ActiveDocument = newViewModel;
|
||||
_activeScriptViewModel = newViewModel;
|
||||
OpenDocuments.Add((IDocument)newViewModel);
|
||||
ActiveDocument = (IDocument)newViewModel;
|
||||
}
|
||||
|
||||
private void OnCloseScriptCommand(IItemFilterScriptViewModel scriptViewModel)
|
||||
private void OnCloseScriptCommand(IDocument documentToClose)
|
||||
{
|
||||
ActiveDocument = scriptViewModel;
|
||||
if (!ActiveDocument.IsDirty)
|
||||
Close(documentToClose);
|
||||
}
|
||||
|
||||
public void Close(IDocument documentToClose)
|
||||
{
|
||||
ScriptViewModels.Remove(ActiveDocument);
|
||||
ActiveDocument = documentToClose;
|
||||
if (ActiveDocument.IsScript)
|
||||
{
|
||||
if (!_activeScriptViewModel.IsDirty)
|
||||
{
|
||||
RemoveDocument(ActiveDocument);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -322,20 +351,38 @@ namespace Filtration.ViewModels
|
|||
case DialogResult.Yes:
|
||||
{
|
||||
OnSaveScriptCommand();
|
||||
ScriptViewModels.Remove(ActiveDocument);
|
||||
RemoveDocument(ActiveDocument);
|
||||
break;
|
||||
}
|
||||
case DialogResult.No:
|
||||
{
|
||||
ScriptViewModels.Remove(ActiveDocument);
|
||||
RemoveDocument(ActiveDocument);
|
||||
break;
|
||||
}
|
||||
case DialogResult.Cancel:
|
||||
{
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveDocument(documentToClose);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RemoveDocument(IDocument documentToRemove)
|
||||
{
|
||||
if (documentToRemove.IsScript)
|
||||
{
|
||||
_sectionBrowserViewModel.ClearDown();
|
||||
}
|
||||
|
||||
OpenDocuments.Remove(documentToRemove);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ISectionBrowserViewModel
|
||||
internal interface ISectionBrowserViewModel : IToolViewModel
|
||||
{
|
||||
void ClearDown();
|
||||
}
|
||||
|
||||
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;
|
||||
var icon = new BitmapImage();
|
||||
icon.BeginInit();
|
||||
icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/add_section_icon.png");
|
||||
icon.EndInit();
|
||||
IconSource = icon;
|
||||
}
|
||||
|
||||
public const string ToolContentId = "SectionBrowserTool";
|
||||
|
||||
public override void Initialise(IMainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
base.Initialise(mainWindowViewModel);
|
||||
MainWindowViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
|
||||
}
|
||||
|
||||
public IEnumerable<IItemFilterBlockViewModel> SectionBlockViewModels
|
||||
{
|
||||
get { return _sectionBlockViewModels; }
|
||||
|
@ -43,13 +49,30 @@ namespace Filtration.ViewModels
|
|||
set
|
||||
{
|
||||
_selectedSectionBlockViewModel = value;
|
||||
if (MainWindowViewModel.ActiveDocument.IsScript)
|
||||
{
|
||||
MainWindowViewModel.ActiveScriptViewModel.SectionBrowserSelectedBlockViewModel = value;
|
||||
}
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnActiveDocumentChanged(object sender, EventArgs e)
|
||||
{
|
||||
SectionBlockViewModels = _mainWindowViewModel.ActiveDocument != null ? _mainWindowViewModel.ActiveDocument.ItemFilterSectionViewModels : null;
|
||||
if (MainWindowViewModel.ActiveScriptViewModel != null && MainWindowViewModel.ActiveDocument.IsScript)
|
||||
{
|
||||
SectionBlockViewModels = MainWindowViewModel.ActiveScriptViewModel.ItemFilterSectionViewModels;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearDown();
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearDown()
|
||||
{
|
||||
SectionBlockViewModels = null;
|
||||
SelectedSectionBlockViewModel = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface IStartPageViewModel : IDocument
|
||||
{
|
||||
void Initialise(IMainWindowViewModel mainWindowViewModel);
|
||||
}
|
||||
|
||||
internal class StartPageViewModel : PaneViewModel, IStartPageViewModel
|
||||
{
|
||||
private IMainWindowViewModel _mainWindowViewModel;
|
||||
|
||||
public StartPageViewModel()
|
||||
{
|
||||
Title = "Start Page";
|
||||
}
|
||||
|
||||
public void Initialise(IMainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
_mainWindowViewModel = mainWindowViewModel;
|
||||
}
|
||||
|
||||
public RelayCommand OpenScriptCommand { get { return _mainWindowViewModel.OpenScriptCommand; } }
|
||||
public RelayCommand NewScriptCommand { get { return _mainWindowViewModel.NewScriptCommand; } }
|
||||
|
||||
public bool IsScript { get { return false; } }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,11 @@
|
|||
namespace Filtration.ViewModels
|
||||
{
|
||||
class ToolViewModel : PaneViewModel
|
||||
internal interface IToolViewModel
|
||||
{
|
||||
void Initialise(IMainWindowViewModel mainWindowViewModel);
|
||||
}
|
||||
|
||||
class ToolViewModel : PaneViewModel, IToolViewModel
|
||||
{
|
||||
public ToolViewModel(string name)
|
||||
{
|
||||
|
@ -23,5 +28,12 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected IMainWindowViewModel MainWindowViewModel { get; private set; }
|
||||
|
||||
public virtual void Initialise(IMainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
MainWindowViewModel = mainWindowViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Filtration.ViewModels;
|
||||
|
||||
namespace Filtration.Views.AttachedProperties
|
||||
{
|
||||
internal class SelectingItemAttachedProperty
|
||||
{
|
||||
public static readonly DependencyProperty SelectingItemProperty = DependencyProperty.RegisterAttached(
|
||||
"SelectingItem",
|
||||
typeof(IItemFilterBlockViewModel),
|
||||
typeof(SelectingItemAttachedProperty),
|
||||
new PropertyMetadata(default(IItemFilterBlockViewModel), OnSelectingItemChanged));
|
||||
|
||||
public static IItemFilterBlockViewModel GetSelectingItem(DependencyObject target)
|
||||
{
|
||||
return (IItemFilterBlockViewModel)target.GetValue(SelectingItemProperty);
|
||||
}
|
||||
|
||||
public static void SetSelectingItem(DependencyObject target, IItemFilterBlockViewModel value)
|
||||
{
|
||||
target.SetValue(SelectingItemProperty, value);
|
||||
}
|
||||
|
||||
static void OnSelectingItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var listBox = sender as ListBox;
|
||||
if (listBox == null || listBox.SelectedItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
listBox.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
listBox.UpdateLayout();
|
||||
listBox.ScrollIntoView(listBox.SelectedItem);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
using System.Linq;
|
||||
using Xceed.Wpf.AvalonDock.Layout;
|
||||
|
||||
namespace Filtration.Views
|
||||
namespace Filtration.Views.AvalonDock
|
||||
{
|
||||
class LayoutInitializer : ILayoutUpdateStrategy
|
||||
{
|
||||
|
@ -15,12 +15,29 @@ namespace Filtration.Views
|
|||
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;
|
||||
}
|
||||
//if (anchorableToShow.ContentId == "SectionBrowserTool")
|
||||
//{
|
||||
// var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "SectionBrowserPane");
|
||||
// if (toolsPane != null)
|
||||
// {
|
||||
// anchorableToShow.CanHide = false;
|
||||
// toolsPane.Children.Add(anchorableToShow);
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (anchorableToShow.ContentId == "BlockGroupBrowserTool")
|
||||
//{
|
||||
// var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "BlockGroupBrowserPane");
|
||||
// if (toolsPane != null)
|
||||
// {
|
||||
// anchorableToShow.CanHide = false;
|
||||
// toolsPane.Children.Add(anchorableToShow);
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
using System.Windows.Controls;
|
||||
using Filtration.ViewModels;
|
||||
|
||||
namespace Filtration.Views
|
||||
namespace Filtration.Views.AvalonDock
|
||||
{
|
||||
class PanesStyleSelector : StyleSelector
|
||||
{
|
||||
public Style ToolStyle { get; set; }
|
||||
public Style ScriptStyle { get; set; }
|
||||
public Style DocumentStyle { get; set; }
|
||||
|
||||
public override Style SelectStyle(object item, DependencyObject container)
|
||||
{
|
||||
|
@ -16,9 +16,9 @@ namespace Filtration.Views
|
|||
return ToolStyle;
|
||||
}
|
||||
|
||||
if (item is IItemFilterScriptViewModel)
|
||||
if (item is IDocument)
|
||||
{
|
||||
return ScriptStyle;
|
||||
return DocumentStyle;
|
||||
}
|
||||
|
||||
return base.SelectStyle(item, container);
|
|
@ -3,15 +3,14 @@ using System.Windows.Controls;
|
|||
using Filtration.ViewModels;
|
||||
using Xceed.Wpf.AvalonDock.Layout;
|
||||
|
||||
namespace Filtration.Views
|
||||
namespace Filtration.Views.AvalonDock
|
||||
{
|
||||
class PanesTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
public DataTemplate ItemFilterScriptTemplate { get; set; }
|
||||
|
||||
public DataTemplate BlockGroupBrowserTemplate { get; set; }
|
||||
public DataTemplate SectionBrowserTemplate { get; set; }
|
||||
|
||||
|
||||
public DataTemplate StartPageTemplate { get; set; }
|
||||
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
|
@ -27,6 +26,16 @@ namespace Filtration.Views
|
|||
return SectionBrowserTemplate;
|
||||
}
|
||||
|
||||
if (item is BlockGroupBrowserViewModel)
|
||||
{
|
||||
return BlockGroupBrowserTemplate;
|
||||
}
|
||||
|
||||
if (item is StartPageViewModel)
|
||||
{
|
||||
return StartPageTemplate;
|
||||
}
|
||||
|
||||
return base.SelectTemplate(item, container);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<UserControl x:Class="Filtration.Views.BlockGroupBrowserView"
|
||||
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:models="clr-namespace:Filtration.Models"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:BlockGroupBrowserViewModel}"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<UserControl.Resources>
|
||||
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<TreeView ItemsSource="{Binding BlockGroups}">
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type models:ItemFilterBlockGroup}" ItemsSource="{Binding ChildGroups}">
|
||||
<WrapPanel>
|
||||
<CheckBox IsThreeState="True" />
|
||||
<TextBlock Text="{Binding GroupName}" />
|
||||
</WrapPanel>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.Resources>
|
||||
</TreeView>
|
||||
</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 BlockGroupBrowserView.xaml
|
||||
/// </summary>
|
||||
public partial class BlockGroupBrowserView : UserControl
|
||||
{
|
||||
public BlockGroupBrowserView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:views="clr-namespace:Filtration.Views"
|
||||
xmlns:attachedProperties="clr-namespace:Filtration.Views.AttachedProperties"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
mc:Ignorable="d"
|
||||
|
@ -87,6 +88,7 @@
|
|||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||
ItemTemplateSelector="{StaticResource BlockTemplateSelector}"
|
||||
attachedProperties:SelectingItemAttachedProperty.SelectingItem="{Binding SectionBrowserSelectedBlockViewModel}"
|
||||
SelectedItem="{Binding SelectedBlockViewModel}" x:Name="BlocksListBox">
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding DeleteBlockCommand}" />
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System.Windows.Controls;
|
||||
|
||||
namespace Filtration.Views
|
||||
namespace Filtration.Views
|
||||
{
|
||||
public partial class ItemFilterScriptView
|
||||
{
|
||||
|
@ -8,11 +6,5 @@ namespace Filtration.Views
|
|||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SectionBrowserListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var listBox = (ListBox) sender;
|
||||
BlocksListBox.ScrollIntoView(listBox.SelectedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"
|
||||
xmlns:converters="clr-namespace:Filtration.Converters"
|
||||
xmlns:views="clr-namespace:Filtration.Views"
|
||||
xmlns:viewsAvalonDock="clr-namespace:Filtration.Views.AvalonDock"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:MainWindowViewModel}"
|
||||
Title="{Binding WindowTitle}" Height="707" Width="930" BorderThickness="1" BorderBrush="Black">
|
||||
|
@ -50,26 +51,37 @@
|
|||
<Grid>
|
||||
<avalonDock:DockingManager x:Name="dockManager"
|
||||
AnchorablesSource="{Binding Tools}"
|
||||
DocumentsSource="{Binding ScriptViewModels}"
|
||||
AllowMixedOrientation="True"
|
||||
DocumentsSource="{Binding OpenDocuments}"
|
||||
ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}">
|
||||
<avalonDock:DockingManager.LayoutItemTemplateSelector>
|
||||
<views:PanesTemplateSelector>
|
||||
<views:PanesTemplateSelector.ItemFilterScriptTemplate>
|
||||
<viewsAvalonDock:PanesTemplateSelector>
|
||||
<viewsAvalonDock:PanesTemplateSelector.ItemFilterScriptTemplate>
|
||||
<DataTemplate>
|
||||
<views:ItemFilterScriptView DataContext="{Binding}" />
|
||||
</DataTemplate>
|
||||
</views:PanesTemplateSelector.ItemFilterScriptTemplate>
|
||||
<views:PanesTemplateSelector.SectionBrowserTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector.ItemFilterScriptTemplate>
|
||||
<viewsAvalonDock:PanesTemplateSelector.BlockGroupBrowserTemplate>
|
||||
<DataTemplate>
|
||||
<views:BlockGroupBrowserView DataContext="{Binding}" />
|
||||
</DataTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector.BlockGroupBrowserTemplate>
|
||||
<viewsAvalonDock:PanesTemplateSelector.SectionBrowserTemplate>
|
||||
<DataTemplate>
|
||||
<views:SectionBrowserView DataContext="{Binding}" />
|
||||
</DataTemplate>
|
||||
</views:PanesTemplateSelector.SectionBrowserTemplate>
|
||||
</views:PanesTemplateSelector>
|
||||
</viewsAvalonDock:PanesTemplateSelector.SectionBrowserTemplate>
|
||||
<viewsAvalonDock:PanesTemplateSelector.StartPageTemplate>
|
||||
<DataTemplate>
|
||||
<views:StartPageView DataContext="{Binding}" />
|
||||
</DataTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector.StartPageTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector>
|
||||
</avalonDock:DockingManager.LayoutItemTemplateSelector>
|
||||
|
||||
<avalonDock:DockingManager.LayoutItemContainerStyleSelector>
|
||||
<views:PanesStyleSelector>
|
||||
<views:PanesStyleSelector.ToolStyle>
|
||||
<viewsAvalonDock:PanesStyleSelector>
|
||||
<viewsAvalonDock:PanesStyleSelector.ToolStyle>
|
||||
<Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
|
||||
<Setter Property="Title" Value="{Binding Model.Title}"/>
|
||||
<Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
|
||||
|
@ -78,51 +90,30 @@
|
|||
<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>
|
||||
</viewsAvalonDock:PanesStyleSelector.ToolStyle>
|
||||
<viewsAvalonDock:PanesStyleSelector.DocumentStyle>
|
||||
<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="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>
|
||||
</viewsAvalonDock:PanesStyleSelector.DocumentStyle>
|
||||
</viewsAvalonDock:PanesStyleSelector>
|
||||
</avalonDock:DockingManager.LayoutItemContainerStyleSelector>
|
||||
<avalonDock:DockingManager.LayoutUpdateStrategy>
|
||||
<views:LayoutInitializer></views:LayoutInitializer>
|
||||
<viewsAvalonDock:LayoutInitializer></viewsAvalonDock:LayoutInitializer>
|
||||
</avalonDock:DockingManager.LayoutUpdateStrategy>
|
||||
|
||||
<avalonDock:LayoutRoot>
|
||||
<avalonDock:LayoutPanel Orientation="Horizontal">
|
||||
<avalonDock:LayoutAnchorablePane Name="ToolsPane" DockWidth="150" />
|
||||
<avalonDock:LayoutAnchorablePane Name="SectionBrowserPane" DockWidth="150" />
|
||||
<avalonDock:LayoutDocumentPane/>
|
||||
|
||||
<avalonDock:LayoutAnchorablePane Name="BlockGroupBrowserPane" DockWidth="150" />
|
||||
</avalonDock:LayoutPanel>
|
||||
</avalonDock:LayoutRoot>
|
||||
</avalonDock:DockingManager>
|
||||
|
||||
|
||||
<!--<controls:MetroTabControl ItemsSource="{Binding ScriptViewModels}" SelectedItem="{Binding CurrentScriptViewModel}" Name="TabControl" Background="White">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
|
||||
<TextBlock Text="{Binding DisplayName}" FontSize="16" VerticalAlignment="Center" Margin="0,0,3,0" />
|
||||
<userControls:CrossButton Height="12" Command="{Binding ElementName=TabControl, Path=DataContext.CloseScriptCommand}" CommandParameter="{Binding}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<controls:MetroContentControl>
|
||||
<views:ItemFilterScriptView DataContext="{Binding}" />
|
||||
</controls:MetroContentControl>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</controls:MetroTabControl>-->
|
||||
<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>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</controls:MetroWindow>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<ListBox ItemsSource="{Binding SectionBlockViewModels}"
|
||||
SelectedItem="{Binding SelectedSectionBlockViewModel}"
|
||||
x:Name="SectionBrowserListBox"
|
||||
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"><!--SelectionChanged="SectionBrowserListBox_OnSelectionChanged"-->
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<UserControl x:Class="Filtration.Views.StartPageView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="600">
|
||||
<Grid>
|
||||
<TextBlock FontStyle="Italic" Margin="5" FontSize="13">
|
||||
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>
|
||||
</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 StartPageView.xaml
|
||||
/// </summary>
|
||||
public partial class StartPageView : UserControl
|
||||
{
|
||||
public StartPageView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,11 +30,21 @@ namespace Filtration.WindsorInstallers
|
|||
.ImplementedBy<ReplaceColorsViewModel>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.Register(
|
||||
Component.For<IStartPageViewModel>()
|
||||
.ImplementedBy<StartPageViewModel>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.Register(
|
||||
Component.For<ISectionBrowserViewModel>()
|
||||
.ImplementedBy<SectionBrowserViewModel>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.Register(
|
||||
Component.For<IBlockGroupBrowserViewModel>()
|
||||
.ImplementedBy<BlockGroupBrowserViewModel>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.AddFacility<TypedFactoryFacility>();
|
||||
container.Register(
|
||||
Component.For<IItemFilterBlockViewModelFactory>().AsFactory());
|
||||
|
|
Loading…
Reference in New Issue