Example #1
0
 public virtual void InitializeComponent(ICore core)
 {
     this.Output = core.Components.Output;
     this.Output.IsStartedChanged += this.OnIsStartedChanged;
     this.Configuration            = core.Components.Configuration;
     this.ScalingFactor            = this.Configuration.GetElement <DoubleConfigurationElement>(
         WindowsUserInterfaceConfiguration.SECTION,
         WindowsUserInterfaceConfiguration.UI_SCALING_ELEMENT
         );
     this.ScalingFactor.ValueChanged += this.OnScalingFactorChanged;
 }
 public override void InitializeComponent(ICore core)
 {
     this.Configuration = core.Components.Configuration;
     this.BaseUrl       = this.Configuration.GetElement <TextConfigurationElement>(
         ChartLyricsProviderConfiguration.SECTION,
         ChartLyricsProviderConfiguration.BASE_URL
         );
     this.MinConfidence = this.Configuration.GetElement <DoubleConfigurationElement>(
         ChartLyricsProviderConfiguration.SECTION,
         ChartLyricsProviderConfiguration.MIN_CONFIDENCE
         );
     base.InitializeComponent(core);
 }
Example #3
0
 public override void InitializeComponent(ICore core)
 {
     base.InitializeComponent(core);
     this.EnabledElement = this.Configuration.GetElement <BooleanConfigurationElement>(
         BassOutputConfiguration.SECTION,
         BassOutputConfiguration.VOLUME_ENABLED_ELEMENT
         );
     this.EnabledElement.ValueChanged += this.OnEnabledChanged;
     this.ValueElement = this.Configuration.GetElement <DoubleConfigurationElement>(
         BassOutputConfiguration.SECTION,
         BassOutputConfiguration.VOLUME_ELEMENT
         );
     this.ValueElement.ValueChanged += this.OnValueChanged;
 }
Example #4
0
 public override void InitializeComponent(ICore core)
 {
     this.Configuration = core.Components.Configuration;
     this.WidthElement  = this.Configuration.GetElement <DoubleConfigurationElement>(
         BassOutputConfiguration.SECTION,
         BassParametricEqualizerStreamComponentConfiguration.BANDWIDTH
         );
     this.WidthElement.ValueChanged += this.OnWidthChanged;
     this.ValueElement = this.Configuration.GetElement <DoubleConfigurationElement>(
         BassOutputConfiguration.SECTION,
         this.Id
         );
     this.ValueElement.ValueChanged += this.OnValueChanged;
     base.InitializeComponent(core);
 }
Example #5
0
        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)
                {
                    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);
        }
        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);
        }