mirror of
https://github.com/DarthAffe/Arge.git
synced 2022-11-28 19:26:16 +00:00
Added main window
This commit is contained in:
1 parent
a688a343e9
commit
a9f7cbd61c
37 files changed
+1057
-106
No files matched your search
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{30BAC2D7-4FB2-4464-A573-00DC9F211AFE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Arge.API.Skin</RootNamespace>
|
||||
<AssemblyName>Arge.API.Skin</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Resources\CachedResourceDictionary.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,2 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=resources/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Arge.API.Skin")]
|
||||
[assembly: AssemblyDescription("Skin-API of Arge")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Wyrez")]
|
||||
[assembly: AssemblyProduct("Arge.API.Skin")]
|
||||
[assembly: AssemblyCopyright("Copyright © Wyrez 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("30bac2d7-4fb2-4464-a573-00dc9f211afe")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arge", "Arge\Arge.csproj",
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "API", "API", "{D786947A-A8D7-485E-9726-839655841958}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arge.API.Skin", "Arge.API.Skin\Arge.API.Skin.csproj", "{30BAC2D7-4FB2-4464-A573-00DC9F211AFE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -19,15 +17,8 @@ Global
|
||||
{4509B24A-6B26-41B0-8B62-1C4201317692}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4509B24A-6B26-41B0-8B62-1C4201317692}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4509B24A-6B26-41B0-8B62-1C4201317692}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{30BAC2D7-4FB2-4464-A573-00DC9F211AFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{30BAC2D7-4FB2-4464-A573-00DC9F211AFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{30BAC2D7-4FB2-4464-A573-00DC9F211AFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{30BAC2D7-4FB2-4464-A573-00DC9F211AFE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{30BAC2D7-4FB2-4464-A573-00DC9F211AFE} = {D786947A-A8D7-485E-9726-839655841958}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+3
-2
@@ -1,14 +1,15 @@
|
||||
<Application x:Class="Arge.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:arge="clr-namespace:Arge"
|
||||
xmlns:bootstrapper="clr-namespace:Arge.Bootstrapper">
|
||||
xmlns:bootstrapper="clr-namespace:Arge.Bootstrapper"
|
||||
xmlns:resources="clr-namespace:Arge.Resources">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary>
|
||||
<bootstrapper:ArgeBootstrapper x:Key="Bootstrapper" />
|
||||
</ResourceDictionary>
|
||||
<resources:CachedResourceDictionary Source="/Arge;component/Resources/Arge.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
+68
-2
@@ -32,6 +32,9 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\ArgeBee.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Caliburn.Micro, Version=3.0.3.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.0.3\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
@@ -54,6 +57,9 @@
|
||||
<Reference Include="Microsoft.Practices.Unity.RegistrationByConvention, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RGB.NET.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Core.1.0.0\lib\net45\RGB.NET.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Data" />
|
||||
@@ -85,8 +91,21 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Attributes\FileNameAttribute.cs" />
|
||||
<Compile Include="Bootstrapper\ArgeWindowManager.cs" />
|
||||
<Compile Include="Bootstrapper\UnityBootstrapper.cs" />
|
||||
<Compile Include="ViewModels\AbstractViewModel.cs" />
|
||||
<Compile Include="Configuration\Config.cs" />
|
||||
<Compile Include="Configuration\ConfigEntryType.cs" />
|
||||
<Compile Include="Controls\BlurredDecorationWindow.cs" />
|
||||
<Compile Include="Controls\ImageButton.cs" />
|
||||
<Compile Include="Extensions\EnumExtension.cs" />
|
||||
<Compile Include="Misc\ActionCommand.cs" />
|
||||
<Compile Include="Misc\BindingProxy.cs" />
|
||||
<Compile Include="Resources\CachedResourceDictionary.cs" />
|
||||
<Compile Include="Resources\ImageSources.cs" />
|
||||
<Compile Include="Themes\Theme.cs" />
|
||||
<Compile Include="Themes\ThemeManager.cs" />
|
||||
<Compile Include="Misc\AbstractBindable.cs" />
|
||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||
<Compile Include="Views\ShellView.xaml.cs">
|
||||
<DependentUpon>ShellView.xaml</DependentUpon>
|
||||
@@ -120,12 +139,59 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="AttachedProperties\" />
|
||||
<Folder Include="Enums\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Converter\Converter.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Resources\Arge.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\BlurredDecorationWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\FrameworkElement.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\ImageButton.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\ToolTip.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<None Include="Themes\Default\Theme.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Page Include="Views\ShellView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ArgeBee.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Themes\Default\background.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Themes\Default\close.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Themes\Default\minimize.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace Arge.Attributes
|
||||
{
|
||||
public class FileNameAttribute : Attribute
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public string FileName { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public FileNameAttribute(string fileName)
|
||||
{
|
||||
this.FileName = fileName;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using Arge.Configuration;
|
||||
using Arge.Themes;
|
||||
using Arge.ViewModels;
|
||||
using Caliburn.Micro;
|
||||
using Microsoft.Practices.Unity;
|
||||
|
||||
namespace Arge.Bootstrapper
|
||||
{
|
||||
@@ -10,14 +14,19 @@ namespace Arge.Bootstrapper
|
||||
|
||||
protected override void RegisterTypes()
|
||||
{
|
||||
RegisterInterface<IWindowManager, ArgeWindowManager>();
|
||||
|
||||
RegisterSingleton<ThemeManager>();
|
||||
}
|
||||
|
||||
protected override void OnStartup(object sender, StartupEventArgs e)
|
||||
{
|
||||
Config.Instance.Load();
|
||||
Container.Resolve<ThemeManager>().LoadTheme(Config.Instance[ConfigEntryType.Theme]);
|
||||
|
||||
Dictionary<string, object> settings = new Dictionary<string, object>
|
||||
{
|
||||
{ "Title", "Arge" },
|
||||
{ "SizeToContent", SizeToContent.Manual },
|
||||
{ "Width" , 1280 },
|
||||
{ "Height" , 720 }
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Arge.Controls;
|
||||
using Arge.Misc;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Arge.Bootstrapper
|
||||
{
|
||||
public class ArgeWindowManager : WindowManager
|
||||
{
|
||||
#region Methods
|
||||
|
||||
protected override Window EnsureWindow(object model, object view, bool isDialog)
|
||||
{
|
||||
Window window = view as Window;
|
||||
if (window == null)
|
||||
{
|
||||
window = new BlurredDecorationWindow()
|
||||
{
|
||||
Content = view,
|
||||
SizeToContent = SizeToContent.Manual,
|
||||
Icon = new BitmapImage(new Uri("pack://application:,,,/Arge;component/Resources/ArgeBee.ico")),
|
||||
IconCommand = new ActionCommand(() => Process.Start("http://arge.be"))
|
||||
};
|
||||
window.SetValue(View.IsGeneratedProperty, true);
|
||||
Window owner = InferOwnerOf(window);
|
||||
if (owner != null)
|
||||
{
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
window.Owner = owner;
|
||||
}
|
||||
else
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
Window owner = InferOwnerOf(window);
|
||||
if ((owner != null) && isDialog)
|
||||
window.Owner = owner;
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,9 @@ namespace Arge.Bootstrapper
|
||||
{
|
||||
Container = new UnityContainer();
|
||||
RegisterSingleton(Container);
|
||||
RegisterInterface<IWindowManager, WindowManager>();
|
||||
RegisterInterface<IEventAggregator, EventAggregator>();
|
||||
|
||||
RegisterTypes();
|
||||
}
|
||||
|
||||
protected abstract void RegisterTypes();
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Arge.Extensions;
|
||||
|
||||
namespace Arge.Configuration
|
||||
{
|
||||
public class Config : Dictionary<ConfigEntryType, string>
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const string DEFAULT_FILE = "arge.config";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public static Config _instance;
|
||||
public static Config Instance => _instance ?? (_instance = new Config());
|
||||
|
||||
private string _currentFile;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
private Config()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
foreach (ConfigEntryType configEntryType in Enum.GetValues(typeof(ConfigEntryType)))
|
||||
this[configEntryType] = configEntryType.GetAttributeOfType<DefaultValueAttribute>()?.Value as string;
|
||||
}
|
||||
|
||||
public void Load(string file = null)
|
||||
{
|
||||
file = file ?? _currentFile ?? DEFAULT_FILE;
|
||||
if (string.IsNullOrWhiteSpace(file)) return;
|
||||
|
||||
Initialize();
|
||||
|
||||
//TODO DarthAffe 14.05.2017: Load Config
|
||||
|
||||
_currentFile = file;
|
||||
}
|
||||
|
||||
public void Save(string file = null)
|
||||
{
|
||||
file = file ?? _currentFile ?? DEFAULT_FILE;
|
||||
if (string.IsNullOrWhiteSpace(file)) return;
|
||||
|
||||
//TODO DarthAffe 14.05.2017: Save Config
|
||||
|
||||
_currentFile = file;
|
||||
}
|
||||
|
||||
public string GetEntry(ConfigEntryType entry)
|
||||
{
|
||||
return this[entry];
|
||||
}
|
||||
|
||||
public T GetEntry<T>(ConfigEntryType entry)
|
||||
{
|
||||
return (T)Convert.ChangeType(GetEntry(entry), typeof(T));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Arge.Configuration
|
||||
{
|
||||
public enum ConfigEntryType
|
||||
{
|
||||
[DefaultValue("Default")]
|
||||
Theme,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Arge.Controls
|
||||
{
|
||||
[TemplatePart(Name = "PART_Decoration", Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = "PART_Content", Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = "PART_CloseButton", Type = typeof(Button))]
|
||||
[TemplatePart(Name = "PART_MinimizeButton", Type = typeof(Button))]
|
||||
[TemplatePart(Name = "PART_IconButton", Type = typeof(Button))]
|
||||
public class BlurredDecorationWindow : Window
|
||||
{
|
||||
#region DependencyProperties
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public static readonly DependencyProperty BackgroundImageProperty = DependencyProperty.Register(
|
||||
"BackgroundImage", typeof(ImageSource), typeof(BlurredDecorationWindow), new PropertyMetadata(default(ImageSource)));
|
||||
|
||||
public ImageSource BackgroundImage
|
||||
{
|
||||
get => (ImageSource)GetValue(BackgroundImageProperty);
|
||||
set => SetValue(BackgroundImageProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DecorationHeightProperty = DependencyProperty.Register(
|
||||
"DecorationHeight", typeof(double), typeof(BlurredDecorationWindow), new PropertyMetadata(20.0));
|
||||
|
||||
public double DecorationHeight
|
||||
{
|
||||
get => (double)GetValue(DecorationHeightProperty);
|
||||
set => SetValue(DecorationHeightProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IconToolTipProperty = DependencyProperty.Register(
|
||||
"IconToolTip", typeof(string), typeof(BlurredDecorationWindow), new PropertyMetadata(default(string)));
|
||||
|
||||
public string IconToolTip
|
||||
{
|
||||
get => (string)GetValue(IconToolTipProperty);
|
||||
set => SetValue(IconToolTipProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IconCommandProperty = DependencyProperty.Register(
|
||||
"IconCommand", typeof(ICommand), typeof(BlurredDecorationWindow), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
public ICommand IconCommand
|
||||
{
|
||||
get => (ICommand)GetValue(IconCommandProperty);
|
||||
set => SetValue(IconCommandProperty, value);
|
||||
}
|
||||
|
||||
// ReSharper restore InconsistentNaming
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
static BlurredDecorationWindow()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(BlurredDecorationWindow), new FrameworkPropertyMetadata(typeof(BlurredDecorationWindow)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
FrameworkElement decoration = GetTemplateChild("PART_Decoration") as FrameworkElement;
|
||||
if (decoration != null)
|
||||
decoration.MouseLeftButtonDown += (sender, args) => DragMove();
|
||||
|
||||
Button closeButton = GetTemplateChild("PART_CloseButton") as Button;
|
||||
if (closeButton != null)
|
||||
closeButton.Click += (sender, args) => Application.Current.Shutdown();
|
||||
|
||||
Button minimizeButton = GetTemplateChild("PART_MinimizeButton") as Button;
|
||||
if (minimizeButton != null)
|
||||
minimizeButton.Click += (sender, args) => Application.Current.MainWindow.WindowState = WindowState.Minimized;
|
||||
|
||||
Button iconButton = GetTemplateChild("PART_IconButton") as Button;
|
||||
if (iconButton != null)
|
||||
iconButton.Click += (sender, args) => IconCommand?.Execute(null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Arge.Controls
|
||||
{
|
||||
public class ImageButton : Button
|
||||
{
|
||||
#region Properties & Fields
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public static readonly DependencyProperty ImageProperty = DependencyProperty.Register(
|
||||
"Image", typeof(ImageSource), typeof(ImageButton), new PropertyMetadata(default(ImageSource)));
|
||||
|
||||
public ImageSource Image
|
||||
{
|
||||
get => (ImageSource)GetValue(ImageProperty);
|
||||
set => SetValue(ImageProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HoverImageProperty = DependencyProperty.Register(
|
||||
"HoverImage", typeof(ImageSource), typeof(ImageButton), new PropertyMetadata(default(ImageSource)));
|
||||
|
||||
public ImageSource HoverImage
|
||||
{
|
||||
get => (ImageSource)GetValue(HoverImageProperty);
|
||||
set => SetValue(HoverImageProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PressedImageProperty = DependencyProperty.Register(
|
||||
"PressedImage", typeof(ImageSource), typeof(ImageButton), new PropertyMetadata(default(ImageSource)));
|
||||
|
||||
public ImageSource PressedImage
|
||||
{
|
||||
get => (ImageSource)GetValue(PressedImageProperty);
|
||||
set => SetValue(PressedImageProperty, value);
|
||||
}
|
||||
|
||||
// ReSharper restore InconsistentNaming
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
static ImageButton()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton), new FrameworkPropertyMetadata(typeof(ImageButton)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<resources:CachedResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:resources="clr-namespace:Arge.Resources">
|
||||
|
||||
</resources:CachedResourceDictionary>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Arge.Extensions
|
||||
{
|
||||
public static class EnumExtension
|
||||
{
|
||||
#region Methods
|
||||
|
||||
public static T GetAttributeOfType<T>(this Enum enumVal) where T : Attribute
|
||||
{
|
||||
MemberInfo[] mi = enumVal.GetType().GetMember(enumVal.ToString());
|
||||
return (T)mi[0].GetCustomAttributes(typeof(T), true).FirstOrDefault();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Arge.ViewModels
|
||||
namespace Arge.Misc
|
||||
{
|
||||
public abstract class AbstractViewModel : PropertyChangedBase
|
||||
public abstract class AbstractBindable : PropertyChangedBase
|
||||
{
|
||||
#region Method
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Arge.Misc
|
||||
{
|
||||
public class ActionCommand : ICommand
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly Func<bool> _canExecute;
|
||||
private readonly Action _command;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ActionCommand(Action command, Func<bool> canExecute = null)
|
||||
{
|
||||
this._command = command;
|
||||
this._canExecute = canExecute;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return _canExecute?.Invoke() ?? true;
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_command?.Invoke();
|
||||
}
|
||||
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Arge.Misc
|
||||
{
|
||||
public class BindingProxy : Freezable
|
||||
{
|
||||
#region Properties & Fields
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public static readonly DependencyProperty DataProperty = DependencyProperty.Register(
|
||||
"Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));
|
||||
|
||||
public object Data
|
||||
{
|
||||
get => GetValue(DataProperty);
|
||||
set => SetValue(DataProperty, value);
|
||||
}
|
||||
|
||||
// ReSharper restore InconsistentNaming
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override Freezable CreateInstanceCore() => new BindingProxy();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<resources:CachedResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:resources="clr-namespace:Arge.Resources"
|
||||
xmlns:controls="clr-namespace:Arge.Controls">
|
||||
|
||||
<resources:CachedResourceDictionary.MergedDictionaries>
|
||||
<resources:CachedResourceDictionary Source="/Arge;component/Styles/BlurredDecorationWindow.xaml" />
|
||||
<resources:CachedResourceDictionary Source="/Arge;component/Styles/ImageButton.xaml" />
|
||||
<resources:CachedResourceDictionary Source="/Arge;component/Styles/ToolTip.xaml" />
|
||||
</resources:CachedResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="{x:Type controls:BlurredDecorationWindow}" BasedOn="{StaticResource StyleBlurredDecorationWindow}" />
|
||||
<Style TargetType="{x:Type controls:ImageButton}" BasedOn="{StaticResource StyleImageButton}" />
|
||||
<Style TargetType="ToolTip" BasedOn="{StaticResource StyleToolTip}" />
|
||||
|
||||
</resources:CachedResourceDictionary>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
+1
-1
@@ -3,7 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace Arge.API.Skin
|
||||
namespace Arge.Resources
|
||||
{
|
||||
public class CachedResourceDictionary : ResourceDictionary
|
||||
{
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Media;
|
||||
using Arge.Attributes;
|
||||
using Arge.Misc;
|
||||
|
||||
namespace Arge.Resources
|
||||
{
|
||||
public class ImageSources : AbstractBindable
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private static ImageSources _instace;
|
||||
public static ImageSources Instance => _instace ?? (_instace = new ImageSources());
|
||||
|
||||
private readonly ImageSourceConverter _imageSourceConverter = new ImageSourceConverter();
|
||||
|
||||
[FileName("background")]
|
||||
public ImageSource WindowBackground { get; private set; }
|
||||
|
||||
[FileName("close")]
|
||||
public ImageSource WindowClose { get; private set; }
|
||||
|
||||
[FileName("minimize")]
|
||||
public ImageSource WindowMinimize { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
private ImageSources()
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Update(string baseDirectory)
|
||||
{
|
||||
string[] files = Directory.GetFiles(baseDirectory);
|
||||
|
||||
foreach (PropertyInfo propertyInfo in typeof(ImageSources).GetProperties())
|
||||
{
|
||||
string fileName = propertyInfo.GetCustomAttribute<FileNameAttribute>()?.FileName;
|
||||
if (string.IsNullOrWhiteSpace(fileName)) continue;
|
||||
|
||||
propertyInfo.SetValue(this, ConvertToImageSource(files.FirstOrDefault(x => string.Equals(Path.GetFileNameWithoutExtension(x), fileName, StringComparison.OrdinalIgnoreCase))));
|
||||
NotifyOfPropertyChange(propertyInfo.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private ImageSource ConvertToImageSource(string path)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(path) ? null : _imageSourceConverter.ConvertFromString(path) as ImageSource;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<resources:CachedResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Arge.Controls"
|
||||
xmlns:resources="clr-namespace:Arge.Resources">
|
||||
|
||||
<resources:CachedResourceDictionary.MergedDictionaries>
|
||||
<resources:CachedResourceDictionary Source="/Arge;component/Styles/ImageButton.xaml" />
|
||||
<resources:CachedResourceDictionary Source="/Arge;component/Converter/Converter.xaml" />
|
||||
</resources:CachedResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="StyleImageButtonWindow"
|
||||
BasedOn="{StaticResource StyleImageButtonWithOpacity}"
|
||||
TargetType="{x:Type controls:ImageButton}">
|
||||
<Setter Property="Padding" Value="4" />
|
||||
<Setter Property="Margin" Value="4" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="Width" Value="24" />
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="StyleBlurredDecorationWindow"
|
||||
TargetType="{x:Type controls:BlurredDecorationWindow}">
|
||||
<Setter Property="WindowStyle" Value="None" />
|
||||
<Setter Property="ResizeMode" Value="CanResize" />
|
||||
<Setter Property="AllowsTransparency" Value="True" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="BorderThickness" Value="1,0,1,1" />
|
||||
<Setter Property="DecorationHeight" Value="80" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BrushWindowBorder}" />
|
||||
<Setter Property="Background" Value="{DynamicResource BrushWindowBackground}" />
|
||||
<Setter Property="BackgroundImage" Value="{Binding Source={x:Static resources:ImageSources.Instance}, Path=WindowBackground}" />
|
||||
<Setter Property="ToolTip" Value="http://arge.be" />
|
||||
<Setter Property="MinWidth" Value="256" />
|
||||
<Setter Property="MinHeight" Value="144" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
|
||||
<Setter Property="WindowChrome.WindowChrome">
|
||||
<Setter.Value>
|
||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="5" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:BlurredDecorationWindow}">
|
||||
<Grid Background="{TemplateBinding Background}">
|
||||
<Grid Margin="-12,-12,-12,0">
|
||||
<Viewbox HorizontalAlignment="Center" Stretch="UniformToFill">
|
||||
<Image Source="{TemplateBinding BackgroundImage}" />
|
||||
</Viewbox>
|
||||
|
||||
<Border Name="BlurImage">
|
||||
<Border.OpacityMask>
|
||||
<VisualBrush TileMode="None" Stretch="None" AlignmentX="Center" AlignmentY="Center">
|
||||
<VisualBrush.Visual>
|
||||
<Grid Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=Border}}"
|
||||
Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=Border}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="12" />
|
||||
<RowDefinition Height="92" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle Fill="Black" Grid.Row="0" Grid.RowSpan="2" />
|
||||
<Rectangle Fill="Transparent" Grid.Row="2" />
|
||||
</Grid>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Border.OpacityMask>
|
||||
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="30" />
|
||||
</Border.Effect>
|
||||
|
||||
<Viewbox HorizontalAlignment="Center" Stretch="UniformToFill">
|
||||
<Image Source="{TemplateBinding BackgroundImage}" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<DockPanel LastChildFill="True">
|
||||
<Border x:Name="PART_Decoration"
|
||||
DockPanel.Dock="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="{TemplateBinding DecorationHeight}"
|
||||
Background="{TemplateBinding BorderBrush}">
|
||||
<DockPanel HorizontalAlignment="Stretch" Margin="4" LastChildFill="False">
|
||||
<controls:ImageButton x:Name="PART_CloseButton"
|
||||
DockPanel.Dock="Right"
|
||||
Style="{StaticResource StyleImageButtonWindow}"
|
||||
Image="{Binding Source={x:Static resources:ImageSources.Instance}, Path=WindowClose}"
|
||||
ToolTip="Close" />
|
||||
|
||||
<controls:ImageButton x:Name="PART_MinimizeButton"
|
||||
DockPanel.Dock="Right"
|
||||
Style="{StaticResource StyleImageButtonWindow}"
|
||||
Image="{Binding Source={x:Static resources:ImageSources.Instance}, Path=WindowMinimize}"
|
||||
ToolTip="Minimize" />
|
||||
|
||||
<controls:ImageButton x:Name="PART_IconButton"
|
||||
DockPanel.Dock="Left"
|
||||
VerticalAlignment="Center"
|
||||
Margin="8"
|
||||
Style="{StaticResource StyleImageButtonWithOpacity}"
|
||||
Image="{TemplateBinding Icon}"
|
||||
ToolTip="{TemplateBinding ToolTip}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
<ContentPresenter x:Name="PART_Content" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</resources:CachedResourceDictionary>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<resources:CachedResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:resources="clr-namespace:Arge.Resources">
|
||||
|
||||
<Style x:Key="StyleFrameworkElement" TargetType="FrameworkElement">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="UseLayoutRounding" Value="True" />
|
||||
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
|
||||
</Style>
|
||||
|
||||
</resources:CachedResourceDictionary>
|
||||
@@ -0,0 +1,110 @@
|
||||
<resources:CachedResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Arge.Controls"
|
||||
xmlns:resources="clr-namespace:Arge.Resources">
|
||||
|
||||
<Style x:Key="StyleImageButton"
|
||||
TargetType="{x:Type controls:ImageButton}">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:ImageButton}">
|
||||
<Grid Background="Transparent">
|
||||
<Image x:Name="ImageNormal" Margin="{TemplateBinding Padding}"
|
||||
Source="{TemplateBinding Image}" Stretch="Uniform" />
|
||||
<Image x:Name="ImageHover" Margin="{TemplateBinding Padding}"
|
||||
Opacity="0"
|
||||
Source="{TemplateBinding HoverImage}" Stretch="Uniform" />
|
||||
<Image x:Name="ImagePressed" Margin="{TemplateBinding Padding}"
|
||||
Opacity="0"
|
||||
Source="{TemplateBinding PressedImage}" Stretch="Uniform" />
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ImageHover">
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.150" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ImageHover">
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.250" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ImagePressed">
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.150" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ImagePressed">
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.250" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style x:Key="StyleImageButtonWithOpacity"
|
||||
TargetType="{x:Type controls:ImageButton}">
|
||||
<Setter Property="Opacity" Value="0.66" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:ImageButton}">
|
||||
<Grid Background="Transparent">
|
||||
<Image x:Name="ImageNormal" Margin="{TemplateBinding Padding}"
|
||||
Source="{TemplateBinding Image}" Stretch="Uniform" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.150" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.250" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="StyleImageButtonMenu"
|
||||
BasedOn="{StaticResource StyleImageButton}"
|
||||
TargetType="{x:Type controls:ImageButton}">
|
||||
<Setter Property="Width" Value="180" />
|
||||
<Setter Property="Height" Value="90" />
|
||||
<Setter Property="Margin" Value="0,16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
</resources:CachedResourceDictionary>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<resources:CachedResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:resources="clr-namespace:Arge.Resources">
|
||||
|
||||
<Style x:Key="StyleToolTip" TargetType="ToolTip">
|
||||
<Style.Setters>
|
||||
<Setter Property="Foreground" Value="{DynamicResource BrushTooltipForeground}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToolTip">
|
||||
<Border BorderThickness="1"
|
||||
BorderBrush="{DynamicResource BrushTooltipBorder}"
|
||||
Background="{DynamicResource BrushTooltipBackground}">
|
||||
<ContentPresenter Margin="6,4" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
</resources:CachedResourceDictionary>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:presentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options">
|
||||
|
||||
<!-- ### Colors ### -->
|
||||
<Color x:Key="ColorTelegrey">#FFD0D0D0</Color>
|
||||
<Color x:Key="ColorJetBlack">#111111</Color>
|
||||
<Color x:Key="ColorJetBlackTransparent">#A0111111</Color>
|
||||
<Color x:Key="ColorBlackTransparent">#50000000</Color>
|
||||
|
||||
<!-- ### Brushes ### -->
|
||||
<SolidColorBrush x:Key="BrushBackground" presentationOptions:Freeze="True" Color="{StaticResource ColorJetBlack}" />
|
||||
|
||||
<!-- Window -->
|
||||
<SolidColorBrush x:Key="BrushWindowBorder" presentationOptions:Freeze="True" Color="{StaticResource ColorBlackTransparent}" />
|
||||
<SolidColorBrush x:Key="BrushWindowBackground" presentationOptions:Freeze="True" Color="{StaticResource ColorJetBlack}" />
|
||||
|
||||
<!-- ToolTip -->
|
||||
<SolidColorBrush x:Key="BrushTooltipForeground" presentationOptions:Freeze="True" Color="{StaticResource ColorTelegrey}" />
|
||||
<SolidColorBrush x:Key="BrushTooltipBorder" presentationOptions:Freeze="True" Color="{StaticResource ColorJetBlack}" />
|
||||
<SolidColorBrush x:Key="BrushTooltipBackground" presentationOptions:Freeze="True" Color="{StaticResource ColorJetBlackTransparent}" />
|
||||
|
||||
</ResourceDictionary>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 273 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,24 @@
|
||||
using Arge.Misc;
|
||||
|
||||
namespace Arge.Themes
|
||||
{
|
||||
public class Theme : AbstractBindable
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public string Name { get; }
|
||||
public string Path { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public Theme(string name, string path)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Path = path;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
using Arge.Resources;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Arge.Themes
|
||||
{
|
||||
public class ThemeManager
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const string THEME_FOLDER = "Themes";
|
||||
private const string THEME_FILE = "Theme.xaml";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private List<Theme> _availableThemes;
|
||||
public IEnumerable<Theme> AvailableThemes => _availableThemes;
|
||||
|
||||
public Theme CurrentTheme { get; private set; }
|
||||
|
||||
public string CurrentThemeFolder => CurrentTheme == null ? null : Path.Combine(PathHelper.GetAbsolutePath(THEME_FOLDER), CurrentTheme.Name);
|
||||
|
||||
private ResourceDictionary _currentlyLoadedDictionary;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ThemeManager()
|
||||
{
|
||||
CheckAvailableThemes();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void LoadTheme(string name)
|
||||
{
|
||||
Theme theme = AvailableThemes.First(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
LoadTheme(theme);
|
||||
}
|
||||
|
||||
public void LoadTheme(Theme theme)
|
||||
{
|
||||
if (theme == null) return;
|
||||
|
||||
ResourceDictionary themeDictionary;
|
||||
using (FileStream fs = new FileStream(theme.Path, FileMode.Open))
|
||||
themeDictionary = (ResourceDictionary)XamlReader.Load(fs);
|
||||
|
||||
if (themeDictionary == null) return;
|
||||
|
||||
if (_currentlyLoadedDictionary != null)
|
||||
Application.Current.Resources.MergedDictionaries.Remove(_currentlyLoadedDictionary);
|
||||
|
||||
Application.Current.Resources.MergedDictionaries.Add(themeDictionary);
|
||||
_currentlyLoadedDictionary = themeDictionary;
|
||||
|
||||
CurrentTheme = theme;
|
||||
|
||||
ImageSources.Instance.Update(CurrentThemeFolder);
|
||||
}
|
||||
|
||||
public void CheckAvailableThemes()
|
||||
{
|
||||
_availableThemes = Directory.GetDirectories(PathHelper.GetAbsolutePath(THEME_FOLDER))
|
||||
.Select(x => new Theme(Path.GetFileName(x), Path.Combine(x, THEME_FILE)))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
namespace Arge.ViewModels
|
||||
using Arge.Misc;
|
||||
|
||||
namespace Arge.ViewModels
|
||||
{
|
||||
public class ShellViewModel : AbstractViewModel
|
||||
public class ShellViewModel : AbstractBindable
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -3,5 +3,6 @@
|
||||
<package id="Caliburn.Micro" version="3.0.3" targetFramework="net45" />
|
||||
<package id="Caliburn.Micro.Core" version="3.0.3" targetFramework="net45" />
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net45" />
|
||||
<package id="RGB.NET.Core" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Unity" version="4.0.1" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="174.60173mm"
|
||||
height="145.82661mm"
|
||||
viewBox="0 0 174.60173 145.82661"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.1 r15371"
|
||||
sodipodi:docname="ArgeBee.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.7"
|
||||
inkscape:cx="356.59892"
|
||||
inkscape:cy="223.06953"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1028"
|
||||
inkscape:window-x="3832"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-29.966074,-60.259014)">
|
||||
<path
|
||||
style="fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.29474944"
|
||||
d="m 201.52121,150.06857 a 29.600101,32.13916 0 0 1 -29.6001,32.13916 29.600101,32.13916 0 0 1 -29.6001,-32.13916 29.600101,32.13916 0 0 1 29.6001,-32.13916 29.600101,32.13916 0 0 1 29.6001,32.13916 z"
|
||||
id="path4511"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 93.677969,147.99724 c -0.395594,22.47841 4.527463,41.88837 22.584271,53.72117 l 27.39513,-8.15172 -18.04069,-43.03039 z"
|
||||
id="path4509"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 62.674703,134.7674 -16.169807,12.56166 c -1.333244,16.39823 0.765675,30.47975 9.48807,40.09043 l 24.054257,11.49259 -8.418991,-58.66566 z"
|
||||
id="path4507"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccc" />
|
||||
<g
|
||||
id="g21"
|
||||
transform="translate(15.875001,-17.197916)">
|
||||
<path
|
||||
style="fill:#fffffe;fill-opacity:1;stroke-width:0.26458335"
|
||||
d="m 46.345056,148.8052 c -10.572707,-7.01838 -29.137783,-20.60789 -16.354155,-36.26684 2.792886,-3.42106 9.229962,-2.48742 12.899245,-6.66658 5.745866,-6.544297 -2.928299,-20.43558 6.821111,-22.974536 26.25748,-6.838014 53.982553,16.698227 67.355863,34.080746 6.22407,8.09 14.54369,22.00013 12.84174,28.60374 -7.58886,29.4449 -40.875785,31.56064 -83.563804,3.22347 z"
|
||||
id="path27"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sssssss" />
|
||||
<path
|
||||
style="fill:#080706;stroke-width:0.26458335"
|
||||
d="m 84.85565,223.21784 c -0.582083,-0.0568 -2.546615,-0.23318 -4.365625,-0.39197 -20.814033,-1.81699 -38.901815,-9.22567 -49.477799,-20.26591 -1.236534,-1.29082 -2.741541,-3.00039 -3.344459,-3.79906 -1.507127,-1.99644 -3.64742,-5.80783 -4.46949,-7.95916 -0.375921,-0.98377 -0.825236,-1.89897 -0.998477,-2.03376 -0.173242,-0.13479 -2.071156,-0.88562 -4.217589,-1.66851 -2.717357,-0.99112 -3.89911,-1.54531 -3.891098,-1.82477 0.0063,-0.22073 1.243025,-1.21487 2.748216,-2.20918 4.454001,-2.94228 4.388568,-2.8671 4.667822,-5.36312 0.740714,-6.62065 3.902355,-12.85047 9.503309,-18.72569 2.102493,-2.20544 6.085803,-5.52653 8.403002,-7.00601 0.763984,-0.48778 1.389062,-1.02787 1.389062,-1.2002 0,-0.17232 -1.275522,-1.32077 -2.834493,-2.5521 -6.646713,-5.24982 -12.032449,-11.63806 -14.616667,-17.33743 -2.525903,-5.57076 -2.662595,-11.23225 -0.380755,-15.77003 1.53407,-3.05074 4.832473,-6.04508 8.683664,-7.88318 2.227429,-1.06311 5.997796,-2.23779 8.147538,-2.53841 1.250628,-0.17489 1.976602,-0.6666 1.683759,-1.14043 -0.08594,-0.13906 -0.400524,-1.4242 -0.699069,-2.85587 -0.988952,-4.74248 -0.655393,-10.066211 0.844203,-13.473847 4.03614,-9.171594 14.814858,-12.073738 29.282706,-7.8843 5.006091,1.449608 12.26929,4.729696 17.544661,7.923232 22.189389,13.432735 39.709659,34.793365 43.010019,52.437625 0.25178,1.34606 0.5667,2.44739 0.69981,2.44739 0.13311,0 0.92446,-0.63182 1.75856,-1.40404 3.54633,-3.28328 7.49606,-5.71366 11.68663,-7.19111 l 2.01994,-0.71217 1.45901,-3.12075 c 3.10433,-6.64002 5.55205,-9.94949 8.23721,-11.13727 2.87328,-1.27099 7.01394,-1.25696 11.82067,0.04 1.85571,0.50072 2.09219,0.63446 2.09219,1.18318 0,0.63096 -1.50623,5.10451 -1.84755,5.48728 -0.10338,0.11593 -1.18848,-0.0487 -2.41135,-0.36582 -2.74518,-0.71192 -5.83671,-0.78186 -7.03012,-0.15905 -0.83457,0.43553 -1.96621,2.07603 -3.38352,4.90494 -0.94022,1.87666 -0.79779,2.15519 1.10434,2.15951 0.84131,0.002 2.66075,0.23847 4.0432,0.52569 1.38245,0.28722 2.64152,0.52378 2.79794,0.52569 0.15642,0.002 0.98283,-0.97879 1.83648,-2.17934 1.9126,-2.68983 4.93176,-5.86635 6.34579,-6.67652 2.87145,-1.6452 8.06221,-1.72095 13.06127,-0.1906 0.78078,0.23902 1.47656,0.58302 1.54619,0.76446 0.13131,0.34221 -1.42046,5.33637 -1.78088,5.7315 -0.11246,0.12328 -1.19187,-0.0256 -2.39871,-0.33073 -2.51537,-0.63608 -5.67117,-0.72538 -6.93742,-0.19631 -1.10828,0.46307 -4.94566,4.94798 -4.94566,5.78021 0,0.1073 0.8632,0.78055 1.91823,1.49609 8.15852,5.53335 13.50852,14.09056 15.15464,24.23953 0.45149,2.78368 0.50879,8.46332 0.11531,11.43198 -0.41986,3.16776 -1.7455,7.59538 -3.18093,10.62425 -6.24518,13.17785 -18.72159,20.62034 -32.42903,19.34474 l -3.08894,-0.28745 -1.48162,1.43172 c -10.34441,9.99603 -26.96541,16.68795 -46.83643,18.85717 -3.476936,0.37956 -14.403071,0.70811 -16.55769,0.49788 z m 20.27696,-7.93406 c 1.63073,-0.22745 4.34349,-0.69472 6.02837,-1.03837 4.64888,-0.94822 12.45871,-3.23714 13.07573,-3.83226 0.12249,-0.11815 -1.07949,-1.50762 -2.67109,-3.08772 -4.15737,-4.12734 -6.69847,-8.19252 -9.07349,-14.51549 -2.34748,-6.24967 -3.97607,-14.37835 -4.29358,-21.43033 l -0.0596,-1.32292 -1.19062,0.0464 c -12.441292,0.48515 -13.745045,0.43289 -21.664749,-0.86854 -2.854664,-0.4691 -4.153302,-0.58546 -4.349081,-0.38968 -0.58235,0.58235 0.906968,10.93781 2.362285,16.42534 3.102184,11.69732 8.210005,21.62282 14.26264,27.7151 3.094105,3.11437 2.662455,2.98337 7.573155,2.29844 z m -43.428002,-3.30295 c 0,-0.15231 -0.543118,-1.21852 -1.206929,-2.36937 -3.628567,-6.29087 -6.502479,-14.87537 -8.068559,-24.10116 -1.091673,-6.43105 -1.001098,-16.81442 0.202605,-23.22628 0.774287,-4.12446 0.87485,-3.86425 -2.171909,-5.61974 -1.455208,-0.83847 -2.830703,-1.5317 -3.056655,-1.54052 -0.479665,-0.0187 -5.601557,3.26442 -7.526679,4.82459 -2.384136,1.93218 -5.187357,4.79938 -5.568258,5.69534 -1.059314,2.49173 -1.488277,9.05979 -0.902111,13.81265 0.847142,6.86897 3.516386,15.12877 6.815574,21.09034 1.142656,2.06475 1.332579,2.26146 3.605493,3.7344 4.440129,2.87738 8.37106,4.76511 14.173261,6.80639 3.62658,1.27587 3.704167,1.29458 3.704167,0.89336 z M 160.43706,195.7446 c 2.19979,-0.42325 4.93082,-1.36619 5.49421,-1.89699 0.32519,-0.30636 0.30679,-0.38135 -0.13229,-0.53927 -4.52097,-1.62598 -8.70239,-3.7522 -12.94541,-6.58265 -6.03614,-4.02661 -9.35135,-7.70379 -8.7249,-9.67754 0.37103,-1.16903 3.6319,-1.72448 5.51204,-0.93891 1.32236,0.55252 2.4481,2.1086 2.96933,4.10445 0.25126,0.96209 0.58743,1.88819 0.74706,2.058 0.15962,0.16982 4.18567,2.17496 8.94677,4.45588 l 8.65655,4.14713 0.76192,-0.54254 c 1.16409,-0.8289 3.86439,-3.80688 5.09472,-5.61862 3.3317,-4.90616 5.2716,-11.27488 5.27034,-17.30268 -5.3e-4,-2.56767 -0.5702,-6.94165 -1.06949,-8.21165 -0.28218,-0.71776 -0.32573,-0.73936 -0.51409,-0.25502 -0.11319,0.29105 -0.33977,1.40268 -0.50351,2.47031 -0.35925,2.3424 -1.3755,4.59955 -2.39902,5.32836 -2.85969,2.03629 -5.63671,-1.44834 -6.01697,-7.55013 -0.27572,-4.42439 1.04197,-8.80622 2.99464,-9.95832 0.49307,-0.29092 0.89648,-0.69437 0.89648,-0.89655 0,-0.20219 -0.8Line truncated
|
||||
id="path23"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Reference in new issue
Block a user