mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Smoothed out keyboard changing process. Settings flyout now closes when clicking outside of it, resolves #40
This commit is contained in:
parent
5c6e393dd5
commit
d1e17c8dcd
@ -224,7 +224,7 @@
|
||||
<value>TypeWave</value>
|
||||
</setting>
|
||||
<setting name="LastKeyboard" serializeAs="String">
|
||||
<value>Logitech G910 RGB</value>
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="EnablePointersUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
@ -238,6 +238,12 @@
|
||||
<setting name="Suspended" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="ShowOnStartup" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="CheckForUpdates" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Settings.General>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
|
||||
@ -12,6 +12,8 @@ namespace Artemis.Managers
|
||||
{
|
||||
private readonly IEventAggregator _events;
|
||||
private readonly MainManager _mainManager;
|
||||
private bool _clearing;
|
||||
private EffectModel _pauseEffect;
|
||||
|
||||
public EffectManager(MainManager mainManager, IEventAggregator events)
|
||||
{
|
||||
@ -23,7 +25,6 @@ namespace Artemis.Managers
|
||||
|
||||
public List<EffectModel> EffectModels { get; set; }
|
||||
public EffectModel ActiveEffect { get; private set; }
|
||||
public EffectModel PauseEffect { get; private set; }
|
||||
|
||||
public IEnumerable<OverlayModel> EnabledOverlays
|
||||
{
|
||||
@ -83,27 +84,27 @@ namespace Artemis.Managers
|
||||
|
||||
private void ChangeEffectWithPause(EffectModel effectModel)
|
||||
{
|
||||
if (PauseEffect != null)
|
||||
if (_pauseEffect != null)
|
||||
return;
|
||||
|
||||
PauseEffect = effectModel;
|
||||
_pauseEffect = effectModel;
|
||||
_mainManager.Pause();
|
||||
_mainManager.PauseCallback += MainManagerOnPauseCallback;
|
||||
_mainManager.PauseCallback += ChangeEffectPauseCallback;
|
||||
}
|
||||
|
||||
private void MainManagerOnPauseCallback()
|
||||
private void ChangeEffectPauseCallback()
|
||||
{
|
||||
// Change effect logic
|
||||
ActiveEffect?.Dispose();
|
||||
|
||||
ActiveEffect = PauseEffect;
|
||||
ActiveEffect = _pauseEffect;
|
||||
ActiveEffect.Enable();
|
||||
|
||||
// Let the ViewModels know
|
||||
_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
|
||||
|
||||
PauseEffect = null;
|
||||
_mainManager.Unpause();
|
||||
_pauseEffect = null;
|
||||
|
||||
if (ActiveEffect is GameModel)
|
||||
return;
|
||||
@ -118,18 +119,32 @@ namespace Artemis.Managers
|
||||
/// </summary>
|
||||
public void ClearEffect()
|
||||
{
|
||||
if (_clearing)
|
||||
return;
|
||||
|
||||
// Don't mess with the ActiveEffect if in the process of changing the effect.
|
||||
if (PauseEffect != null)
|
||||
if (_pauseEffect != null)
|
||||
return;
|
||||
|
||||
if (ActiveEffect == null)
|
||||
return;
|
||||
|
||||
_clearing = true;
|
||||
|
||||
_mainManager.Pause();
|
||||
_mainManager.PauseCallback += ClearEffectPauseCallback;
|
||||
}
|
||||
|
||||
private void ClearEffectPauseCallback()
|
||||
{
|
||||
ActiveEffect.Dispose();
|
||||
ActiveEffect = null;
|
||||
|
||||
General.Default.LastEffect = null;
|
||||
General.Default.Save();
|
||||
|
||||
_clearing = false;
|
||||
_mainManager.Unpause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -9,6 +9,7 @@ namespace Artemis.Managers
|
||||
public class KeyboardManager
|
||||
{
|
||||
private readonly MainManager _mainManager;
|
||||
private KeyboardProvider _pauseKeyboard;
|
||||
|
||||
public KeyboardManager(MainManager mainManager)
|
||||
{
|
||||
@ -19,29 +20,41 @@ namespace Artemis.Managers
|
||||
public List<KeyboardProvider> KeyboardProviders { get; set; }
|
||||
public KeyboardProvider ActiveKeyboard { get; set; }
|
||||
|
||||
public bool LoadLastKeyboard()
|
||||
/// <summary>
|
||||
/// Enables the last keyboard according to the settings file
|
||||
/// </summary>
|
||||
public void EnableLastKeyboard()
|
||||
{
|
||||
if (General.Default.LastKeyboard == null)
|
||||
return;
|
||||
if (General.Default.LastKeyboard == "")
|
||||
return;
|
||||
|
||||
var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
|
||||
return ChangeKeyboard(keyboard ?? KeyboardProviders.First());
|
||||
EnableKeyboard(keyboard);
|
||||
}
|
||||
|
||||
public bool ChangeKeyboard(KeyboardProvider keyboardProvider)
|
||||
/// <summary>
|
||||
/// Enables the given keyboard
|
||||
/// </summary>
|
||||
/// <param name="keyboardProvider"></param>
|
||||
public void EnableKeyboard(KeyboardProvider keyboardProvider)
|
||||
{
|
||||
ReleaseActiveKeyboard();
|
||||
|
||||
if (keyboardProvider == null)
|
||||
return false;
|
||||
return;
|
||||
|
||||
if (ActiveKeyboard != null)
|
||||
if (keyboardProvider.Name == ActiveKeyboard.Name)
|
||||
return true;
|
||||
|
||||
ReleaseActiveKeyboard();
|
||||
return;
|
||||
|
||||
// Disable everything if there's no active keyboard found
|
||||
if (!keyboardProvider.CanEnable())
|
||||
{
|
||||
MessageBox.Show(keyboardProvider.CantEnableText, "Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
ActiveKeyboard = keyboardProvider;
|
||||
@ -49,10 +62,11 @@ namespace Artemis.Managers
|
||||
|
||||
General.Default.LastKeyboard = ActiveKeyboard.Name;
|
||||
General.Default.Save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases the active keyboard
|
||||
/// </summary>
|
||||
public void ReleaseActiveKeyboard()
|
||||
{
|
||||
if (ActiveKeyboard == null)
|
||||
@ -61,5 +75,20 @@ namespace Artemis.Managers
|
||||
ActiveKeyboard.Disable();
|
||||
ActiveKeyboard = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the active keyboard
|
||||
/// </summary>
|
||||
/// <param name="keyboardProvider"></param>
|
||||
public void ChangeKeyboard(KeyboardProvider keyboardProvider)
|
||||
{
|
||||
if (keyboardProvider == ActiveKeyboard)
|
||||
return;
|
||||
|
||||
General.Default.LastKeyboard = keyboardProvider?.Name;
|
||||
General.Default.Save();
|
||||
|
||||
_mainManager.Restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ namespace Artemis.Managers
|
||||
|
||||
private readonly int _fps;
|
||||
private bool _paused;
|
||||
private bool _restarting;
|
||||
|
||||
public MainManager(IEventAggregator events)
|
||||
{
|
||||
@ -78,7 +79,8 @@ namespace Artemis.Managers
|
||||
return true;
|
||||
|
||||
// Only continue if a keyboard was loaded
|
||||
if (!KeyboardManager.LoadLastKeyboard())
|
||||
KeyboardManager.EnableLastKeyboard();
|
||||
if (KeyboardManager.ActiveKeyboard == null)
|
||||
return false;
|
||||
|
||||
Running = true;
|
||||
@ -128,6 +130,41 @@ namespace Artemis.Managers
|
||||
PauseCallback = null;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Stop();
|
||||
ProcessWorker.CancelAsync();
|
||||
GameStateWebServer.Stop();
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (_restarting)
|
||||
return;
|
||||
if (!Running)
|
||||
{
|
||||
Start();
|
||||
return;
|
||||
}
|
||||
|
||||
_restarting = true;
|
||||
|
||||
UpdateWorker.RunWorkerCompleted += FinishRestart;
|
||||
Stop();
|
||||
}
|
||||
|
||||
public void FinishRestart(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
UpdateWorker.RunWorkerCompleted -= FinishRestart;
|
||||
|
||||
if (e.Error != null)
|
||||
return;
|
||||
|
||||
Start();
|
||||
|
||||
_restarting = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the last active effect and starts the program
|
||||
/// </summary>
|
||||
@ -148,13 +185,6 @@ namespace Artemis.Managers
|
||||
Events.PublishOnUIThread(new ToggleEnabled(ProgramEnabled));
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Stop();
|
||||
ProcessWorker.CancelAsync();
|
||||
GameStateWebServer.Stop();
|
||||
}
|
||||
|
||||
#region Workers
|
||||
|
||||
private void UpdateWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
|
||||
220
Artemis/Artemis/Settings/General.Designer.cs
generated
220
Artemis/Artemis/Settings/General.Designer.cs
generated
@ -1,98 +1,122 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Settings {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class General : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static General defaultInstance = ((General)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new General())));
|
||||
|
||||
public static General Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("TypeWave")]
|
||||
public string LastEffect {
|
||||
get {
|
||||
return ((string)(this["LastEffect"]));
|
||||
}
|
||||
set {
|
||||
this["LastEffect"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 RGB")]
|
||||
public string LastKeyboard {
|
||||
get {
|
||||
return ((string)(this["LastKeyboard"]));
|
||||
}
|
||||
set {
|
||||
this["LastKeyboard"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool EnablePointersUpdate {
|
||||
get {
|
||||
return ((bool)(this["EnablePointersUpdate"]));
|
||||
}
|
||||
set {
|
||||
this["EnablePointersUpdate"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("51364")]
|
||||
public int GamestatePort {
|
||||
get {
|
||||
return ((int)(this["GamestatePort"]));
|
||||
}
|
||||
set {
|
||||
this["GamestatePort"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Autorun {
|
||||
get {
|
||||
return ((bool)(this["Autorun"]));
|
||||
}
|
||||
set {
|
||||
this["Autorun"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool Suspended {
|
||||
get {
|
||||
return ((bool)(this["Suspended"]));
|
||||
}
|
||||
set {
|
||||
this["Suspended"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Settings {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class General : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static General defaultInstance = ((General)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new General())));
|
||||
|
||||
public static General Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("TypeWave")]
|
||||
public string LastEffect {
|
||||
get {
|
||||
return ((string)(this["LastEffect"]));
|
||||
}
|
||||
set {
|
||||
this["LastEffect"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string LastKeyboard {
|
||||
get {
|
||||
return ((string)(this["LastKeyboard"]));
|
||||
}
|
||||
set {
|
||||
this["LastKeyboard"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool EnablePointersUpdate {
|
||||
get {
|
||||
return ((bool)(this["EnablePointersUpdate"]));
|
||||
}
|
||||
set {
|
||||
this["EnablePointersUpdate"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("51364")]
|
||||
public int GamestatePort {
|
||||
get {
|
||||
return ((int)(this["GamestatePort"]));
|
||||
}
|
||||
set {
|
||||
this["GamestatePort"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Autorun {
|
||||
get {
|
||||
return ((bool)(this["Autorun"]));
|
||||
}
|
||||
set {
|
||||
this["Autorun"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool Suspended {
|
||||
get {
|
||||
return ((bool)(this["Suspended"]));
|
||||
}
|
||||
set {
|
||||
this["Suspended"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool ShowOnStartup {
|
||||
get {
|
||||
return ((bool)(this["ShowOnStartup"]));
|
||||
}
|
||||
set {
|
||||
this["ShowOnStartup"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool CheckForUpdates {
|
||||
get {
|
||||
return ((bool)(this["CheckForUpdates"]));
|
||||
}
|
||||
set {
|
||||
this["CheckForUpdates"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,26 +1,30 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LastEffect" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">TypeWave</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastKeyboard" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Logitech G910 RGB</Value>
|
||||
</Setting>
|
||||
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="GamestatePort" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">51364</Value>
|
||||
</Setting>
|
||||
<Setting Name="Autorun" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="Suspended" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LastEffect" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">TypeWave</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastKeyboard" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="GamestatePort" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">51364</Value>
|
||||
</Setting>
|
||||
<Setting Name="Autorun" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="Suspended" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="ShowOnStartup" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="CheckForUpdates" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -38,6 +38,26 @@ namespace Artemis.Settings
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckForUpdates
|
||||
{
|
||||
get { return General.Default.CheckForUpdates; }
|
||||
set
|
||||
{
|
||||
if (General.Default.CheckForUpdates == value) return;
|
||||
General.Default.CheckForUpdates = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowOnStartup
|
||||
{
|
||||
get { return General.Default.ShowOnStartup; }
|
||||
set
|
||||
{
|
||||
if (General.Default.ShowOnStartup == value) return;
|
||||
General.Default.ShowOnStartup = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyGamestatePort()
|
||||
{
|
||||
// TODO: Restart Gamestate server with new port
|
||||
@ -71,6 +91,8 @@ namespace Artemis.Settings
|
||||
GamestatePort = 51364;
|
||||
EnablePointersUpdate = true;
|
||||
Autorun = true;
|
||||
CheckForUpdates = true;
|
||||
ShowOnStartup = true;
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
@ -38,7 +38,15 @@ namespace Artemis.ViewModels.Flyouts
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
public BindableCollection<string> KeyboardProviders
|
||||
=> new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders.Select(k => k.Name));
|
||||
{
|
||||
get
|
||||
{
|
||||
var collection = new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders
|
||||
.Select(k => k.Name));
|
||||
collection.Insert(0, "None");
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
|
||||
public string SelectedKeyboardProvider
|
||||
{
|
||||
@ -52,7 +60,8 @@ namespace Artemis.ViewModels.Flyouts
|
||||
return;
|
||||
|
||||
MainManager.KeyboardManager.ChangeKeyboard(
|
||||
MainManager.KeyboardManager.KeyboardProviders.First(k => k.Name == _selectedKeyboardProvider));
|
||||
MainManager.KeyboardManager.KeyboardProviders.FirstOrDefault(
|
||||
k => k.Name == _selectedKeyboardProvider));
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +108,9 @@ namespace Artemis.ViewModels.Flyouts
|
||||
|
||||
protected override void HandleOpen()
|
||||
{
|
||||
SelectedKeyboardProvider = MainManager.KeyboardManager.ActiveKeyboard?.Name;
|
||||
SelectedKeyboardProvider = MainManager.KeyboardManager.ActiveKeyboard != null
|
||||
? MainManager.KeyboardManager.ActiveKeyboard.Name
|
||||
: "None";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -47,5 +47,10 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
Flyouts.First().IsOpen = !Flyouts.First().IsOpen;
|
||||
}
|
||||
|
||||
public void CloseSettings()
|
||||
{
|
||||
Flyouts.First().IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,7 @@
|
||||
<ResourceDictionary
|
||||
Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
|
||||
</Grid.Resources>
|
||||
<TabControl Margin="0,10,10,10" TabStripPlacement="Left" x:Name="Items">
|
||||
<TabControl Margin="0,10,10,10" TabStripPlacement="Left" x:Name="Items" cal:Message.Attach="[Event GotFocus] = [Action CloseSettings]">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DisplayName}" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user