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

📄 ifclausedialog.cs

📁 EpiInfo 开源的导航系统远程序,不知道在哪里下的了,分享一下,有兴趣的
💻 CS
📖 第 1 页 / 共 2 页
字号:
#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 IfClauseDialog : CheckCodeDesignDialog
	{
        #region Fields
        private CommandContextMenuType CurrentContextMenuType;
        private View view;
        #endregion  //Fields

        #region Constructors

        /// <summary>
		/// Constructor for the class
		/// </summary>
        [Obsolete("Use of default constructor not allowed", true)]
		public IfClauseDialog()
		{
			InitializeComponent();
		}

        /// <summary>
        /// Constructor for If Clause dialog
        /// </summary>
        /// <param name="frm">The main form</param>
		public IfClauseDialog(MainForm frm) : base(frm)
        {
            InitializeComponent();
        }

        #endregion  //Constructors

        #region Public Properties

        /// <summary>
        /// Sets the View for the dialog
        /// </summary>
        public override View View
        {
            set
            {
                this.view = value;
                foreach (Fields.Field field in value.Fields)
                {
                    if (field is Fields.RenderableField && !(field is Fields.LabelField))
                    {
                        cbxVariables.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)
        {
            System.Text.StringBuilder thenBlockBuilder = new System.Text.StringBuilder();
            foreach (string line in txtThen.Lines)
            {
                thenBlockBuilder.Append("    ");
                thenBlockBuilder.Append(line);
                thenBlockBuilder.Append(Environment.NewLine);
            }
            System.Text.StringBuilder elseBlockBuilder = new System.Text.StringBuilder();
            foreach (string line in txtElse.Lines)
            {
                elseBlockBuilder.Append("    ");
                elseBlockBuilder.Append(line);
                elseBlockBuilder.Append(Environment.NewLine);
            }
            System.Text.StringBuilder outputBuilder = new System.Text.StringBuilder();
            outputBuilder.Append(CommandNames.IF + StringLiterals.SPACE);
//          outputBuilder.Append("IF ");
            outputBuilder.Append(txtCondition.Text);
            outputBuilder.Append(StringLiterals.SPACE + CommandNames.THEN + StringLiterals.SPACE);
//            outputBuilder.Append(" THEN ");
            outputBuilder.Append(Environment.NewLine);
            outputBuilder.Append(thenBlockBuilder.ToString());
            if (txtElse.Lines.Length > 0)
            {
                outputBuilder.Append(CommandNames.ELSE);
//              outputBuilder.Append("ELSE");
                outputBuilder.Append(Environment.NewLine);
                outputBuilder.Append(elseBlockBuilder.ToString());
            }
            outputBuilder.Append(CommandNames.END);
//            outputBuilder.Append("END");
            Output = outputBuilder.ToString();
            this.DialogResult = DialogResult.OK;
            this.Hide();
        }

        /// <summary>
        /// Handles the Text Change event of the Condition textbox
        /// </summary>
        /// <param name="sender">Object that fired the event </param>
        /// <param name="e">.NET supplied event parameters</param>
        private void txtCondition_TextChanged(object sender, EventArgs e)
        {
            btnOk.Enabled = (txtCondition.Text.Length > 0 && txtThen.Text.Length > 0);
        }

        /// <summary>
        /// Handles the Text Change event of the Then textbox
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void txtThen_TextChanged(object sender, EventArgs e)
        {
            btnOk.Enabled = (txtCondition.Text.Length > 0 && txtThen.Text.Length > 0);
        }

        /// <summary>
        /// Handles the Text Change event of the Else textbox
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void txtElse_TextChanged(object sender, EventArgs e)
        {
            btnOk.Enabled = (txtCondition.Text.Length > 0 && txtThen.Text.Length > 0);
        }

        /// <summary>
        /// Handles the Click event of the Plus 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)
        {
            txtCondition.AppendText("+ ");
            txtCondition.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Minus 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)
        {
            txtCondition.AppendText("- ");
            txtCondition.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)
        {
            txtCondition.AppendText("* ");
            txtCondition.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Divide 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)
        {
            txtCondition.AppendText("/ ");
            txtCondition.Focus();
        }

        /// <summary>
        /// Handles the Click event of the Equal 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)
        {
            txtCondition.AppendText("= ");
            txtCondition.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)
        {
            txtCondition.AppendText("< ");
            txtCondition.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)
        {
            txtCondition.AppendText("> ");
            txtCondition.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)
        {
            txtCondition.AppendText("& ");
            txtCondition.Focus();
        }

        /// <summary>
        /// Handles the Click event of the double quotes mark 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)
        {
            txtCondition.AppendText("\" ");
            txtCondition.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)
        {
            txtCondition.AppendText("( ");
            txtCondition.Focus();
        }

        /// <summary>
        /// Handles the Click event of the closed 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)
        {
            txtCondition.AppendText(") ");

⌨️ 快捷键说明

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