1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +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.MergedDictionaries>
<ResourceDictionary>
<local:AppBootstrapper x:Key="bootstrapper" />
<local:ArtemisBootstrapper x:Key="bootstrapper" />
</ResourceDictionary>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,9 @@
using System;
using System.Linq;
using System.Windows;
using Artemis.Models;
using Artemis.ViewModels.Flyouts;
using Caliburn.Micro;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Artemis.ViewModels
{
@ -18,11 +19,15 @@ namespace Artemis.ViewModels
ActivateItem(new EffectsViewModel(MainModel) {DisplayName = "Effects"});
ActivateItem(new GamesViewModel(MainModel) {DisplayName = "Games"});
ActivateItem(new OverlaysViewModel(MainModel) {DisplayName = "Overlays"});
Flyouts.Add(new FlyoutSettingsViewModel());
// By now Effects are added to the MainModel so we can savely start one
ToggleEffects();
}
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; } =
new BindableCollection<FlyoutBaseViewModel>();
public bool EffectsEnabled
{
get { return MainModel.Enabled; }
@ -51,9 +56,9 @@ namespace Artemis.ViewModels
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
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"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@ -24,20 +24,6 @@
Grid.Column="0"
Margin="5"
VerticalAlignment="Center"
Content="Download language:" />
<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" />
Content="Gamestate server port:" />
</Grid>
</UserControl>

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Caliburn.Micro" version="3.0.0-beta2" targetFramework="net452" />
<package id="Caliburn.Micro.Core" version="3.0.0-beta2" targetFramework="net452" />
<package id="Caliburn.Micro" version="2.0.2" targetFramework="net452" />
<package id="Caliburn.Micro.Core" version="2.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="Extended.Wpf.Toolkit" version="2.6" targetFramework="net452" />