17 Commits

Author SHA1 Message Date
Ben
e80295cb69 Removed Thrusting One Hand Swords from Base Types 2015-07-15 19:48:51 +01:00
Ben
f3ed386845 Removed Stackable Currency from ItemClasses 2015-07-15 19:48:33 +01:00
Ben
89e0c717e8 Bumped version to 0.9 2015-07-15 19:45:49 +01:00
Ben
8924637b98 Added hint text when no audio visual block items are added. 2015-07-15 19:41:31 +01:00
Ben
b0b912c676 Added save check on close 2015-07-15 19:36:42 +01:00
Ben
92ebc51e7b Switched file save encoding to UTF-8 2015-07-15 19:17:19 +01:00
Ben
95e7581a5b Fixed Delete Theme Component button being enabled for non-master themes 2015-07-15 19:12:19 +01:00
Ben
9cb854b584 Fixed Usages: 0 being visible when editing a non-master theme 2015-07-15 19:10:51 +01:00
Ben
61c2902f0c Merge branch 'master' of https://github.com/ben-wallis/Filtration.git 2015-07-15 19:02:34 +01:00
Ben
dc157713f3 Fixed Issue #8 - Crash when Filtration cannot perform the update check on startup 2015-07-15 19:02:29 +01:00
Ben Wallis
16fe837544 updated to 0.8 2015-07-13 15:17:53 +01:00
Ben
58de6f06b9 Added Jewel to ItemClasses.txt 2015-07-10 18:13:12 +01:00
Ben
af2dace29a Fixed crash when opening a script after Filtration is invoked via file association (Issue #7) 2015-07-10 18:11:03 +01:00
Ben
59cf604430 Revert "Increased the size of the Item Preview control to cater for FontSize 45"
This reverts commit 93a51e7829.
2015-07-10 17:54:42 +01:00
Ben
93a51e7829 Increased the size of the Item Preview control to cater for FontSize 45 2015-07-10 17:52:10 +01:00
Ben
9d928a374a Fixed crash when clicking Close menu option with no script/theme open
Fixed memory leak when documents are closed.
2015-07-10 17:48:34 +01:00
Ben
b5788504cb Fixed Disabled Block Block Group Bug (Issue #6) 2015-07-10 17:29:37 +01:00
16 changed files with 162 additions and 89 deletions

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.IO; using System.IO;
using System.Text;
namespace Filtration.Common.Services namespace Filtration.Common.Services
{ {
@@ -20,7 +21,7 @@ namespace Filtration.Common.Services
public void WriteFileFromString(string filePath, string inputString) public void WriteFileFromString(string filePath, string inputString)
{ {
File.WriteAllText(filePath, inputString); File.WriteAllText(filePath, inputString, Encoding.UTF8);
} }
public bool DirectoryExists(string directoryPath) public bool DirectoryExists(string directoryPath)

View File

@@ -353,6 +353,39 @@ namespace Filtration.Tests.Translators
Assert.AreEqual("This is a disabled block", secondBlock.Description); Assert.AreEqual("This is a disabled block", secondBlock.Description);
} }
[Test]
public void TranslateStringToItemFilterScript_DisabledBlockWithBlockGroup_ReturnsCorrectBlock()
{
// Arrange
var testInputScript = "Show" + Environment.NewLine +
" ItemLevel > 2" + Environment.NewLine +
" SetTextColor 255 40 0" + Environment.NewLine +
Environment.NewLine +
"#Disabled Block Start" + Environment.NewLine +
"# This is a disabled block" + Environment.NewLine +
"#Show#My Block Group" + Environment.NewLine +
"# ItemLevel > 2" + Environment.NewLine +
"#Disabled Block End";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
_testUtility.MockBlockGroupHierarchyBuilder.Setup(
b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
.Returns(new ItemFilterBlockGroup("My Block Group", null));
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
Assert.AreEqual("This is a disabled block", secondBlock.Description);
Assert.AreEqual("My Block Group", secondBlock.BlockGroup.GroupName);
}
private class ItemFilterScriptTranslatorTestUtility private class ItemFilterScriptTranslatorTestUtility
{ {
public ItemFilterScriptTranslatorTestUtility() public ItemFilterScriptTranslatorTestUtility()

View File

@@ -21,30 +21,29 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.Resources> <Grid.Resources>
<DataTemplate x:Key="EditableComponentNameTemplate"> <DataTemplate x:Key="EditableComponentNameTemplate">
<TextBox Text="{Binding ComponentName}" /> <StackPanel>
<TextBlock Text="{Binding UsageCount, StringFormat='Usages: {0}'}"
FontSize="10"
HorizontalAlignment="Right"
Visibility="{Binding Path=DataContext.EditEnabled, RelativeSource={RelativeSource AncestorType={x:Type views:ThemeEditorView}}, Converter={StaticResource BooleanVisibilityConverter}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding UsageCount}" Value="0">
<Setter Property="Foreground" Value="Red" />
</DataTrigger>
</Style.Triggers>
<Setter Property="Foreground" Value="SteelBlue" />
</Style>
</TextBlock.Style>
</TextBlock>
<TextBox Text="{Binding ComponentName}" />
</StackPanel>
</DataTemplate> </DataTemplate>
<DataTemplate x:Key="ViewOnlyComponentNameTemplate"> <DataTemplate x:Key="ViewOnlyComponentNameTemplate">
<TextBlock Text="{Binding ComponentName}" ToolTip="{Binding ComponentName}" /> <TextBlock Text="{Binding ComponentName}" ToolTip="{Binding ComponentName}" />
</DataTemplate> </DataTemplate>
</Grid.Resources> </Grid.Resources>
<DockPanel LastChildFill="True">
<TextBlock DockPanel.Dock="Left"
Text="{Binding UsageCount, StringFormat='Usages: {0}'}"
FontSize="10"
HorizontalAlignment="Right"
Visibility="{Binding Path=DataContext.EditEnabled, RelativeSource={RelativeSource AncestorType={x:Type views:ThemeEditorView}}, Converter={StaticResource BooleanVisibilityConverter}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding UsageCount}" Value="0">
<Setter Property="Foreground" Value="Red" />
</DataTrigger>
</Style.Triggers>
<Setter Property="Foreground" Value="SteelBlue" />
</Style>
</TextBlock.Style>
</TextBlock>
</DockPanel>
<ContentControl Grid.Row="1" Content="{Binding}"> <ContentControl Grid.Row="1" Content="{Binding}">
<ContentControl.Style> <ContentControl.Style>
<Style TargetType="ContentControl"> <Style TargetType="ContentControl">
@@ -59,7 +58,6 @@
</Style> </Style>
</ContentControl.Style> </ContentControl.Style>
</ContentControl> </ContentControl>
<xctk:ColorPicker Grid.Row="2" SelectedColor="{Binding Color}" /> <xctk:ColorPicker Grid.Row="2" SelectedColor="{Binding Color}" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -17,7 +17,7 @@ using NLog;
namespace Filtration namespace Filtration
{ {
public partial class App public partial class App : Application
{ {
private IWindsorContainer _container; private IWindsorContainer _container;
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private static readonly Logger _logger = LogManager.GetCurrentClassLogger();

View File

@@ -50,7 +50,7 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.*")] [assembly: AssemblyVersion("0.9.*")]
[assembly: InternalsVisibleTo("Filtration.Tests")] [assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

View File

@@ -8,7 +8,6 @@ Claws
Daggers Daggers
Wands Wands
One Hand Swords One Hand Swords
Thrusting One Hand Swords
One Hand Axes One Hand Axes
One Hand Maces One Hand Maces
Bows Bows
@@ -25,7 +24,6 @@ Boots
Body Armours Body Armours
Helmets Helmets
Shields Shields
Stackable Currency
Quest Items Quest Items
Sceptres Sceptres
Utility Flasks Utility Flasks
@@ -34,4 +32,5 @@ Fishing Rods
Map Fragments Map Fragments
Hideout Doodads Hideout Doodads
Microtransactions Microtransactions
Divination Card Divination Card
Jewel

View File

@@ -1,6 +1,8 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows;
using Filtration.Common.Services; using Filtration.Common.Services;
using Filtration.Utilities; using Filtration.Utilities;
@@ -28,10 +30,10 @@ namespace Filtration.Services
private void PopulateStaticData() private void PopulateStaticData()
{ {
var itemBaseTypes = _fileSystemService.ReadFileAsString("Resources\\ItemBaseTypes.txt"); var itemBaseTypes = _fileSystemService.ReadFileAsString(AppDomain.CurrentDomain.BaseDirectory + "\\Resources\\ItemBaseTypes.txt");
ItemBaseTypes = new LineReader(() => new StringReader(itemBaseTypes)).ToList(); ItemBaseTypes = new LineReader(() => new StringReader(itemBaseTypes)).ToList();
var itemClasses = _fileSystemService.ReadFileAsString("Resources\\ItemClasses.txt"); var itemClasses = _fileSystemService.ReadFileAsString(AppDomain.CurrentDomain.BaseDirectory + "\\Resources\\ItemClasses.txt");
ItemClasses = new LineReader(() => new StringReader(itemClasses)).ToList(); ItemClasses = new LineReader(() => new StringReader(itemClasses)).ToList();
} }
} }

View File

@@ -56,6 +56,7 @@ namespace Filtration.Translators
} }
lines[i] = lines[i].TrimStart('#'); lines[i] = lines[i].TrimStart('#');
lines[i] = lines[i].Replace("#", " # ");
var spaceOrEndOfLinePos = lines[i].IndexOf(" ", StringComparison.Ordinal) > 0 ? lines[i].IndexOf(" ", StringComparison.Ordinal) : lines[i].Length; var spaceOrEndOfLinePos = lines[i].IndexOf(" ", StringComparison.Ordinal) > 0 ? lines[i].IndexOf(" ", StringComparison.Ordinal) : lines[i].Length;
var lineOption = lines[i].Substring(0, spaceOrEndOfLinePos); var lineOption = lines[i].Substring(0, spaceOrEndOfLinePos);

View File

@@ -171,6 +171,19 @@ namespace Filtration.ViewModels
{ {
_activeDocument = null; _activeDocument = null;
} }
// TODO: Replace _activeScriptViewModel and _activeThemeViewModel with a better solution.
if (document.IsScript && _activeScriptViewModel == (IItemFilterScriptViewModel) document)
{
_activeScriptViewModel = null;
}
if (document.IsTheme && _activeThemeViewModel == (IThemeEditorViewModel)document)
{
_activeThemeViewModel = null;
}
} }
public void SwitchActiveDocument(IDocument document) public void SwitchActiveDocument(IDocument document)

View File

@@ -317,6 +317,12 @@ namespace Filtration.ViewModels
get { return Block.HasBlockItemOfType<SoundBlockItem>(); } get { return Block.HasBlockItemOfType<SoundBlockItem>(); }
} }
public bool HasAudioVisualBlockItems
{
get { return AudioVisualBlockItems.Any(); }
}
private void OnSwitchBlockItemsViewCommand() private void OnSwitchBlockItemsViewCommand()
{ {
AudioVisualBlockItemsGridVisible = !AudioVisualBlockItemsGridVisible; AudioVisualBlockItemsGridVisible = !AudioVisualBlockItemsGridVisible;
@@ -459,6 +465,7 @@ namespace Filtration.ViewModels
RaisePropertyChanged("RegularBlockItems"); RaisePropertyChanged("RegularBlockItems");
RaisePropertyChanged("SummaryBlockItems"); RaisePropertyChanged("SummaryBlockItems");
RaisePropertyChanged("AudioVisualBlockItems"); RaisePropertyChanged("AudioVisualBlockItems");
RaisePropertyChanged("HasAudioVisualBlockItems");
} }
} }
} }

View File

@@ -490,7 +490,7 @@ namespace Filtration.ViewModels
else else
{ {
var result = _messageBoxService.Show("Filtration", var result = _messageBoxService.Show("Filtration",
"Want to save your changes to this script?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); "Save script \"" + Filename + "\"?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
switch (result) switch (result)
{ {

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Windows; using System.Windows;
using System.Windows.Forms; using System.Windows.Forms;
@@ -33,6 +34,7 @@ namespace Filtration.ViewModels
{ {
RelayCommand OpenScriptCommand { get; } RelayCommand OpenScriptCommand { get; }
RelayCommand NewScriptCommand { get; } RelayCommand NewScriptCommand { get; }
bool CloseAllDocuments();
} }
internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel
@@ -49,8 +51,6 @@ namespace Filtration.ViewModels
private readonly IUpdateCheckService _updateCheckService; private readonly IUpdateCheckService _updateCheckService;
private readonly IUpdateAvailableViewModel _updateAvailableViewModel; private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
private readonly IMessageBoxService _messageBoxService; private readonly IMessageBoxService _messageBoxService;
private bool _activeDocumentIsScript;
private bool _activeDocumentIsTheme;
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository, public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
IItemFilterScriptTranslator itemFilterScriptTranslator, IItemFilterScriptTranslator itemFilterScriptTranslator,
@@ -75,51 +75,51 @@ namespace Filtration.ViewModels
_messageBoxService = messageBoxService; _messageBoxService = messageBoxService;
NewScriptCommand = new RelayCommand(OnNewScriptCommand); NewScriptCommand = new RelayCommand(OnNewScriptCommand);
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => _activeDocumentIsScript); CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand); OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
OpenThemeCommand = new RelayCommand(OnOpenThemeCommand); OpenThemeCommand = new RelayCommand(OnOpenThemeCommand);
SaveCommand = new RelayCommand(OnSaveDocumentCommand, ActiveDocumentIsEditable); SaveCommand = new RelayCommand(OnSaveDocumentCommand, ActiveDocumentIsEditable);
SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable); SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable);
CloseCommand = new RelayCommand(OnCloseDocumentCommand, () => AvalonDockWorkspaceViewModel.ActiveDocument != null); CloseCommand = new RelayCommand(OnCloseDocumentCommand, ActiveDocumentIsEditable);
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
PasteCommand = new RelayCommand(OnPasteCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => _activeDocumentIsScript); AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript);
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => _activeDocumentIsScript); AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript);
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock); DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, DisableBlockCommand = new RelayCommand(OnDisableBlockCommand,
() => _activeDocumentIsScript && ActiveScriptHasSelectedEnabledBlock); () => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock);
EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, EnableBlockCommand = new RelayCommand(OnEnableBlockCommand,
() => _activeDocumentIsScript && ActiveScriptHasSelectedDisabledBlock); () => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock);
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand); OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => _activeDocumentIsScript); ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript);
CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => _activeDocumentIsScript); CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript);
ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => _activeDocumentIsScript); ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => ActiveDocumentIsScript);
EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => _activeDocumentIsScript); EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript);
AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable); AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable); AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable); AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand,
() => () =>
ActiveDocumentIsTheme && _activeDocumentIsTheme && ActiveDocumentIsTheme && ActiveThemeIsEditable &&
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null); _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => _activeDocumentIsScript); ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => _activeDocumentIsScript); CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript);
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => _activeDocumentIsScript); ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript);
ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => _activeDocumentIsScript); ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript);
if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory())) if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory()))
{ {
@@ -154,7 +154,8 @@ namespace Filtration.ViewModels
ApplyThemeToScriptCommand.RaiseCanExecuteChanged(); ApplyThemeToScriptCommand.RaiseCanExecuteChanged();
EditMasterThemeCommand.RaiseCanExecuteChanged(); EditMasterThemeCommand.RaiseCanExecuteChanged();
CreateThemeCommand.RaiseCanExecuteChanged(); CreateThemeCommand.RaiseCanExecuteChanged();
SetActiveDocumentStatusProperties(); RaisePropertyChanged("ActiveDocumentIsScript");
RaisePropertyChanged("ActiveDocumentIsTheme");
RaisePropertyChanged("ShowAdvancedStatus"); RaisePropertyChanged("ShowAdvancedStatus");
break; break;
} }
@@ -171,8 +172,6 @@ namespace Filtration.ViewModels
} }
}); });
CheckForUpdates(); CheckForUpdates();
ActiveDocumentIsScript = false;
ActiveDocumentIsTheme = false;
} }
public RelayCommand OpenScriptCommand { get; private set; } public RelayCommand OpenScriptCommand { get; private set; }
@@ -219,11 +218,11 @@ namespace Filtration.ViewModels
public async void CheckForUpdates() public async void CheckForUpdates()
{ {
var assemblyVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location); var assemblyVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
var result = await _updateCheckService.GetUpdateData();
try try
{ {
var result = await _updateCheckService.GetUpdateData();
if (result.LatestVersionMajorPart >= assemblyVersion.FileMajorPart && if (result.LatestVersionMajorPart >= assemblyVersion.FileMajorPart &&
result.LatestVersionMinorPart > assemblyVersion.FileMinorPart) result.LatestVersionMinorPart > assemblyVersion.FileMinorPart)
{ {
@@ -280,30 +279,14 @@ namespace Filtration.ViewModels
} }
} }
private void SetActiveDocumentStatusProperties()
{
ActiveDocumentIsScript = AvalonDockWorkspaceViewModel.ActiveDocument is ItemFilterScriptViewModel;
ActiveDocumentIsTheme = AvalonDockWorkspaceViewModel.ActiveDocument is ThemeEditorViewModel;
}
public bool ActiveDocumentIsScript public bool ActiveDocumentIsScript
{ {
get { return _activeDocumentIsScript; } get { return _avalonDockWorkspaceViewModel.ActiveDocument != null && _avalonDockWorkspaceViewModel.ActiveDocument.IsScript; }
private set
{
_activeDocumentIsScript = value;
RaisePropertyChanged();
}
} }
public bool ActiveDocumentIsTheme public bool ActiveDocumentIsTheme
{ {
get { return _activeDocumentIsTheme; } get { return _avalonDockWorkspaceViewModel.ActiveDocument!= null && _avalonDockWorkspaceViewModel.ActiveDocument.IsTheme; }
private set
{
_activeDocumentIsTheme = value;
RaisePropertyChanged();
}
} }
public bool ActiveScriptHasSelectedBlock public bool ActiveScriptHasSelectedBlock
@@ -645,5 +628,22 @@ namespace Filtration.ViewModels
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.DeleteThemeComponentCommand.Execute( _avalonDockWorkspaceViewModel.ActiveThemeViewModel.DeleteThemeComponentCommand.Execute(
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent); _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent);
} }
public bool CloseAllDocuments()
{
var openDocuments = _avalonDockWorkspaceViewModel.OpenDocuments.OfType<IEditableDocument>().ToList();
foreach (var document in openDocuments)
{
var docCount = _avalonDockWorkspaceViewModel.OpenDocuments.OfType<IEditableDocument>().Count();
document.Close();
if (_avalonDockWorkspaceViewModel.OpenDocuments.OfType<IEditableDocument>().Count() == docCount)
{
return false;
}
}
return true;
}
} }
} }

View File

@@ -271,7 +271,9 @@
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<TextBlock Grid.Row="1" FontStyle="Italic" Visibility="{Binding HasAudioVisualBlockItems, Converter={StaticResource InverseBooleanVisibilityConverter}}">To change the appearance of this block, add a Text, Background or Border Block Item above.</TextBlock>
<!-- Block Items --> <!-- Block Items -->
<WrapPanel Grid.Row="1" MaxHeight="200"> <WrapPanel Grid.Row="1" MaxHeight="200">
<WrapPanel.Resources> <WrapPanel.Resources>

View File

@@ -10,7 +10,8 @@
xmlns:views="clr-namespace:Filtration.Views" 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="762" Width="1126" IsIconVisible="True" > Title="{Binding WindowTitle}" Height="762" Width="1126" IsIconVisible="True"
Closing="MainWindow_OnClosing">
<fluent:RibbonWindow.InputBindings> <fluent:RibbonWindow.InputBindings>
<KeyBinding Command="{Binding SaveCommand}" Modifiers="Control" Key="S" /> <KeyBinding Command="{Binding SaveCommand}" Modifiers="Control" Key="S" />
<KeyBinding Command="{Binding OpenScriptCommand}" Modifiers="Control" Key="O" /> <KeyBinding Command="{Binding OpenScriptCommand}" Modifiers="Control" Key="O" />

View File

@@ -1,4 +1,7 @@
using System.Windows; using System;
using System.ComponentModel;
using System.Windows;
using Filtration.Annotations;
using Filtration.ViewModels; using Filtration.ViewModels;
namespace Filtration.Views namespace Filtration.Views
@@ -10,8 +13,11 @@ namespace Filtration.Views
internal partial class MainWindow : IMainWindow internal partial class MainWindow : IMainWindow
{ {
private IMainWindowViewModel _mainWindowViewModel;
public MainWindow(IMainWindowViewModel mainWindowViewModel) public MainWindow(IMainWindowViewModel mainWindowViewModel)
{ {
_mainWindowViewModel = mainWindowViewModel;
InitializeComponent(); InitializeComponent();
DataContext = mainWindowViewModel; DataContext = mainWindowViewModel;
} }
@@ -31,5 +37,15 @@ namespace Filtration.Views
RibbonRoot.SelectedTabItem = ThemeToolsTabItem; RibbonRoot.SelectedTabItem = ThemeToolsTabItem;
} }
} }
private void MainWindow_OnClosing(object sender, CancelEventArgs e)
{
var allDocumentsClosed = _mainWindowViewModel.CloseAllDocuments();
if (!allDocumentsClosed)
{
e.Cancel = true;
}
}
} }
} }

View File

@@ -2,10 +2,10 @@
Filtration is an editor for Path of Exile item filter scripts. Filtration is an editor for Path of Exile item filter scripts.
## Current Release (Released 2015-07-06) ## Current Release (Released 2015-07-10)
<b>Installer (6.31mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.7/filtration_0.7_setup.exe">filtration_0.7_setup.exe</a> <b>Installer (6.31mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.8/filtration_0.8_setup.exe">filtration_0.8_setup.exe</a>
<b>Zip File (7.91mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.7/filtration_0.7.zip">filtration_0.7.zip</a> <b>Zip File (7.9mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.8/filtration_0.8.zip">filtration_0.8.zip</a>
## System Requirements ## System Requirements
Filtration requires .NET Framework 4.5.1 installed. Filtration requires .NET Framework 4.5.1 installed.