Exemplo n.º 1
0
		/// <summary>
		/// Brings up a UI for the user to edit a cusotm enum.
		/// </summary>
		/// <param name="enumValues">The existing collection of Enum values to edit.</param>
		/// <returns>True if the user accepted changes to the Enum values.</returns>
		public static bool EditEnum(List<string> enumValues)
		{
			EditCustomEnumOrDescription frm = new EditCustomEnumOrDescription();
			frm.Text = "Edit Custom Enum";
			frm._allowNewLineCharacters = true;
			foreach (string enm in enumValues)
			{
				frm.tbxValues.Text += enm + Environment.NewLine;
			}
			if (frm.tbxValues.TextLength > 0)
			{
				frm.tbxValues.Text = frm.tbxValues.Text.Substring(0, frm.tbxValues.Text.LastIndexOf(Environment.NewLine));
			}
			DialogResult rslt = frm.ShowDialog();
			if (rslt == DialogResult.OK)
			{
				enumValues.Clear();
				foreach (string line in frm.tbxValues.Lines)
				{
					enumValues.Add(line);
				}
				return true;
			}
			return false;
		}
        /// <summary>
        /// Brings up a UI for the user to edit a cusotm enum.
        /// </summary>
        /// <param name="enumValues">The existing collection of Enum values to edit.</param>
        /// <returns>True if the user accepted changes to the Enum values.</returns>
        public static bool EditEnum(List <string> enumValues)
        {
            EditCustomEnumOrDescription frm = new EditCustomEnumOrDescription();

            frm.Text = "Edit Custom Enum";
            frm._allowNewLineCharacters = true;
            foreach (string enm in enumValues)
            {
                frm.tbxValues.Text += enm + Environment.NewLine;
            }
            if (frm.tbxValues.TextLength > 0)
            {
                frm.tbxValues.Text = frm.tbxValues.Text.Substring(0, frm.tbxValues.Text.LastIndexOf(Environment.NewLine));
            }
            DialogResult rslt = frm.ShowDialog();

            if (rslt == DialogResult.OK)
            {
                enumValues.Clear();
                foreach (string line in frm.tbxValues.Lines)
                {
                    enumValues.Add(line);
                }
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Brings up a UI for the user to edit a description.
        /// </summary>
        /// <param name="desc">The existing description to edit.</param>
        /// <returns>True if the user accepted changes to the description.</returns>
        public static bool EditDescription(ref string desc)
        {
            EditCustomEnumOrDescription frm = new EditCustomEnumOrDescription();

            frm.Text = "Edit Description";
            frm._allowNewLineCharacters = false;
            frm.tbxValues.Text          = desc;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                desc = frm.tbxValues.Text;
                return(true);
            }
            return(false);
        }
Exemplo n.º 4
0
		/// <summary>
		/// Brings up a UI for the user to edit a description.
		/// </summary>
		/// <param name="desc">The existing description to edit.</param>
		/// <returns>True if the user accepted changes to the description.</returns>
		public static bool EditDescription(ref string desc)
		{
			EditCustomEnumOrDescription frm = new EditCustomEnumOrDescription();
			frm.Text = "Edit Description";
			frm._allowNewLineCharacters = false;
			frm.tbxValues.Text = desc;
			if (frm.ShowDialog() == DialogResult.OK)
			{
				desc = frm.tbxValues.Text;
				return true;
			}
			return false;
		}