📄 optionsdialog.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace kae.OracleServiceManager
{
/// <summary>
/// Interface to application options
/// </summary>
public class OptionsDialog : System.Windows.Forms.Form
{
private System.Windows.Forms.Label pollingLabel;
private System.Windows.Forms.NumericUpDown pollingInterval;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.CheckBox verifyActions;
private System.ComponentModel.Container components = null;
private OsmResources _resources;
public OptionsDialog( int pollingInterval, bool verifyActions)
{
_resources = OracleServiceManager.Instance.Resources;
InitializeComponent();
this.pollingInterval.Value = pollingInterval;
this.verifyActions.Checked = verifyActions;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
public int PollingInterval
{
get { return Convert.ToInt32( pollingInterval.Value); }
}
public bool VerifyServiceActions
{
get { return verifyActions.Checked; }
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pollingLabel = new System.Windows.Forms.Label();
this.verifyActions = new System.Windows.Forms.CheckBox();
this.pollingInterval = new System.Windows.Forms.NumericUpDown();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pollingInterval)).BeginInit();
this.SuspendLayout();
//
// pollingLabel
//
this.pollingLabel.AutoSize = true;
this.pollingLabel.Location = new System.Drawing.Point(8, 20);
this.pollingLabel.Name = "pollingLabel";
this.pollingLabel.Size = new System.Drawing.Size(134, 13);
this.pollingLabel.TabIndex = 0;
this.pollingLabel.Text = GetStringFromResources( "PollingInterval");
this.pollingLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pollingInterval
//
this.pollingInterval.Location = new System.Drawing.Point(172, 16);
this.pollingInterval.Name = "pollingInterval";
this.pollingInterval.Size = new System.Drawing.Size(56, 20);
this.pollingInterval.TabIndex = 1;
//
// verifyActions
//
this.verifyActions.Location = new System.Drawing.Point(8, 48);
this.verifyActions.Name = "verifyActions";
this.verifyActions.Size = new System.Drawing.Size(220, 20);
this.verifyActions.TabIndex = 2;
this.verifyActions.Text = GetStringFromResources( "VerifyAction");
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(128, 88);
this.okButton.Name = "okButton";
this.okButton.TabIndex = 3;
this.okButton.Text = GetAppString( "OK");
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(212, 88);
this.cancelButton.Name = "cancelButton";
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = GetAppString( "Cancel");
//
// OptionsDialog
//
this.AcceptButton = this.okButton;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(294, 118);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.cancelButton,
this.okButton,
this.verifyActions,
this.pollingInterval,
this.pollingLabel});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OptionsDialog";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = GetStringFromResources( "Title");
this.Load += new EventHandler( this.OnLoad);
((System.ComponentModel.ISupportInitialize)(this.pollingInterval)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void OnLoad( object sender, EventArgs e)
{
pollingInterval.Select( 0, pollingInterval.Value.ToString().Length);
}
private string GetStringFromResources( string name)
{
return _resources.GetString( typeof(OptionsDialog), name);
}
private string GetAppString( string name)
{
return _resources.GetAppString( name);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -