示例#1
0
        private void InitializeShellWindow()
        {
            // Start monitoring tablet mode
            this.windowsIntegrationService.StartMonitoringTabletMode();

            // Tray controls
            this.trayControls = this.container.Resolve <TrayControls>();

            // Create the Mini Player playlist
            this.miniPlayerPlaylist = this.container.Resolve <MiniPlayerPlaylist>(new DependencyOverride(typeof(DopamineWindow), this));

            // NotificationService needs to know about the application windows
            this.notificationService.SetApplicationWindows(this, this.miniPlayerPlaylist, this.trayControls);

            // Settings changed
            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Appearance", "ShowWindowBorder"))
                {
                    this.SetWindowBorder((bool)e.SettingValue);
                }

                if (SettingsClient.IsSettingChanged(e, "Behaviour", "ShowTrayIcon"))
                {
                    this.trayIcon.Visible = (bool)e.SettingValue;
                }
            };

            // Make sure the window geometry respects tablet mode at startup
            this.CheckIfTabletMode();
        }
示例#2
0
        private void InitializeWindows()
        {
            // Start monitoring tablet mode
            this.windowsIntegrationService.StartMonitoringTabletMode();

            // Tray controls
            this.trayControls = this.container.Resolve <TrayControls>();

            // Create the Mini Player playlist
            this.miniPlayerPlaylist = this.container.Resolve <Func <BorderlessWindows10Window, MiniPlayerPlaylist> >()(this);

            // NotificationService needs to know about the application windows
            this.notificationService.SetApplicationWindows(this, this.miniPlayerPlaylist, this.trayControls);

            // Settings changed
            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Appearance", "ShowWindowBorder"))
                {
                    this.WindowBorder.BorderThickness = new Thickness((bool)e.SettingValue ? 1 : 0);
                }

                if (SettingsClient.IsSettingChanged(e, "Behaviour", "ShowTrayIcon"))
                {
                    this.trayIcon.Visible = (bool)e.SettingValue;
                }
            };

            this.shellService.WindowStateChangeRequested += (_, e) => this.WindowState = e.WindowState;
            this.shellService.IsMovableChangeRequested   += (_, e) => this.IsMovable = e.IsMovable;
            this.shellService.ResizeModeChangeRequested  += (_, e) => this.ResizeMode = e.ResizeMode;
            this.shellService.TopmostChangeRequested     += (_, e) => this.Topmost = e.IsTopmost;

            this.shellService.GeometryChangeRequested += (_, e) => this.SetGeometry(
                e.Top, e.Left, e.Size.Width, e.Size.Height,
                Constants.DefaultShellTop,
                Constants.DefaultShellLeft);

            this.shellService.MinimumSizeChangeRequested += (_, e) =>
            {
                this.MinWidth  = e.MinimumSize.Width;
                this.MinHeight = e.MinimumSize.Height;
            };

            this.shellService.PlaylistVisibilityChangeRequested += (_, e) =>
            {
                if (e.IsPlaylistVisible)
                {
                    this.miniPlayerPlaylist.Show(e.MiniPlayerType);
                }
                else
                {
                    this.miniPlayerPlaylist.Hide();
                }
            };

            this.shellService.CheckIfTabletMode(true); // Make sure the window geometry respects tablet mode at startup
            this.SetWindowBorder();
        }
示例#3
0
        private void InitializeWindows()
        {
            // Start monitoring tablet mode
            this.windowsIntegrationService.StartMonitoringTabletMode();

            // Tray controls
            this.trayControls = this.container.Resolve <TrayControls>();

            // Create the Mini Player playlist
            this.miniPlayerPlaylist = this.container.Resolve <MiniPlayerPlaylist>(new DependencyOverride(typeof(DopamineWindow), this));

            // NotificationService needs to know about the application windows
            this.notificationService.SetApplicationWindows(this, this.miniPlayerPlaylist, this.trayControls);

            PART_MiniPlayerButton.ToolTip = SettingsClient.Get <bool>("General", "IsMiniPlayer") ? ResourceUtils.GetString("Language_Restore") : ResourceUtils.GetString("Language_Mini_Player");

            // Settings changed
            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Appearance", "ShowWindowBorder"))
                {
                    this.WindowBorder.BorderThickness = new Thickness((bool)e.SettingValue ? 1 : 0);
                }

                if (SettingsClient.IsSettingChanged(e, "Behaviour", "ShowTrayIcon"))
                {
                    this.trayIcon.Visible = (bool)e.SettingValue;
                }

                if (SettingsClient.IsSettingChanged(e, "General", "IsMiniPlayer"))
                {
                    PART_MiniPlayerButton.ToolTip = (bool)e.SettingValue ? ResourceUtils.GetString("Language_Restore") : ResourceUtils.GetString("Language_Mini_Player");
                }
            };

            this.shellService.WindowStateChanged        += (_, e) => this.WindowState = e.WindowState;
            this.shellService.IsMovableChanged          += (_, e) => this.IsMovable = e.IsMovable;
            this.shellService.ResizeModeChanged         += (_, e) => this.ResizeMode = e.ResizeMode;
            this.shellService.TopmostChanged            += (_, e) => this.Topmost = e.IsTopmost;
            this.shellService.ShowWindowControlsChanged += (_, e) => this.ShowWindowControls = e.ShowWindowControls;

            this.shellService.GeometryChanged += (_, e) => this.SetGeometry(
                e.Top, e.Left, e.Size.Width, e.Size.Height,
                Constants.DefaultShellTop,
                Constants.DefaultShellLeft);

            this.shellService.MinimumSizeChanged += (_, e) =>
            {
                this.MinWidth  = e.MinimumSize.Width;
                this.MinHeight = e.MinimumSize.Height;
            };

            this.shellService.PlaylistVisibilityChanged += (_, e) =>
            {
                if (e.IsPlaylistVisible)
                {
                    this.miniPlayerPlaylist.Show(e.MiniPlayerType);
                }
                else
                {
                    this.miniPlayerPlaylist.Hide();
                }
            };

            this.shellService.CheckIfTabletMode(true); // Make sure the window geometry respects tablet mode at startup
            this.SetWindowBorder();
        }