public override void InitializeComponent(ICore core) { this.ThemeLoader = ComponentRegistry.Instance.GetComponent <ThemeLoader>(); this.Core = core; this.Configuration = core.Components.Configuration; this.Topmost = this.Configuration.GetElement <BooleanConfigurationElement>( MiniPlayerBehaviourConfiguration.SECTION, MiniPlayerBehaviourConfiguration.TOPMOST_ELEMENT ); this.Topmost.ConnectValue(value => { if (Windows.IsMiniWindowCreated) { Windows.Invoke(() => Windows.MiniWindow.Topmost = value); } }); this.Enabled = this.Configuration.GetElement <BooleanConfigurationElement>( MiniPlayerBehaviourConfiguration.SECTION, MiniPlayerBehaviourConfiguration.ENABLED_ELEMENT ); this.Enabled.ConnectValue(async value => { //TODO: This code is actually responsible for creating the main application window, //TODO: It should really be WindowsUserInterface.Show(). //Ensure resources are loaded. ThemeLoader.EnsureTheme(); if (value) { await this.Enable().ConfigureAwait(false); } else { await this.Disable().ConfigureAwait(false); } if (this.IsInitialized) { this.Configuration.Save(); } }); this.ShowArtwork = this.Configuration.GetElement <BooleanConfigurationElement>( MiniPlayerBehaviourConfiguration.SECTION, MiniPlayerBehaviourConfiguration.SHOW_ARTWORK_ELEMENT ); this.ShowPlaylist = this.Configuration.GetElement <BooleanConfigurationElement>( MiniPlayerBehaviourConfiguration.SECTION, MiniPlayerBehaviourConfiguration.SHOW_PLAYLIST_ELEMENT ); this.ScalingFactor = this.Configuration.GetElement <DoubleConfigurationElement>( WindowsUserInterfaceConfiguration.SECTION, WindowsUserInterfaceConfiguration.UI_SCALING_ELEMENT ); if (this.ScalingFactor != null) { this.ScalingFactor.ConnectValue(value => { if (this.IsInitialized && Windows.IsMiniWindowCreated && Windows.MiniWindow.SizeToContent == SizeToContent.WidthAndHeight) { //Auto size goes to shit when the scaling factor is changed. Windows.MiniWindow.SizeToContent = SizeToContent.Manual; Windows.MiniWindow.Width = 0; Windows.MiniWindow.Height = 0; Windows.MiniWindow.SizeToContent = SizeToContent.WidthAndHeight; } }); } base.InitializeComponent(core); }