Exemplo n.º 1
0
        /// <summary>
        /// Binds the <see cref="InterfaceScaler"/> to a <see cref="TimerWindow"/>.
        /// </summary>
        /// <param name="window">A <see cref="TimerWindow"/>.</param>
        public void Bind(TimerWindow window)
        {
            // Validate parameters
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }

            // Validate state
            if (this.timerWindow != null)
            {
                throw new InvalidOperationException();
            }

            // Initialize members
            this.timerWindow = window;

            this.innerGrid               = this.timerWindow.InnerGrid;
            this.controlsPanel           = this.timerWindow.ControlsPanel;
            this.timerTextBox            = this.timerWindow.TimerTextBox;
            this.titleTextBox            = this.timerWindow.TitleTextBox;
            this.innerNotificationBorder = this.timerWindow.InnerNotificationBorder;
            this.buttons = new[]
            {
                this.timerWindow.StartButton,
                this.timerWindow.PauseButton,
                this.timerWindow.ResumeButton,
                this.timerWindow.StopButton,
                this.timerWindow.ResetButton,
                this.timerWindow.CloseButton,
                this.timerWindow.CancelButton
            };
            this.timeExpiredLabel = this.timerWindow.TimeExpiredLabel;

            // Hook up events
            this.timerWindow.Loaded          += (s, e) => this.Scale();
            this.timerWindow.SizeChanged     += (s, e) => this.Scale();
            this.timerWindow.PropertyChanged += (s, e) => this.Scale();
            this.timerTextBox.TextChanged    += (s, e) => this.Scale();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Binds the <see cref="InterfaceScaler"/> to a <see cref="TimerWindow"/>.
        /// </summary>
        /// <param name="window">A <see cref="TimerWindow"/>.</param>
        public void Bind(TimerWindow window)
        {
            // Validate parameters
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }

            // Validate state
            if (this.timerWindow != null)
            {
                throw new InvalidOperationException();
            }

            // Initialize members
            this.timerWindow = window;

            this.innerGrid = this.timerWindow.InnerGrid;
            this.controlsPanel = this.timerWindow.ControlsPanel;
            this.timerTextBox = this.timerWindow.TimerTextBox;
            this.titleTextBox = this.timerWindow.TitleTextBox;
            this.innerNotificationBorder = this.timerWindow.InnerNotificationBorder;
            this.buttons = new[]
            {
                this.timerWindow.StartButton,
                this.timerWindow.PauseButton,
                this.timerWindow.ResumeButton,
                this.timerWindow.StopButton,
                this.timerWindow.ResetButton,
                this.timerWindow.CloseButton,
                this.timerWindow.CancelButton
            };
            this.timeExpiredLabel = this.timerWindow.TimeExpiredLabel;

            // Hook up events
            this.timerWindow.Loaded += (s, e) => this.Scale();
            this.timerWindow.SizeChanged += (s, e) => this.Scale();
            this.timerWindow.PropertyChanged += (s, e) => this.Scale();
            this.timerTextBox.TextChanged += (s, e) => this.Scale();
        }