コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScreenSaver"/> class using the given screen saver configuration.
        /// </summary>
        /// <param name="screenSaverConfiguration">The configuration of the screen saver.</param>
        /// <exception cref="ArgumentNullException"><c>screenSaverConfiguration</c> is null.</exception>
        /// <exception cref="ArgumentNullException">A member of <c>screenSaverConfiguration</c> is null.</exception>
        public ScreenSaver(IScreenSaverConfiguration screenSaverConfiguration)
        {
            if (screenSaverConfiguration == null)
            {
                throw new ArgumentNullException("screenSaverConfiguration");
            }

            if (screenSaverConfiguration.ScreenSaverName == null)
            {
                throw new ArgumentNullException("IScreenSaverConfiguration.ScreenSaverName");
            }

            this.translation = new ScreenSaverTranslation(CultureInfo.CurrentCulture.TwoLetterISOLanguageName);
            this.screenSaverConfiguration = screenSaverConfiguration;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationForm"/> class.
        /// </summary>
        /// <param name="translation">The translation provider.</param>
        /// <param name="configurationControl">The <see cref="ConfigurationControl"/> that shall be displayed.</param>
        public ConfigurationForm(ScreenSaverTranslation translation, ConfigurationControl configurationControl)
        {
            this.InitializeComponent();
            this.translation          = translation;
            this.configurationControl = configurationControl;

            this.ClientSize = new System.Drawing.Size(
                configurationControl.Width + this.tableLayoutPanel.Margin.Left + this.tableLayoutPanel.Margin.Right,
                configurationControl.Height + this.flowLayoutPanel.Height + this.tableLayoutPanel.Margin.Top + this.tableLayoutPanel.Margin.Bottom);

            this.tableLayoutPanel.Controls.Add(configurationControl, 0, 0);
            configurationControl.Dock = DockStyle.Fill;

            this.buttonOk.Text     = translation.OkButtonTranslation;
            this.buttonCancel.Text = translation.CancelButtonTranslation;
        }