mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
And the winner is... Stylet!
This commit is contained in:
parent
59a84e9db6
commit
529e52b35d
@ -1,6 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
</startup>
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -1,12 +1,18 @@
|
|||||||
<Application x:Class="Artemis.UI.App"
|
<Application x:Class="Artemis.UI.App"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
StartupUri="MainWindow.xaml">
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:local="clr-namespace:Artemis.UI">
|
||||||
|
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
|
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<s:ApplicationLoader>
|
||||||
|
<s:ApplicationLoader.Bootstrapper>
|
||||||
|
<local:Bootstrapper />
|
||||||
|
</s:ApplicationLoader.Bootstrapper>
|
||||||
|
</s:ApplicationLoader>
|
||||||
<!-- MahApps -->
|
<!-- MahApps -->
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||||
|
|||||||
@ -1,17 +1,11 @@
|
|||||||
using System;
|
using System.Windows;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace Artemis.UI
|
namespace Artemis.UI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for App.xaml
|
/// Interaction logic for App.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using Artemis.UI.Ninject;
|
|
||||||
using Artemis.UI.ViewModels;
|
|
||||||
using Ninject;
|
|
||||||
using ReactiveUI;
|
|
||||||
using ReactiveUI.Fody.Helpers;
|
|
||||||
using Splat;
|
|
||||||
|
|
||||||
namespace Artemis.UI
|
|
||||||
{
|
|
||||||
public class AppBootstrapper : ReactiveObject, IScreen
|
|
||||||
{
|
|
||||||
public AppBootstrapper()
|
|
||||||
{
|
|
||||||
Router = new RoutingState();
|
|
||||||
Kernel = new StandardKernel(new ViewsModule());
|
|
||||||
|
|
||||||
// Configure the Ninject kernel and set it up as the default for ReactiveUI
|
|
||||||
SetupNinject(Kernel);
|
|
||||||
|
|
||||||
// Update the title on view change
|
|
||||||
this.WhenAnyValue(x => x.Router.CurrentViewModel)
|
|
||||||
.Subscribe(o => o.Subscribe(vm => { ViewTitle = vm != null ? vm.UrlPathSegment : ""; }));
|
|
||||||
|
|
||||||
// Setup the sidebar that lives throughout the app
|
|
||||||
SidebarViewModel = Kernel.Get<ISidebarViewModel>();
|
|
||||||
// Navigate to the opening page of the application
|
|
||||||
Router.Navigate.Execute(Kernel.Get<IMainViewModel>());
|
|
||||||
}
|
|
||||||
|
|
||||||
public IKernel Kernel { get; set; }
|
|
||||||
public ISidebarViewModel SidebarViewModel { get; }
|
|
||||||
public RoutingState Router { get; }
|
|
||||||
|
|
||||||
[Reactive]
|
|
||||||
public string ViewTitle { get; set; }
|
|
||||||
|
|
||||||
private void SetupNinject(IKernel kernel)
|
|
||||||
{
|
|
||||||
// Bind the main screen to IScreen
|
|
||||||
kernel.Bind<IScreen>().ToConstant(this);
|
|
||||||
|
|
||||||
// Set up NInject to do DI
|
|
||||||
var customResolver = new FuncDependencyResolver(
|
|
||||||
(service, contract) =>
|
|
||||||
{
|
|
||||||
if (contract != null) return kernel.GetAll(service, contract);
|
|
||||||
var items = kernel.GetAll(service);
|
|
||||||
var list = items.ToList();
|
|
||||||
return list;
|
|
||||||
},
|
|
||||||
(factory, service, contract) =>
|
|
||||||
{
|
|
||||||
var binding = kernel.Bind(service).ToMethod(_ => factory());
|
|
||||||
if (contract != null) binding.Named(contract);
|
|
||||||
});
|
|
||||||
Locator.Current = customResolver;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -36,6 +36,9 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Castle.Core.4.2.0\lib\net45\Castle.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
|
<Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
|
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -51,33 +54,22 @@
|
|||||||
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
|
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ReactiveUI, Version=7.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Ninject.Extensions.Conventions, Version=3.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\reactiveui-core.7.4.0\lib\Net45\ReactiveUI.dll</HintPath>
|
<HintPath>..\packages\Ninject.Extensions.Conventions.3.3.0\lib\net45\Ninject.Extensions.Conventions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ReactiveUI.Fody.Helpers, Version=2.2.11.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Ninject.Extensions.Factory, Version=3.3.2.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ReactiveUI.Fody.2.2.11\lib\net45\ReactiveUI.Fody.Helpers.dll</HintPath>
|
<HintPath>..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Splat, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="PropertyChanged, Version=2.2.4.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Splat.1.6.0\lib\Net45\Splat.dll</HintPath>
|
<HintPath>..\packages\PropertyChanged.Fody.2.2.4.0\lib\net452\PropertyChanged.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Stylet, Version=1.1.21.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Stylet.1.1.21\lib\net45\Stylet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reactive.Windows.Threading, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Rx-XAML.2.2.5\lib\net45\System.Reactive.Windows.Threading.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -99,34 +91,21 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Compile Include="AppBootstrapper.cs" />
|
<Compile Include="Bootstrapper.cs" />
|
||||||
<Compile Include="Ninject\ViewsModule.cs" />
|
<Compile Include="Ninject\UIModule.cs" />
|
||||||
|
<Compile Include="Stylet\NinjectBootstrapper.cs" />
|
||||||
<Compile Include="ViewModels\Interfaces\IArtemisViewModel.cs" />
|
<Compile Include="ViewModels\Interfaces\IArtemisViewModel.cs" />
|
||||||
<Compile Include="ViewModels\MainViewModel.cs" />
|
<Compile Include="ViewModels\HomeViewModel.cs" />
|
||||||
<Compile Include="ViewModels\SidebarViewModel.cs" />
|
<Compile Include="ViewModels\RootViewModel.cs" />
|
||||||
<Compile Include="Views\MainView.xaml.cs">
|
|
||||||
<DependentUpon>MainView.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Views\SidebarView.xaml.cs">
|
|
||||||
<DependentUpon>SidebarView.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Page Include="MainWindow.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="MainWindow.xaml.cs">
|
<Page Include="Views\HomeView.xaml">
|
||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Page Include="Views\MainView.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\SidebarView.xaml">
|
<Page Include="Views\RootView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@ -178,14 +157,14 @@
|
|||||||
<Folder Include="Controls\RgbDevice\" />
|
<Folder Include="Controls\RgbDevice\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="FodyWeavers.xml" />
|
<Resource Include="FodyWeavers.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\packages\Fody.2.0.7\build\netstandard1.4\Fody.targets" Condition="Exists('..\packages\Fody.2.0.7\build\netstandard1.4\Fody.targets')" />
|
<Import Project="..\packages\Fody.2.3.8\build\net452\Fody.targets" Condition="Exists('..\packages\Fody.2.3.8\build\net452\Fody.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\Fody.2.0.7\build\netstandard1.4\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.0.7\build\netstandard1.4\Fody.targets'))" />
|
<Error Condition="!Exists('..\packages\Fody.2.3.8\build\net452\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.3.8\build\net452\Fody.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
16
src/Artemis.UI/Bootstrapper.cs
Normal file
16
src/Artemis.UI/Bootstrapper.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using Artemis.UI.Ninject;
|
||||||
|
using Artemis.UI.Stylet;
|
||||||
|
using Artemis.UI.ViewModels;
|
||||||
|
using Ninject;
|
||||||
|
|
||||||
|
namespace Artemis.UI
|
||||||
|
{
|
||||||
|
public class Bootstrapper : NinjectBootstrapper<RootViewModel>
|
||||||
|
{
|
||||||
|
protected override void ConfigureIoC(IKernel kernel)
|
||||||
|
{
|
||||||
|
kernel.Load<UIModule>();
|
||||||
|
base.ConfigureIoC(kernel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<Weavers>
|
<Weavers>
|
||||||
<ReactiveUI />
|
<PropertyChanged />
|
||||||
</Weavers>
|
</Weavers>
|
||||||
@ -1,20 +0,0 @@
|
|||||||
using MahApps.Metro.Controls;
|
|
||||||
|
|
||||||
namespace Artemis.UI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for MainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow : MetroWindow
|
|
||||||
{
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
AppBootstrapper = new AppBootstrapper();
|
|
||||||
DataContext = AppBootstrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppBootstrapper AppBootstrapper { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
src/Artemis.UI/Ninject/UiModule.cs
Normal file
18
src/Artemis.UI/Ninject/UiModule.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Artemis.UI.ViewModels.Interfaces;
|
||||||
|
using Ninject.Extensions.Conventions;
|
||||||
|
using Ninject.Modules;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Ninject
|
||||||
|
{
|
||||||
|
public class UIModule : NinjectModule
|
||||||
|
{
|
||||||
|
public override void Load()
|
||||||
|
{
|
||||||
|
// Bind all viewmodels
|
||||||
|
Kernel.Bind(x =>
|
||||||
|
{
|
||||||
|
x.FromThisAssembly().SelectAllClasses().InheritedFrom<IArtemisViewModel>().BindAllInterfaces();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
using Artemis.UI.ViewModels;
|
|
||||||
using Ninject.Modules;
|
|
||||||
|
|
||||||
namespace Artemis.UI.Ninject
|
|
||||||
{
|
|
||||||
public class ViewsModule : NinjectModule
|
|
||||||
{
|
|
||||||
public override void Load()
|
|
||||||
{
|
|
||||||
Bind<IMainViewModel>().To<MainViewModel>();
|
|
||||||
Bind<ISidebarViewModel>().To<SidebarViewModel>().InSingletonScope();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Resources;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
@ -33,11 +31,11 @@ using System.Windows;
|
|||||||
|
|
||||||
[assembly: ThemeInfo(
|
[assembly: ThemeInfo(
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// or application resource dictionaries)
|
// or application resource dictionaries)
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// app, or any theme specific resource dictionaries)
|
// app, or any theme specific resource dictionaries)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|
||||||
@ -52,4 +50,4 @@ using System.Windows;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
|
||||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
<Profiles>
|
<Profiles>
|
||||||
<Profile Name="(Default)" />
|
<Profile Name="(Default)" />
|
||||||
|
|||||||
68
src/Artemis.UI/Stylet/NinjectBootstrapper.cs
Normal file
68
src/Artemis.UI/Stylet/NinjectBootstrapper.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using Ninject;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Stylet
|
||||||
|
{
|
||||||
|
public class NinjectBootstrapper<TRootViewModel> : BootstrapperBase where TRootViewModel : class
|
||||||
|
{
|
||||||
|
private object _rootViewModel;
|
||||||
|
private IKernel kernel;
|
||||||
|
|
||||||
|
protected virtual object RootViewModel =>
|
||||||
|
_rootViewModel ?? (_rootViewModel = GetInstance(typeof(TRootViewModel)));
|
||||||
|
|
||||||
|
protected override void ConfigureBootstrapper()
|
||||||
|
{
|
||||||
|
kernel = new StandardKernel();
|
||||||
|
DefaultConfigureIoC(kernel);
|
||||||
|
ConfigureIoC(kernel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Carries out default configuration of the IoC container. Override if you don't want to do this
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void DefaultConfigureIoC(IKernel kernel)
|
||||||
|
{
|
||||||
|
var viewManagerConfig = new ViewManagerConfig
|
||||||
|
{
|
||||||
|
ViewFactory = GetInstance,
|
||||||
|
ViewAssemblies = new List<Assembly> {GetType().Assembly}
|
||||||
|
};
|
||||||
|
kernel.Bind<IViewManager>().ToConstant(new ViewManager(viewManagerConfig));
|
||||||
|
|
||||||
|
kernel.Bind<IWindowManagerConfig>().ToConstant(this).InTransientScope();
|
||||||
|
kernel.Bind<IWindowManager>().ToMethod(c => new WindowManager(c.Kernel.Get<IViewManager>(),
|
||||||
|
() => c.Kernel.Get<IMessageBoxViewModel>(), c.Kernel.Get<IWindowManagerConfig>())).InSingletonScope();
|
||||||
|
kernel.Bind<IEventAggregator>().To<EventAggregator>().InSingletonScope();
|
||||||
|
kernel.Bind<IMessageBoxViewModel>().To<MessageBoxViewModel>(); // Not singleton!
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override to add your own types to the IoC container.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void ConfigureIoC(IKernel kernel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object GetInstance(Type type)
|
||||||
|
{
|
||||||
|
return kernel.Get(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Launch()
|
||||||
|
{
|
||||||
|
DisplayRootView(RootViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
base.Dispose();
|
||||||
|
ScreenExtensions.TryDispose(_rootViewModel);
|
||||||
|
if (kernel != null)
|
||||||
|
kernel.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/Artemis.UI/ViewModels/HomeViewModel.cs
Normal file
23
src/Artemis.UI/ViewModels/HomeViewModel.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Artemis.UI.ViewModels.Interfaces;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.UI.ViewModels
|
||||||
|
{
|
||||||
|
public class HomeViewModel : Screen, IMainViewModel
|
||||||
|
{
|
||||||
|
public string Title => "Home";
|
||||||
|
|
||||||
|
public void OpenUrl(string url)
|
||||||
|
{
|
||||||
|
// Don't open anything but valid URIs
|
||||||
|
if (Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute))
|
||||||
|
Process.Start(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IMainViewModel : IArtemisViewModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,10 +1,7 @@
|
|||||||
using ReactiveUI;
|
namespace Artemis.UI.ViewModels.Interfaces
|
||||||
|
|
||||||
namespace Artemis.UI.ViewModels.Interfaces
|
|
||||||
{
|
{
|
||||||
public interface IArtemisViewModel : IRoutableViewModel
|
public interface IArtemisViewModel
|
||||||
{
|
{
|
||||||
string Title { get; }
|
string Title { get; }
|
||||||
string Icon { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,36 +0,0 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Artemis.UI.ViewModels.Interfaces;
|
|
||||||
using ReactiveUI;
|
|
||||||
|
|
||||||
namespace Artemis.UI.ViewModels
|
|
||||||
{
|
|
||||||
public class MainViewModel : ReactiveObject, IMainViewModel
|
|
||||||
{
|
|
||||||
public MainViewModel(IScreen screen, ISidebarViewModel sidebarViewModel)
|
|
||||||
{
|
|
||||||
HostScreen = screen;
|
|
||||||
OpenUrl = ReactiveCommand.CreateFromTask<string>(OpenUrlAsync);
|
|
||||||
|
|
||||||
// Add this view as a menu item
|
|
||||||
sidebarViewModel.MenuItems.Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IScreen HostScreen { get; }
|
|
||||||
public string UrlPathSegment => Title.ToLower();
|
|
||||||
public string Title => "Home";
|
|
||||||
public string Icon => "Home";
|
|
||||||
|
|
||||||
public ReactiveCommand OpenUrl { get; }
|
|
||||||
|
|
||||||
private async Task OpenUrlAsync(string url)
|
|
||||||
{
|
|
||||||
await Task.Run(() => Process.Start(url));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IMainViewModel : IArtemisViewModel
|
|
||||||
{
|
|
||||||
ReactiveCommand OpenUrl { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
src/Artemis.UI/ViewModels/RootViewModel.cs
Normal file
18
src/Artemis.UI/ViewModels/RootViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Artemis.UI.ViewModels.Interfaces;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.UI.ViewModels
|
||||||
|
{
|
||||||
|
public class RootViewModel : Conductor<IArtemisViewModel>.Collection.OneActive
|
||||||
|
{
|
||||||
|
public RootViewModel(ICollection<IArtemisViewModel> artemisViewModels)
|
||||||
|
{
|
||||||
|
// Add the built-in items
|
||||||
|
Items.AddRange(artemisViewModels);
|
||||||
|
// Activate the home item
|
||||||
|
ActiveItem = artemisViewModels.First(v => v.GetType() == typeof(HomeViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,23 +0,0 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using Artemis.UI.ViewModels.Interfaces;
|
|
||||||
using ReactiveUI;
|
|
||||||
|
|
||||||
namespace Artemis.UI.ViewModels
|
|
||||||
{
|
|
||||||
public class SidebarViewModel : ReactiveObject, ISidebarViewModel
|
|
||||||
{
|
|
||||||
public SidebarViewModel(IScreen screen)
|
|
||||||
{
|
|
||||||
HostScreen = screen;
|
|
||||||
MenuItems = new ObservableCollection<IArtemisViewModel>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IScreen HostScreen { get; }
|
|
||||||
public ObservableCollection<IArtemisViewModel> MenuItems { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ISidebarViewModel
|
|
||||||
{
|
|
||||||
ObservableCollection<IArtemisViewModel> MenuItems { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,23 +1,27 @@
|
|||||||
<UserControl x:Class="Artemis.UI.Views.MainView"
|
<UserControl x:Class="Artemis.UI.Views.HomeView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:viewModels="clr-namespace:Artemis.UI.ViewModels"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:vms="clr-namespace:Artemis.UI.ViewModels"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="574.026"
|
d:DesignHeight="574.026"
|
||||||
d:DesignWidth="1029.87"
|
d:DesignWidth="1029.87"
|
||||||
d:DataContext="{d:DesignInstance viewModels:MainViewModel,
|
d:DataContext="{d:DesignInstance vms:HomeViewModel, IsDesignTimeCreatable=True}">
|
||||||
IsDesignTimeCreatable=True}">
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
|
<ResourceDictionary
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml" />
|
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
|
<ResourceDictionary
|
||||||
|
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml" />
|
||||||
|
<ResourceDictionary
|
||||||
|
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
|
||||||
<!-- throw in some extra colour for our floating action button -->
|
<!-- throw in some extra colour for our floating action button -->
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Green.Named.Primary.xaml" />
|
<ResourceDictionary
|
||||||
|
Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Green.Named.Primary.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
@ -59,42 +63,57 @@
|
|||||||
<ColumnDefinition Width="200" />
|
<ColumnDefinition Width="200" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<materialDesign:PackIcon Kind="Discord" Width="140" Height="140" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
<materialDesign:PackIcon Kind="Discord" Width="140" Height="140"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignHeadlineTextBlock}" Margin="16 16 16 8">Have a chat</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignHeadlineTextBlock}" Margin="16 16 16 8">Have a chat</TextBlock>
|
||||||
<TextBlock TextWrapping="Wrap" Margin="16 0 16 8" Foreground="{DynamicResource MaterialDesignBodyLight}"
|
<TextBlock TextWrapping="Wrap" Margin="16 0 16 8"
|
||||||
VerticalAlignment="Top"><Run Text="If you need help, have some feedback or have any other questions feel free to contact us through any of the following channels"/><Run Text=". "/></TextBlock>
|
Foreground="{DynamicResource MaterialDesignBodyLight}"
|
||||||
|
VerticalAlignment="Top">
|
||||||
|
<Run
|
||||||
|
Text="If you need help, have some feedback or have any other questions feel free to contact us through any of the following channels" />
|
||||||
|
<Run Text=". " />
|
||||||
|
</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Border Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}" Padding="8">
|
<Border Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0 1 0 0"
|
||||||
|
BorderBrush="{DynamicResource MaterialDesignDivider}" Padding="8">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Grid Margin="8">
|
<Grid Margin="8">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Left"
|
<Button Style="{DynamicResource MaterialDesignFlatButton}"
|
||||||
x:Name="GitHubButton" Command="{Binding OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
HorizontalAlignment="Left"
|
||||||
|
x:Name="GitHubButton" Command="{s:Action OpenUrl}"
|
||||||
|
CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="GithubCircle" />
|
<materialDesign:PackIcon Kind="GithubCircle" />
|
||||||
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">GitHub</TextBlock>
|
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">GitHub</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right"
|
<Button Style="{DynamicResource MaterialDesignFlatButton}"
|
||||||
x:Name="TwitterButton" Command="{Binding OpenUrl}" CommandParameter="https://twitter.com/spoinkynl">
|
HorizontalAlignment="Right"
|
||||||
|
x:Name="TwitterButton" Command="{s:Action OpenUrl}"
|
||||||
|
CommandParameter="https://twitter.com/spoinkynl">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Twitter" />
|
<materialDesign:PackIcon Kind="Twitter" />
|
||||||
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Twitter</TextBlock>
|
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Twitter</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Row="1" Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Left"
|
<Button Grid.Row="1" Style="{DynamicResource MaterialDesignFlatButton}"
|
||||||
x:Name="DiscordButton" Command="{Binding OpenUrl}" CommandParameter="https://discordapp.com/invite/S3MVaC9">
|
HorizontalAlignment="Left"
|
||||||
|
x:Name="DiscordButton" Command="{s:Action OpenUrl}"
|
||||||
|
CommandParameter="https://discordapp.com/invite/S3MVaC9">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Discord" />
|
<materialDesign:PackIcon Kind="Discord" />
|
||||||
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Discord</TextBlock>
|
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Discord</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Row="1" Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right"
|
<Button Grid.Row="1" Style="{DynamicResource MaterialDesignFlatButton}"
|
||||||
x:Name="MailButton" Command="{Binding OpenUrl}" CommandParameter="mailto:spoinky.nl@gmail.com">
|
HorizontalAlignment="Right"
|
||||||
|
x:Name="MailButton" Command="{s:Action OpenUrl}"
|
||||||
|
CommandParameter="mailto:spoinky.nl@gmail.com">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Email" />
|
<materialDesign:PackIcon Kind="Email" />
|
||||||
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">E-mail</TextBlock>
|
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">E-mail</TextBlock>
|
||||||
@ -115,23 +134,36 @@
|
|||||||
<ColumnDefinition Width="200" />
|
<ColumnDefinition Width="200" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<materialDesign:PackIcon Kind="GithubCircle" Width="160" Height="160" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
<materialDesign:PackIcon Kind="GithubCircle" Width="160" Height="160"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignHeadlineTextBlock}" Margin="16 16 16 8">Open Source</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignHeadlineTextBlock}" Margin="16 16 16 8">Open Source</TextBlock>
|
||||||
<TextBlock TextWrapping="Wrap" Margin="16 0 16 8" Foreground="{DynamicResource MaterialDesignBodyLight}"
|
<TextBlock TextWrapping="Wrap" Margin="16 0 16 8"
|
||||||
VerticalAlignment="Top"><Run Text="This project is completely open source. If you like it and want to say thanks you could hit the GitHub Star button, tweet or post about it"/><Run Text=". You can also make your own modules!"/></TextBlock>
|
Foreground="{DynamicResource MaterialDesignBodyLight}"
|
||||||
|
VerticalAlignment="Top">
|
||||||
|
<Run
|
||||||
|
Text="This project is completely open source. If you like it and want to say thanks you could hit the GitHub Star button, tweet or post about it" />
|
||||||
|
<Run Text=". You can also make your own modules!" />
|
||||||
|
</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Border Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}" Padding="8">
|
<Border Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0 1 0 0"
|
||||||
|
BorderBrush="{DynamicResource MaterialDesignDivider}" Padding="8">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Button Style="{DynamicResource MaterialDesignFlatButton}"
|
<Button Style="{DynamicResource MaterialDesignFlatButton}"
|
||||||
DockPanel.Dock="Right"
|
DockPanel.Dock="Right"
|
||||||
x:Name="DonateButton" Command="{Binding OpenUrl}" CommandParameter="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VQBAEJYUFLU4J">
|
x:Name="DonateButton" Command="{s:Action OpenUrl}"
|
||||||
|
CommandParameter="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VQBAEJYUFLU4J">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Gift" />
|
<materialDesign:PackIcon Kind="Gift" />
|
||||||
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Donate</TextBlock>
|
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Donate</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}" TextWrapping="Wrap" Margin="16" VerticalAlignment="Center"><Run Text="Feel like you want to make a donation? It would be gratefully received. Click the button to donate via "/><Run Text="Paypal"/><Run Text="."/></TextBlock>
|
<TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}"
|
||||||
|
TextWrapping="Wrap" Margin="16" VerticalAlignment="Center">
|
||||||
|
<Run
|
||||||
|
Text="Feel like you want to make a donation? It would be gratefully received. Click the button to donate via " />
|
||||||
|
<Run Text="Paypal" /><Run Text="." />
|
||||||
|
</TextBlock>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -145,15 +177,15 @@
|
|||||||
Margin="32" Grid.Row="1">
|
Margin="32" Grid.Row="1">
|
||||||
--><!-- add the visibility binding https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/723 --><!--
|
--><!-- add the visibility binding https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/723 --><!--
|
||||||
<StackPanel Visibility="{Binding Path=IsPopupOpen, ElementName=MyPopupBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
<StackPanel Visibility="{Binding Path=IsPopupOpen, ElementName=MyPopupBox, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||||
<Button ToolTip="GitHub" Command="{Binding OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
<Button ToolTip="GitHub" Command="{s:Action OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
||||||
<materialDesign:PackIcon Kind="GithubCircle" Height="20" Width="20" />
|
<materialDesign:PackIcon Kind="GithubCircle" Height="20" Width="20" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="Twitter" Command="{Binding OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis"
|
<Button ToolTip="Twitter" Command="{s:Action OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis"
|
||||||
Background="{DynamicResource PrimaryHueMidBrush}"
|
Background="{DynamicResource PrimaryHueMidBrush}"
|
||||||
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">
|
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">
|
||||||
<materialDesign:PackIcon Kind="Twitter" />
|
<materialDesign:PackIcon Kind="Twitter" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="Chat" Command="{Binding OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
<Button ToolTip="Chat" Command="{s:Action OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
||||||
--><!-- mix up the colours by brinking in a named palette (see merged dictionaries at top) --><!--
|
--><!-- mix up the colours by brinking in a named palette (see merged dictionaries at top) --><!--
|
||||||
<Button.Background>
|
<Button.Background>
|
||||||
<SolidColorBrush Color="{StaticResource GreenPrimary500}" />
|
<SolidColorBrush Color="{StaticResource GreenPrimary500}" />
|
||||||
@ -163,14 +195,14 @@
|
|||||||
</Button.Foreground>
|
</Button.Foreground>
|
||||||
<materialDesign:PackIcon Kind="Message" />
|
<materialDesign:PackIcon Kind="Message" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="Email" Command="{Binding OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis"
|
<Button ToolTip="Email" Command="{s:Action OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis"
|
||||||
Background="{DynamicResource SecondaryAccentBrush}"
|
Background="{DynamicResource SecondaryAccentBrush}"
|
||||||
Foreground="{DynamicResource SecondaryAccentForegroundBrush}"
|
Foreground="{DynamicResource SecondaryAccentForegroundBrush}"
|
||||||
>
|
>
|
||||||
<materialDesign:PackIcon Kind="Email" />
|
<materialDesign:PackIcon Kind="Email" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="Feel like you want to make a donation? It would be gratefully received. Click the button to donate via Pledgie."
|
<Button ToolTip="Feel like you want to make a donation? It would be gratefully received. Click the button to donate via Pledgie."
|
||||||
Command="{Binding OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
Command="{s:Action OpenUrl}" CommandParameter="https://github.com/SpoinkyNL/Artemis">
|
||||||
<Button.Background>
|
<Button.Background>
|
||||||
<SolidColorBrush Color="{StaticResource GreenPrimary200}" />
|
<SolidColorBrush Color="{StaticResource GreenPrimary200}" />
|
||||||
</Button.Background>
|
</Button.Background>
|
||||||
@ -182,4 +214,4 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:PopupBox>-->
|
</materialDesign:PopupBox>-->
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,30 +0,0 @@
|
|||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Artemis.UI.ViewModels;
|
|
||||||
using ReactiveUI;
|
|
||||||
|
|
||||||
namespace Artemis.UI.Views
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for MainView.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainView : UserControl, IViewFor<IMainViewModel>
|
|
||||||
{
|
|
||||||
public static readonly DependencyProperty ViewModelProperty =
|
|
||||||
DependencyProperty.Register("ViewModel", typeof(IMainViewModel), typeof(MainView), new PropertyMetadata(null));
|
|
||||||
|
|
||||||
public MainView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
this.WhenAnyValue(x => x.ViewModel).BindTo(this, x => x.DataContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
object IViewFor.ViewModel
|
|
||||||
{
|
|
||||||
get => ViewModel;
|
|
||||||
set => ViewModel = (IMainViewModel) value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IMainViewModel ViewModel { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,18 +1,19 @@
|
|||||||
<metro:MetroWindow x:Class="Artemis.UI.MainWindow"
|
<metro:MetroWindow x:Class="Artemis.UI.Views.RootView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
|
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:views="clr-namespace:Artemis.UI.Views"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
xmlns:reactiveUi="http://reactiveui.net"
|
xmlns:vms="clr-namespace:Artemis.UI.ViewModels"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
GlowBrush="{DynamicResource AccentColorBrush}"
|
GlowBrush="{DynamicResource AccentColorBrush}"
|
||||||
FontFamily="{StaticResource DefaultFont}"
|
FontFamily="{StaticResource DefaultFont}"
|
||||||
Title="Artemis"
|
Title="Artemis"
|
||||||
d:DesignHeight="639.411"
|
d:DesignHeight="639.411"
|
||||||
d:DesignWidth="1113.251">
|
d:DesignWidth="1113.251"
|
||||||
|
d:DataContext="{d:DesignInstance vms:RootViewModel}">
|
||||||
<metro:MetroWindow.Resources>
|
<metro:MetroWindow.Resources>
|
||||||
<DrawingImage x:Key="BowIcon">
|
<DrawingImage x:Key="BowIcon">
|
||||||
<DrawingImage.Drawing>
|
<DrawingImage.Drawing>
|
||||||
@ -71,33 +72,42 @@
|
|||||||
<DockPanel MinWidth="212">
|
<DockPanel MinWidth="212">
|
||||||
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
|
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
|
||||||
DockPanel.Dock="Top"
|
DockPanel.Dock="Top"
|
||||||
HorizontalAlignment="Right" Margin="16"
|
HorizontalAlignment="Right"
|
||||||
|
Margin="16"
|
||||||
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
|
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
|
||||||
<views:SidebarView DataContext="{Binding SidebarViewModel}"></views:SidebarView>
|
<ListBox Margin="0 16 0 16" SelectedIndex="0">
|
||||||
|
|
||||||
|
</ListBox>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</materialDesign:DrawerHost.LeftDrawerContent>
|
</materialDesign:DrawerHost.LeftDrawerContent>
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2"
|
<materialDesign:ColorZone Padding="16"
|
||||||
Mode="PrimaryMid" DockPanel.Dock="Top">
|
materialDesign:ShadowAssist.ShadowDepth="Depth2"
|
||||||
|
Mode="PrimaryMid"
|
||||||
|
DockPanel.Dock="Top">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="False"
|
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
|
||||||
|
IsChecked="False"
|
||||||
x:Name="MenuToggleButton" />
|
x:Name="MenuToggleButton" />
|
||||||
<materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges"
|
<materialDesign:PopupBox DockPanel.Dock="Right"
|
||||||
|
PlacementMode="BottomAndAlignRightEdges"
|
||||||
StaysOpen="False">
|
StaysOpen="False">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Content="Hello World" />
|
<Button Content="Hello World" />
|
||||||
<Button Content="Nice Popup" />
|
<Button Content="Nice Popup" />
|
||||||
<Button Content="Can't Touch This" IsEnabled="False" />
|
<Button Content="Can't Touch This"
|
||||||
|
IsEnabled="False" />
|
||||||
<Separator />
|
<Separator />
|
||||||
<Button Content="Goodbye" />
|
<Button Content="Goodbye" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:PopupBox>
|
</materialDesign:PopupBox>
|
||||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Text="{Binding ViewTitle}" />
|
<TextBlock HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="22"
|
||||||
|
Text="{Binding ActiveItem.Title}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</materialDesign:ColorZone>
|
</materialDesign:ColorZone>
|
||||||
<reactiveUi:RoutedViewHost Router="{Binding Router}"
|
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||||
HorizontalContentAlignment="Stretch"
|
|
||||||
VerticalContentAlignment="Stretch" />
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</materialDesign:DrawerHost>
|
</materialDesign:DrawerHost>
|
||||||
</materialDesign:DialogHost>
|
</materialDesign:DialogHost>
|
||||||
@ -1,22 +0,0 @@
|
|||||||
<UserControl x:Class="Artemis.UI.Views.SidebarView"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:interfaces="clr-namespace:Artemis.UI.ViewModels.Interfaces"
|
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
|
||||||
<ListBox Margin="0 16 0 16"
|
|
||||||
SelectedIndex="0"
|
|
||||||
ItemsSource="{Binding MenuItems}">
|
|
||||||
<ListBox.ItemTemplate>
|
|
||||||
<DataTemplate DataType="interfaces:IArtemisViewModel">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<materialDesign:PackIcon Kind="{Binding Icon}" />
|
|
||||||
<TextBlock Text="{Binding Title}" Margin="32 0 32 0" />
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListBox.ItemTemplate>
|
|
||||||
</ListBox>
|
|
||||||
</UserControl>
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Artemis.UI.ViewModels;
|
|
||||||
using ReactiveUI;
|
|
||||||
|
|
||||||
namespace Artemis.UI.Views
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for SidebarView.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class SidebarView : UserControl, IViewFor<ISidebarViewModel>
|
|
||||||
{
|
|
||||||
public static readonly DependencyProperty ViewModelProperty =
|
|
||||||
DependencyProperty.Register("ViewModel", typeof(ISidebarViewModel), typeof(SidebarView), new PropertyMetadata(null));
|
|
||||||
|
|
||||||
public SidebarView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
this.WhenAnyValue(x => x.ViewModel).BindTo(this, x => x.DataContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
object IViewFor.ViewModel
|
|
||||||
{
|
|
||||||
get => ViewModel;
|
|
||||||
set => ViewModel = (ISidebarViewModel)value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ISidebarViewModel ViewModel { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,19 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Fody" version="2.0.7" targetFramework="net461" developmentDependency="true" />
|
<package id="Castle.Core" version="4.2.0" targetFramework="net461" />
|
||||||
|
<package id="Fody" version="2.3.8" targetFramework="net461" developmentDependency="true" />
|
||||||
<package id="MahApps.Metro" version="1.5.0" targetFramework="net461" />
|
<package id="MahApps.Metro" version="1.5.0" targetFramework="net461" />
|
||||||
<package id="MaterialDesignColors" version="1.1.3" targetFramework="net461" />
|
<package id="MaterialDesignColors" version="1.1.3" targetFramework="net461" />
|
||||||
<package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net461" />
|
<package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net461" />
|
||||||
<package id="MaterialDesignThemes.MahApps" version="0.0.11" targetFramework="net461" />
|
<package id="MaterialDesignThemes.MahApps" version="0.0.11" targetFramework="net461" />
|
||||||
<package id="Ninject" version="3.3.4" targetFramework="net461" />
|
<package id="Ninject" version="3.3.4" targetFramework="net461" />
|
||||||
<package id="reactiveui" version="7.4.0" targetFramework="net461" />
|
<package id="Ninject.Extensions.Conventions" version="3.3.0" targetFramework="net461" />
|
||||||
<package id="ReactiveUI.Fody" version="2.2.11" targetFramework="net461" />
|
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net461" />
|
||||||
<package id="reactiveui-core" version="7.4.0" targetFramework="net461" />
|
<package id="PropertyChanged.Fody" version="2.2.4.0" targetFramework="net461" developmentDependency="true" />
|
||||||
<package id="Rx-Core" version="2.2.5" targetFramework="net461" />
|
<package id="Stylet" version="1.1.21" targetFramework="net461" />
|
||||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net461" />
|
|
||||||
<package id="Rx-Linq" version="2.2.5" targetFramework="net461" />
|
|
||||||
<package id="Rx-Main" version="2.2.5" targetFramework="net461" />
|
|
||||||
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net461" />
|
|
||||||
<package id="Rx-XAML" version="2.2.5" targetFramework="net461" />
|
|
||||||
<package id="Splat" version="1.6.0" targetFramework="net461" />
|
|
||||||
</packages>
|
</packages>
|
||||||
Loading…
x
Reference in New Issue
Block a user