1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Settings flyout WIP

This commit is contained in:
SpoinkyNL 2016-01-31 20:17:27 +01:00
parent c801656b00
commit 53b9dd4dbd
9 changed files with 52 additions and 64 deletions

View File

@ -8,7 +8,7 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary> <ResourceDictionary>
<local:AppBootstrapper x:Key="bootstrapper" /> <local:ArtemisBootstrapper x:Key="bootstrapper" />
</ResourceDictionary> </ResourceDictionary>
<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" />

View File

@ -78,15 +78,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Caliburn.Micro, Version=2.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL"> <Reference Include="Caliburn.Micro, Version=2.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.Core.3.0.0-beta2\lib\net45\Caliburn.Micro.dll</HintPath> <HintPath>..\packages\Caliburn.Micro.Core.2.0.2\lib\net45\Caliburn.Micro.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Caliburn.Micro.Platform, Version=2.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL"> <Reference Include="Caliburn.Micro.Platform, Version=2.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.0.0-beta2\lib\net45\Caliburn.Micro.Platform.dll</HintPath> <HintPath>..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Caliburn.Micro.Platform.Core, Version=2.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.0.0-beta2\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Corale.Colore, Version=3.0.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Corale.Colore, Version=3.0.2.0, Culture=neutral, processorArchitecture=MSIL">
@ -131,10 +127,7 @@
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<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.3.0-ALPHA017\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -185,7 +178,7 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="AppBootStrapper.cs" /> <Compile Include="ArtemisBootstrapper.cs" />
<Compile Include="Events\ChangeActiveEffect.cs" /> <Compile Include="Events\ChangeActiveEffect.cs" />
<Compile Include="Events\ChangeBitmap.cs" /> <Compile Include="Events\ChangeBitmap.cs" />
<Compile Include="KeyboardProviders\Corsair\K70.cs" /> <Compile Include="KeyboardProviders\Corsair\K70.cs" />
@ -288,6 +281,9 @@
<Compile Include="ViewModels\ShellViewModel.cs" /> <Compile Include="ViewModels\ShellViewModel.cs" />
<Compile Include="Views\EffectsView.xaml.cs"> <Compile Include="Views\EffectsView.xaml.cs">
<DependentUpon>EffectsView.xaml</DependentUpon> <DependentUpon>EffectsView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Flyouts\FlyoutSettingsView.xaml.cs">
<DependentUpon>FlyoutSettingsView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Modules\Effects\Debug\DebugEffectView.xaml.cs"> <Compile Include="Modules\Effects\Debug\DebugEffectView.xaml.cs">
<DependentUpon>DebugEffectView.xaml</DependentUpon> <DependentUpon>DebugEffectView.xaml</DependentUpon>
@ -301,9 +297,6 @@
<Compile Include="Modules\Effects\TypeWave\TypeWaveView.xaml.cs"> <Compile Include="Modules\Effects\TypeWave\TypeWaveView.xaml.cs">
<DependentUpon>TypeWaveView.xaml</DependentUpon> <DependentUpon>TypeWaveView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\Flyouts\FlyoutSettingsView.xaml.cs">
<DependentUpon>FlyoutSettingsView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\GamesView.xaml.cs"> <Compile Include="Views\GamesView.xaml.cs">
<DependentUpon>GamesView.xaml</DependentUpon> <DependentUpon>GamesView.xaml</DependentUpon>
</Compile> </Compile>
@ -408,8 +401,8 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\Flyouts\FlyoutSettingsView.xaml"> <Page Include="Views\Flyouts\FlyoutSettingsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page> </Page>
<Page Include="Views\GamesView.xaml"> <Page Include="Views\GamesView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@ -1,14 +1,12 @@
using System; using System.Windows;
using System.Windows;
using Artemis.ViewModels; using Artemis.ViewModels;
using Caliburn.Micro; using Caliburn.Micro;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Artemis namespace Artemis
{ {
public class AppBootstrapper : BootstrapperBase public class ArtemisBootstrapper : BootstrapperBase
{ {
public AppBootstrapper() public ArtemisBootstrapper()
{ {
Initialize(); Initialize();
} }

View File

@ -5,50 +5,48 @@ namespace Artemis.ViewModels
{ {
public abstract class FlyoutBaseViewModel : PropertyChangedBase public abstract class FlyoutBaseViewModel : PropertyChangedBase
{ {
private string header; private string _header;
private bool _isOpen;
private bool isOpen; private Position _position;
private Position position;
public string Header public string Header
{ {
get { return header; } get { return _header; }
set set
{ {
if (value == header) if (value == _header)
return; return;
header = value; _header = value;
NotifyOfPropertyChange(() => Header); NotifyOfPropertyChange(() => Header);
} }
} }
public bool IsOpen public bool IsOpen
{ {
get { return isOpen; } get { return _isOpen; }
set set
{ {
if (value.Equals(isOpen)) if (value.Equals(_isOpen))
return; return;
isOpen = value; _isOpen = value;
NotifyOfPropertyChange(() => IsOpen); NotifyOfPropertyChange(() => IsOpen);
} }
} }
public Position Position public Position Position
{ {
get { return position; } get { return _position; }
set set
{ {
if (value == position) if (value == _position)
return; return;
position = value; _position = value;
NotifyOfPropertyChange(() => Position); NotifyOfPropertyChange(() => Position);
} }
} }

View File

@ -1,4 +1,4 @@
using MahApps.Metro.Controls; using MahApps.Metro.Controls;
namespace Artemis.ViewModels.Flyouts namespace Artemis.ViewModels.Flyouts
{ {

View File

@ -1,8 +1,9 @@
using System; using System;
using System.Linq;
using System.Windows; using System.Windows;
using Artemis.Models; using Artemis.Models;
using Artemis.ViewModels.Flyouts;
using Caliburn.Micro; using Caliburn.Micro;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Artemis.ViewModels namespace Artemis.ViewModels
{ {
@ -18,11 +19,15 @@ namespace Artemis.ViewModels
ActivateItem(new EffectsViewModel(MainModel) {DisplayName = "Effects"}); ActivateItem(new EffectsViewModel(MainModel) {DisplayName = "Effects"});
ActivateItem(new GamesViewModel(MainModel) {DisplayName = "Games"}); ActivateItem(new GamesViewModel(MainModel) {DisplayName = "Games"});
ActivateItem(new OverlaysViewModel(MainModel) {DisplayName = "Overlays"}); ActivateItem(new OverlaysViewModel(MainModel) {DisplayName = "Overlays"});
Flyouts.Add(new FlyoutSettingsViewModel());
// By now Effects are added to the MainModel so we can savely start one // By now Effects are added to the MainModel so we can savely start one
ToggleEffects(); ToggleEffects();
} }
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; } =
new BindableCollection<FlyoutBaseViewModel>();
public bool EffectsEnabled public bool EffectsEnabled
{ {
get { return MainModel.Enabled; } get { return MainModel.Enabled; }
@ -51,9 +56,9 @@ namespace Artemis.ViewModels
Application.Current.Shutdown(); Application.Current.Shutdown();
} }
public void ToggleSettings() public void Settings()
{ {
MessageBox.Show("Test"); Flyouts.First().IsOpen = !Flyouts.First().IsOpen;
} }
} }
} }

View File

@ -3,13 +3,13 @@
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.Views.Flyouts" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
@ -24,20 +24,6 @@
Grid.Column="0" Grid.Column="0"
Margin="5" Margin="5"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="Download language:" /> Content="Gamestate server port:" />
<ComboBox x:Name="flyoutSettingsComboboxDownloadlanguage"
Grid.Row="0"
Grid.Column="1"
Margin="0,5,5,5"
VerticalAlignment="Center" />
<Button x:Name="flyoutSettingsButtonSave"
Grid.Row="1"
Grid.Column="1"
Width="75"
Margin="5"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Content="Save" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -4,19 +4,14 @@
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:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:Artemis.Views"
xmlns:cal="http://www.caliburnproject.org" xmlns:cal="http://www.caliburnproject.org"
xmlns:viewModels="clr-namespace:Artemis.ViewModels"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d" mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:ShellViewModel, IsDesignTimeCreatable=True}"
cal:Bind.AtDesignTime="True"
cal:Message.Attach="[Event Closing] = [Action OnClose($eventArgs)]" cal:Message.Attach="[Event Closing] = [Action OnClose($eventArgs)]"
Title="Artemis" Height="600" Width="718" Title="Artemis" Height="600" Width="718"
GlowBrush="{DynamicResource AccentColorBrush}"> GlowBrush="{DynamicResource AccentColorBrush}">
<Controls:MetroWindow.RightWindowCommands> <Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands> <Controls:WindowCommands>
<Button x:Name="Settings"> <Button cal:Message.Attach="Settings">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Rectangle Width="10" Height="10" <Rectangle Width="10" Height="10"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"> Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}">
@ -31,6 +26,19 @@
</Button> </Button>
</Controls:WindowCommands> </Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands> </Controls:MetroWindow.RightWindowCommands>
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl ItemsSource="{Binding Path=Flyouts}">
<Controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type Controls:Flyout}}" TargetType="{x:Type Controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
</Style>
</Controls:FlyoutsControl.ItemContainerStyle>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Grid> <Grid>
<Grid.Resources> <Grid.Resources>
<ResourceDictionary <ResourceDictionary

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Caliburn.Micro" version="3.0.0-beta2" targetFramework="net452" /> <package id="Caliburn.Micro" version="2.0.2" targetFramework="net452" />
<package id="Caliburn.Micro.Core" version="3.0.0-beta2" targetFramework="net452" /> <package id="Caliburn.Micro.Core" version="2.0.2" targetFramework="net452" />
<package id="Colore" version="3.0.2" targetFramework="net452" /> <package id="Colore" version="3.0.2" targetFramework="net452" />
<package id="CUE.NET" version="1.0.0" targetFramework="net452" /> <package id="CUE.NET" version="1.0.0" targetFramework="net452" />
<package id="Extended.Wpf.Toolkit" version="2.6" targetFramework="net452" /> <package id="Extended.Wpf.Toolkit" version="2.6" targetFramework="net452" />