⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 variableassignmentdialog.cs

📁 EpiInfo 开源的导航系统远程序,不知道在哪里下的了,分享一下,有兴趣的
💻 CS
字号:
#region //Namespaces
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Epi;
using Epi.Windows.Dialogs;

#endregion //Namespaces

namespace Epi.Windows.MakeView.Dialogs.CheckCodeCommandDialogs
{
	/// <summary>
	/// ***** This is a wireframe and currently contains no functionality *****
	/// </summary>
    public partial class VariableAssignmentDialog : CheckCodeDesignDialog
    {
        #region Constructors
        
        /// <summary>
        /// Constructor for the class
		/// </summary>
        [Obsolete("Use of default constructor not allowed", true)]
		public VariableAssignmentDialog()
		{
			InitializeComponent();
		}

        /// <summary>
        /// Constructor for the Variable Assignment dialog
        /// </summary>
        /// <param name="frm">The main form</param>
		public VariableAssignmentDialog(MainForm frm) : base(frm)
        {
            InitializeComponent();
        }

        #endregion  //Constructors

        #region Public Properties
        /// <summary>
        /// Sets the View for the dialog
        /// </summary>
        public override View View
        {
            set
            {
                foreach (Fields.Field field in value.Fields)
                {
                    if (field is Fields.RenderableField && !(field is Fields.LabelField))
                    {
                        cbxAvailVariables.Items.Add(field.Name);
                        cbxAssignVariable.Items.Add(field.Name);
                    }
                }
            }
        }
        #endregion  //Public Properties

        #region Private Event Handlers

        /// <summary>
		/// Cancel button closes this dialog 
		/// </summary>
		/// <param name="sender">Object that fired the event</param>
		/// <param name="e">.NET supplied event parameters</param>
		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
    
        /// <summary>
        /// Handles the Click event of the OK button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            Output = "ASSIGN " + cbxAssignVariable.SelectedItem.ToString() + " = " + txtAssignment.Text;
            this.DialogResult = DialogResult.OK;
            this.Hide();
        }

        /// <summary>
        /// Handles the Click event of the Plus Sign button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnPlus_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("+ ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Minus Sign button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnMinus_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("- ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Multiplication button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnTimes_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("* ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Division Sign button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnDivide_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("/ ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Equal sign button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnEqual_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("= ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Less Than button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnLess_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("< ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Greater Than button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnGreat_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("> ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Ampersand button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnAmp_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("& ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Double Quotes button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnQuote_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("\" ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Open Parenthesis button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnOpenParen_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("( ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Close Parenthesis button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnCloseParen_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText(") ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the And button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnAnd_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("AND ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Or button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnOr_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText("OR ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Yes button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnYes_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText(Configuration.GetNewInstance().Settings.RepresentationOfYes + " ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the No button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnNo_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText(Configuration.GetNewInstance().Settings.RepresentationOfNo + " ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Missing button
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnMissing_Click(object sender, EventArgs e)
        {
            txtAssignment.AppendText(Configuration.GetNewInstance().Settings.RepresentationOfMissing + " ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Index Change event of the available variables combobox
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void cbxAvailVariables_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtAssignment.AppendText(cbxAvailVariables.SelectedItem.ToString() + " ");
            txtAssignment.Focus();
        }

        /// <summary>
        /// Handles the Index Change event of the assigned variables combobox
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void cbxAssignVariable_SelectedIndexChanged(object sender, EventArgs e)
        {
            OnAssignmentOrVariableChanged();
        }

        /// <summary>
        /// Handles the Text Changed event of the assignment textbox
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void txtAssignment_TextChanged(object sender, EventArgs e)
        {
            OnAssignmentOrVariableChanged();
        }

        #endregion  //Private Event Handlers

        #region Private Methods

        /// <summary>
        /// Enables or disables OK button depending upon selection and/or entry
        /// </summary>
        private void OnAssignmentOrVariableChanged()
        {
            btnOk.Enabled = (cbxAssignVariable.SelectedItem != null && !string.IsNullOrEmpty(txtAssignment.Text));
        }

        #endregion  //Private Methods
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -