Changed versioning format, added grouping to theme browser, fixed styles

This commit is contained in:
Ben 2015-07-04 14:29:07 +01:00
parent 8b6207e334
commit 3a60a5005b
18 changed files with 193 additions and 37 deletions

View File

@ -5,17 +5,37 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:viewModels="clr-namespace:Filtration.ThemeEditor.ViewModels"
xmlns:views="clr-namespace:Filtration.ThemeEditor.Views"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:ThemeViewModel}"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<CollectionViewSource Source="{Binding Components}" x:Key="ComponentsViewSource">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="ComponentType" />
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<componentModel:SortDescription PropertyName="ComponentType" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</UserControl.Resources>
<Grid>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<ItemsControl ItemsSource="{Binding Components}" Margin="10">
<ItemsControl ItemsSource="{Binding Source={StaticResource ComponentsViewSource}}" Margin="10">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock FontWeight="Bold" FontSize="15" Text="{Binding Path=Name}"/>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ItemsControl.GroupStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<views:ThemeComponentControl DataContext="{Binding}" Margin="10,5,10,5" />

View File

@ -16,12 +16,15 @@
<setting name="ExtraLineBetweenBlocks" serializeAs="String">
<value>True</value>
</setting>
<setting name="SuppressUpdatesUpToVersion" serializeAs="String">
<setting name="SuppressUpdatesUpToVersionMajorPart" serializeAs="String">
<value>0</value>
</setting>
<setting name="SuppressUpdates" serializeAs="String">
<value>False</value>
</setting>
<setting name="SuppressUpdatesUpToVersionMinorPart" serializeAs="String">
<value>0</value>
</setting>
</Filtration.Properties.Settings>
</userSettings>
<runtime>

View File

@ -11,8 +11,25 @@
<ResourceDictionary Source="Views/Styles/CheckBox.xaml" />
<ResourceDictionary Source="Views/Styles/ListBoxItem.xaml" />
<ResourceDictionary Source="Views/Styles/TreeViewItem.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Sizes.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ComboBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.RadioButton.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Scrollbars.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
<ResourceDictionary Source="Views/CrossButton.xaml" />
<ResourceDictionary Source="Views/IconsDictionary.xaml" />
<ResourceDictionary>
<Style TargetType="ComboBox" BasedOn="{StaticResource MetroComboBox}" />
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource MetroComboBoxItem}" />
<Style TargetType="ScrollBar" BasedOn="{StaticResource MetroScrollBar}" />
<Style TargetType="TextBox" BasedOn="{StaticResource MetroTextBox}" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@ -9,6 +9,7 @@ namespace Filtration.Converters
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool) value ? Visibility.Visible : Visibility.Hidden;
if (value is bool && targetType == typeof (Visibility))
{
var val = (bool) value;

View File

@ -64,6 +64,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro">
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>..\packages\NLog.4.0.1\lib\net45\NLog.dll</HintPath>
</Reference>
@ -81,7 +84,7 @@
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Fluent.Ribbon.3.4.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
@ -259,6 +262,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Styles\TextBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Styles\TreeViewItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -9,7 +9,8 @@ namespace Filtration.Models
private string _releaseNotes;
public string DownloadUrl { get; set; }
public decimal CurrentVersion { get; set; }
public int LatestVersionMajorPart { get; set; }
public int LatestVersionMinorPart { get; set; }
public DateTime ReleaseDate { get; set; }
public string ReleaseNotes

View File

@ -50,12 +50,12 @@ namespace Filtration.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public decimal SuppressUpdatesUpToVersion {
public int SuppressUpdatesUpToVersionMajorPart {
get {
return ((decimal)(this["SuppressUpdatesUpToVersion"]));
return ((int)(this["SuppressUpdatesUpToVersionMajorPart"]));
}
set {
this["SuppressUpdatesUpToVersion"] = value;
this["SuppressUpdatesUpToVersionMajorPart"] = value;
}
}
@ -70,5 +70,17 @@ namespace Filtration.Properties {
this["SuppressUpdates"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int SuppressUpdatesUpToVersionMinorPart {
get {
return ((int)(this["SuppressUpdatesUpToVersionMinorPart"]));
}
set {
this["SuppressUpdatesUpToVersionMinorPart"] = value;
}
}
}
}

View File

@ -8,11 +8,14 @@
<Setting Name="ExtraLineBetweenBlocks" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="SuppressUpdatesUpToVersion" Type="System.Decimal" Scope="User">
<Setting Name="SuppressUpdatesUpToVersionMajorPart" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="SuppressUpdates" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="SuppressUpdatesUpToVersionMinorPart" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -1,5 +1,4 @@
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Filtration.Models;
@ -14,7 +13,8 @@ namespace Filtration.Services
internal class UpdateCheckService : IUpdateCheckService
{
private readonly IHTTPService _httpService;
private const string UpdateDataUrl = "http://ben-wallis.github.io/Filtration/filtration_version.xml";
//private const string UpdateDataUrl = "http://ben-wallis.github.io/Filtration/filtration_version.xml";
private const string UpdateDataUrl = "http://xvar.net/filtration_version.xml";
public UpdateCheckService(IHTTPService httpService)
{

View File

@ -41,7 +41,7 @@
<KeyBinding Key="Delete" Command="{Binding Path=DeleteItemCommand}" CommandParameter="{Binding ElementName=ControlListBox, Path=SelectedValue}" />
</ListBox.InputBindings>
</ListBox>
<toolkit:AutoCompleteBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding AutoCompleteItemsSource}" FilterMode="Contains" Text="{Binding AddItemText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" ></toolkit:AutoCompleteBox>
<toolkit:AutoCompleteBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding AutoCompleteItemsSource}" FilterMode="Contains" Text="{Binding AddItemText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
<Button Grid.Row="1" Grid.Column="1" Command="{Binding AddItemCommand}" IsDefault="True">Add</Button>
</Grid>
</UserControl>

View File

@ -107,7 +107,6 @@ namespace Filtration.ViewModels
}
private List<IToolViewModel> _tools;
private FiltrationViewModelBase _activeContent;
public IEnumerable<IToolViewModel> Tools
{

View File

@ -8,6 +8,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using Filtration.Common.ViewModels;
using Filtration.Interface;
using Filtration.Models;
using Filtration.ObjectModel.ThemeEditor;
using Filtration.Properties;
using Filtration.Repositories;
@ -177,23 +178,23 @@ namespace Filtration.ViewModels
public async void CheckForUpdates()
{
var assembly = Assembly.GetExecutingAssembly();
var assemblyVersion = FileVersionInfo.GetVersionInfo(assembly.Location);
var currentVersion = Convert.ToDecimal(assemblyVersion.FileMajorPart + CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator + assemblyVersion.FileMinorPart);
var assemblyVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
var result = await _updateCheckService.GetUpdateData();
try
{
if (result.CurrentVersion > currentVersion)
if (result.LatestVersionMajorPart >= assemblyVersion.FileMajorPart &&
result.LatestVersionMinorPart > assemblyVersion.FileMinorPart)
{
if (Settings.Default.SuppressUpdates == false ||
Settings.Default.SuppressUpdatesUpToVersion < result.CurrentVersion)
LatestVersionIsNewerThanSuppressedVersion(result))
{
Settings.Default.SuppressUpdates = false;
Settings.Default.Save();
var updateAvailableView = new UpdateAvailableView {DataContext = _updateAvailableViewModel};
_updateAvailableViewModel.Initialise(result, currentVersion);
_updateAvailableViewModel.Initialise(result, assemblyVersion.FileMajorPart,
assemblyVersion.FileMinorPart);
_updateAvailableViewModel.OnRequestClose += (s, e) => updateAvailableView.Close();
updateAvailableView.ShowDialog();
}
@ -210,6 +211,13 @@ namespace Filtration.ViewModels
}
}
private bool LatestVersionIsNewerThanSuppressedVersion(UpdateData updateData)
{
return Settings.Default.SuppressUpdatesUpToVersionMajorPart < updateData.LatestVersionMajorPart ||
(Settings.Default.SuppressUpdatesUpToVersionMajorPart <= updateData.LatestVersionMajorPart &&
Settings.Default.SuppressUpdatesUpToVersionMinorPart < updateData.LatestVersionMinorPart);
}
public ImageSource Icon { get; private set; }
public IAvalonDockWorkspaceViewModel AvalonDockWorkspaceViewModel

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Filtration.Models;
using Filtration.Properties;
using GalaSoft.MvvmLight.CommandWpf;
@ -14,9 +9,9 @@ namespace Filtration.ViewModels
internal interface IUpdateAvailableViewModel
{
event EventHandler OnRequestClose;
void Initialise(UpdateData updateData, decimal currentVersion);
decimal CurrentVersion { get; }
decimal NewVersion { get; }
void Initialise(UpdateData updateData, int currentVersionMajorPart, int currentVersionMinorPart);
string CurrentVersion { get; }
string NewVersion { get; }
string ReleaseNotes { get; }
DateTime ReleaseDate { get; }
}
@ -24,7 +19,8 @@ namespace Filtration.ViewModels
internal class UpdateAvailableViewModel : IUpdateAvailableViewModel
{
private UpdateData _updateData;
private decimal _currentVersion;
private int _currentVersionMajorPart;
private int _currentVersionMinorPart;
public UpdateAvailableViewModel()
{
@ -39,20 +35,21 @@ namespace Filtration.ViewModels
public RelayCommand AskLaterCommand { get; private set; }
public RelayCommand DownloadCommand { get; private set; }
public void Initialise(UpdateData updateData, decimal currentVersion)
public void Initialise(UpdateData updateData, int currentVersionMajorPart, int currentVersionMinorPart)
{
_currentVersion = currentVersion;
_currentVersionMajorPart = currentVersionMajorPart;
_currentVersionMinorPart = currentVersionMinorPart;
_updateData = updateData;
}
public decimal CurrentVersion
public string CurrentVersion
{
get { return _currentVersion; }
get { return _currentVersionMajorPart + "." + _currentVersionMinorPart; }
}
public decimal NewVersion
public string NewVersion
{
get { return _updateData.CurrentVersion; }
get { return _updateData.LatestVersionMajorPart + "." + _updateData.LatestVersionMinorPart; }
}
public string ReleaseNotes
@ -73,7 +70,8 @@ namespace Filtration.ViewModels
private void OnNeverAskAgainCommand()
{
Settings.Default.SuppressUpdates = true;
Settings.Default.SuppressUpdatesUpToVersion = _updateData.CurrentVersion;
Settings.Default.SuppressUpdatesUpToVersionMajorPart = _updateData.LatestVersionMajorPart;
Settings.Default.SuppressUpdatesUpToVersionMinorPart = _updateData.LatestVersionMinorPart;
Settings.Default.Save();
CloseWindow();
}

View File

@ -8,7 +8,7 @@
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="300">
<UserControl.Resources>
<Style TargetType="{x:Type TextBox}">
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MetroTextBox}">
<Style.Setters>
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />

View File

@ -57,9 +57,9 @@
Background="ForestGreen"
BorderBrush="ForestGreen"
x:Name="ScriptToolsGroup"
Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverterCopy}, ConverterParameter={x:Static Visibility.Hidden}, Mode=OneWay}" />
Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverterCopy}, Mode=OneWay}" />
</fluent:Ribbon.ContextualGroups>
<fluent:RibbonTabItem Header="Script Tools" ><!--Group="{Binding ElementName=ScriptToolsGroup}"-->
<fluent:RibbonTabItem Header="Script Tools" Group="{Binding ElementName=ScriptToolsGroup}">
<fluent:RibbonGroupBox Header="Clipboard">
<fluent:Button Header="Copy Block" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" LargeIcon="{StaticResource CopyIcon}">
</fluent:Button>

View File

@ -26,4 +26,6 @@
<SolidColorBrush x:Key="GrayBrush9" Color="{StaticResource Gray9}"/>
<SolidColorBrush x:Key="GrayBrush10" Color="{StaticResource Gray10}"/>
<SolidColorBrush x:Key="HighlightGrayBrush" Color="{StaticResource HighlightGray}" />
<SolidColorBrush x:Key="TextBoxBackground" Color="#333337" />
<SolidColorBrush x:Key="TextBoxBackgroundSelected" Color="#3F3F46" />
</ResourceDictionary>

View File

@ -0,0 +1,84 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="TextBox">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="{StaticResource GrayBrush1}" />
<Setter Property="CaretBrush" Value="{StaticResource GrayBrush1}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border BorderBrush="{StaticResource GrayBrush1}" BorderThickness="1">
<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ScrollViewer x:Name="PART_ContentHost" Margin="1" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{StaticResource GrayBrush7}" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--<Style TargetType="TextBox"
x:Key="SearchTextBox">
<Setter Property="Background"
Value="{StaticResource TextBoxBackground}" />
<Setter Property="Foreground"
Value="{StaticResource Foreground}" />
<Setter Property="CaretBrush"
Value="{StaticResource Foreground}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid Background="{TemplateBinding Background}"
SnapsToDevicePixels="true">
<TextBlock Foreground="{StaticResource SearchTextForeground}"
Margin="5,0,0,0"
VerticalAlignment="Center"
Name="search"
Text="Search ..."
Visibility="Hidden" />
<ScrollViewer x:Name="PART_ContentHost"
Margin="1" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="TextBox.Text"
Value="">
<Setter TargetName="search"
Property="Visibility"
Value="Visible" />
</Trigger>
<Trigger Property="TextBox.Text"
Value="{x:Null}">
<Setter TargetName="search"
Property="Visibility"
Value="Visible" />
</Trigger>
<Trigger Property="IsMouseOver"
Value="true">
<Setter Property="Background"
Value="{StaticResource TextBoxBackgroundSelected}" />
<Setter TargetName="search"
Property="Foreground"
Value="{StaticResource GrayBrush6}" />
</Trigger>
<Trigger Property="IsFocused"
Value="true">
<Setter Property="Background"
Value="{StaticResource TextBoxBackgroundSelected}" />
<Setter TargetName="search"
Property="Visibility"
Value="Hidden" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>-->
</ResourceDictionary>

View File

@ -6,6 +6,7 @@
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
<package id="Extended.Wpf.Toolkit" version="2.4" targetFramework="net451" />
<package id="Fluent.Ribbon" version="3.4.0" targetFramework="net451" />
<package id="MahApps.Metro" version="1.1.2.0" targetFramework="net451" />
<package id="MvvmLightLibs" version="5.1.1.0" targetFramework="net451" />
<package id="NLog" version="4.0.1" targetFramework="net451" />
<package id="NLog.Config" version="4.0.1" targetFramework="net451" />