protected virtual Task Reset() { return(Windows.Invoke(() => this.CalculateTileSize(this.Width, this.Height))); }
protected virtual Task Quit() { return(Windows.Shutdown()); }
protected override void OnCancellationRequested() { var task = Windows.Invoke(() => this.Behaviour.IsDesigning = false); base.OnCancellationRequested(); }
public override void InitializeComponent(ICore core) { 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 => { if (value) { await this.Enable().ConfigureAwait(false); } else { await this.Disable().ConfigureAwait(false); } if (this.IsInitialized) { #if NET40 await TaskEx.Run(() => this.Configuration.Save()).ConfigureAwait(false); #else await Task.Run(() => this.Configuration.Save()).ConfigureAwait(false); #endif } }); 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); }