public frmMiniPlayer(ControlPanel ControlPanel, bool Radio) { this.Cursor = Cursors.Hand; this.Opacity = TRANSPARENT; this.radio = Radio; Rectangle r = new Rectangle(DefaultLocation, Styles.BitmapMiniPlayer.Size); r = Lib.MakeVisible(r); this.Bounds = r; this.Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 5, 5)); controller = Controller.GetInstance(); controlPanel = ControlPanel; controlPanel.Subscribe(this); exitRect = new Rectangle(EXIT, TOP, WIDTH, HEIGHT); backRect = new Rectangle(BACK, TOP, EXTRA_WIDTH, HEIGHT); playPauseRect = new Rectangle(PLAY_PAUSE, TOP, HEIGHT, WIDTH); nextRect = new Rectangle(NEXT, TOP, EXTRA_WIDTH, HEIGHT); muteRect = new Rectangle(MUTE, TOP, WIDTH, HEIGHT); volUpRect = new Rectangle(VOL, TOP, WIDTH, HEIGHT / 2); volDownRect = new Rectangle(VOL, TOP + HEIGHT / 2, WIDTH, HEIGHT / 2); timeRect = new Rectangle(TIME, 0, this.ClientRectangle.Width - TIME - 4, this.ClientRectangle.Height - 2); WinAudioLib.VolumeChanged += volUpdate; instance = this; }
protected override void OnFormClosing(FormClosingEventArgs e) { WinAudioLib.VolumeChanged -= volUpdate; DefaultLocation = this.Location; base.OnFormClosing(e); controlPanel.Unsubscribe(); instance = null; }
public void Unsubscribe() { miniPlayer = null; }
public void Subscribe(frmMiniPlayer MiniPlayer) { miniPlayer = MiniPlayer; miniPlayer.Stopped = stopped; miniPlayer.Muted = muted; }