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:
parent
a688a343e9
commit
a9f7cbd61c
@ -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")]
|
||||
9
Arge.sln
9
Arge.sln
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
22
Arge/Attributes/FileNameAttribute.cs
Normal file
22
Arge/Attributes/FileNameAttribute.cs
Normal file
@ -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 }
|
||||
};
|
||||
|
||||
48
Arge/Bootstrapper/ArgeWindowManager.cs
Normal file
48
Arge/Bootstrapper/ArgeWindowManager.cs
Normal file
@ -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();
|
||||
|
||||
76
Arge/Configuration/Config.cs
Normal file
76
Arge/Configuration/Config.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
10
Arge/Configuration/ConfigEntryType.cs
Normal file
10
Arge/Configuration/ConfigEntryType.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Arge.Configuration
|
||||
{
|
||||
public enum ConfigEntryType
|
||||
{
|
||||
[DefaultValue("Default")]
|
||||
Theme,
|
||||
}
|
||||
}
|
||||
91
Arge/Controls/BlurredDecorationWindow.cs
Normal file
91
Arge/Controls/BlurredDecorationWindow.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
51
Arge/Controls/ImageButton.cs
Normal file
51
Arge/Controls/ImageButton.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
6
Arge/Converter/Converter.xaml
Normal file
6
Arge/Converter/Converter.xaml
Normal file
@ -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>
|
||||
|
||||
19
Arge/Extensions/EnumExtension.cs
Normal file
19
Arge/Extensions/EnumExtension.cs
Normal file
@ -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
|
||||
|
||||
50
Arge/Misc/ActionCommand.cs
Normal file
50
Arge/Misc/ActionCommand.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
28
Arge/Misc/BindingProxy.cs
Normal file
28
Arge/Misc/BindingProxy.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
16
Arge/Resources/Arge.xaml
Normal file
16
Arge/Resources/Arge.xaml
Normal file
@ -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>
|
||||
BIN
Arge/Resources/ArgeBee.ico
Normal file
BIN
Arge/Resources/ArgeBee.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
@ -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
|
||||
{
|
||||
61
Arge/Resources/ImageSources.cs
Normal file
61
Arge/Resources/ImageSources.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
122
Arge/Styles/BlurredDecorationWindow.xaml
Normal file
122
Arge/Styles/BlurredDecorationWindow.xaml
Normal file
@ -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>
|
||||
|
||||
12
Arge/Styles/FrameworkElement.xaml
Normal file
12
Arge/Styles/FrameworkElement.xaml
Normal file
@ -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>
|
||||
110
Arge/Styles/ImageButton.xaml
Normal file
110
Arge/Styles/ImageButton.xaml
Normal file
@ -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>
|
||||
|
||||
23
Arge/Styles/ToolTip.xaml
Normal file
23
Arge/Styles/ToolTip.xaml
Normal file
@ -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>
|
||||
|
||||
23
Arge/Themes/Default/Theme.xaml
Normal file
23
Arge/Themes/Default/Theme.xaml
Normal file
@ -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>
|
||||
BIN
Arge/Themes/Default/background.png
Normal file
BIN
Arge/Themes/Default/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 273 KiB |
BIN
Arge/Themes/Default/close.png
Normal file
BIN
Arge/Themes/Default/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
BIN
Arge/Themes/Default/minimize.png
Normal file
BIN
Arge/Themes/Default/minimize.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
24
Arge/Themes/Theme.cs
Normal file
24
Arge/Themes/Theme.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
81
Arge/Themes/ThemeManager.cs
Normal file
81
Arge/Themes/ThemeManager.cs
Normal file
@ -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>
|
||||
93
Images/ArgeBee.svg
Normal file
93
Images/ArgeBee.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
BIN
Images/Background.xcf
Normal file
BIN
Images/Background.xcf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user