Ejemplo n.º 1
0
        /// <summary>
        /// When media window closes - save it changes.
        /// </summary>
        void mediaWindow_Closed(object sender, EventArgs e)
        {
            Settings.Default.MediaLeft   = this.mediaWindow.Left;
            Settings.Default.MediaTop    = this.mediaWindow.Top;
            Settings.Default.MediaWidth  = this.mediaWindow.ActualWidth;
            Settings.Default.MediaHeight = this.mediaWindow.ActualHeight;

            Settings.Default.Save();

            this.mediaWindow = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create window for show video.
        /// </summary>
        private void CreateMediaWindow()
        {
            if (this.mediaWindow == null)
            {
                this.mediaWindow = new MediaWindow()
                {
                    LibraryManager = this
                };
                this.mediaWindow.WindowStartupLocation = WindowStartupLocation.Manual;

                this.mediaWindow.Left = -10000;
                this.mediaWindow.Top  = -10000;

                this.mediaWindow.Show();
                this.mediaWindow.Hide();
                //this.mediaWindow.Owner = this.GetWindowHostControl();

                if (Settings.Default.MediaLeft == -1 || Settings.Default.MediaTop == -1 || Settings.Default.MediaWidth == -1 || Settings.Default.MediaHeight == -1)
                {
                    this.mediaWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    this.mediaWindow.Left = (Screen.PrimaryScreen.WorkingArea.Width - this.mediaWindow.ActualWidth) / 2;
                    this.mediaWindow.Top  = (Screen.PrimaryScreen.WorkingArea.Height - this.mediaWindow.ActualHeight) / 2;
                }
                else
                {
                    this.mediaWindow.WindowStartupLocation = WindowStartupLocation.Manual;
                    this.mediaWindow.Left   = Settings.Default.MediaLeft;
                    this.mediaWindow.Top    = Settings.Default.MediaTop;
                    this.mediaWindow.Width  = Settings.Default.MediaWidth;
                    this.mediaWindow.Height = Settings.Default.MediaHeight;
                }

                this.mediaWindow.OnMediaOpened     += mediaWindow_OnMediaOpened;
                this.mediaWindow.OnPositionChanged += mediaWindow_OnPositionChanged;
                this.mediaWindow.Closed            += new EventHandler(mediaWindow_Closed);
                this.mediaWindow.OnMediaEnded      += new EventHandler(mediaWindow_OnMediaEnded);

                this.mediaWindow.Volume = this.volumeSlider.Value;
            }
            else
            {
                this.mediaWindow.Focus();
            }
        }