Пример #1
0
        private void listDepthChartsToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            //MessageForm.ShowMessage("Results", Tool.GetDepthCharts(), SystemIcons.Information, false, false);
            Regex       reg = new Regex("(QB),|(RB),|(FB),|(WR),|(TE),|(C),|(G),|(T),|(DE),|(DT),|(OLB),|(ILB),|(CB),|(FS),|(SS),|(K),|(P),|(KR1),|(KR2),|(PR),|(LS),");
            MessageForm mf  = new MessageForm(SystemIcons.Information);

            mf.MessageEditable = false;
            mf.Text            = "Results";
            mf.MessageText     = Tool.GetDepthCharts();
            mf.Colorize(reg, Color.Blue);
            mf.Colorize(new Regex("(#.*)\\n"), Color.Green);
            mf.Colorize(new Regex("(,)"), Color.Fuchsia);
            mf.ShowCancelButton = false;
            mf.ShowDialog();

            mf.Dispose();
        }
Пример #2
0
        /// <summary>
        /// Returns the MessageText of the Form
        /// </summary>
        /// <param name="title">The title bar text</param>
        /// <param name="message">The initial message text to display</param>
        /// <param name="icon">the Icon to use</param>
        /// <param name="editable">true to allow the user to edit the MessageText</param>
        /// <returns>The resulting MessageText</returns>
        public static string ShowMessage(string title, string message, Icon icon, bool editable, bool showCancelButton)
        {
            string      retVal = null;
            MessageForm mf     = new MessageForm(icon);

            mf.MessageEditable  = editable;
            mf.Text             = title;
            mf.MessageText      = message;
            mf.ShowCancelButton = showCancelButton;

            if (mf.ShowDialog() == DialogResult.OK)
            {
                retVal = mf.MessageText;
            }
            mf.Dispose();
            return(retVal);
        }
Пример #3
0
 /// <summary>
 /// Shows the errors (if any exist)
 /// </summary>
 /// <param name="showToConsole">true to print the errors to the console,
 /// false to show them in a GUI dialog</param>
 public static void ShowErrors(bool showToConsole)
 {
     if (Errors.Count > 0)
     {
         StringBuilder b = new StringBuilder();
         foreach (string s in Errors)
         {
             b.Append(s);
             b.Append("\n");
         }
         if (!showToConsole)
         {
             MessageForm form = new MessageForm(System.Drawing.SystemIcons.Error);
             form.Text        = "Error!";
             form.MessageText = b.ToString();
             form.ShowDialog();
         }
         else
         {
             Console.Error.WriteLine(b.ToString());
         }
         Errors = new List <string>();
     }
 }
Пример #4
0
 /// <summary>
 /// Shows the errors (if any exist)
 /// </summary>
 /// <param name="showToConsole">true to print the errors to the console, 
 /// false to show them in a GUI dialog</param>
 public static void ShowErrors(bool showToConsole)
 {
     if (Errors.Count > 0)
     {
         StringBuilder b = new StringBuilder();
         foreach (string s in Errors)
         {
             b.Append(s);
             b.Append("\n");
         }
         if (!showToConsole)
         {
             MessageForm form = new MessageForm(System.Drawing.SystemIcons.Error);
             form.Text = "Error!";
             form.MessageText = b.ToString();
             form.ShowDialog();
         }
         else
         {
             Console.Error.WriteLine(b.ToString());
         }
         Errors = new List<string>();
     }
 }