GlobalAccessSoftware icon

YesNoAlwaysForm.cs

GlobalAccessSoftware | PRO | 11/07/17 06:59:51 AM UTC | 0 ⭐ | 661 👁️ | Never ⏰ | []
C# |

2.85 KB

|

None

|

0 👍

/

0 👎

 
 
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// YesNoAlwaysForm.cs v1.0.2.21 03-Nov
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// Created by Jp Edwards as Shareware
// and as a Fresher Course in Windows
// Forms Apps, OOP and C#.NET
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// This is an Early Version meant to
// inspire freshers to dive right in
// and away from mere console Apps, etc.
// I've left many many things for you to
// code and experiment with. Just beware
// of the standard license and rights.
// i.e. Share your improvements!
// Ask questions, Collaborate!
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// ReUsable YesNoAlways Form w/CheckBox.
// Pass in string Infotext & see below.
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// YesNoAlways Status Legend:
// 1 = Yes, 2 = No,
// 3 = Yes as Pref. 4 = No as Pref.
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// v1.0.2.26 19-Nov-17 More Flexible.
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
 
using System;
using System.Windows.Forms;
using ShowMeEditorStandAloneVersion.Properties;
using SMS = ShowMeEditorStandAloneVersion
  .Properties.Settings;
 
namespace ShowMeEditorStandAloneVersion
{
  public partial class YesNoAlwaysForm : Form
  {
    // Private Fields
    private readonly string _txt, _ttl;
 
    // Public Auto Properties
    public bool HideAlways { get; set; }
    public int Status { get; private set; }
    public System.Drawing.Point Local { get; set; }
 
    // Overloaded Constructors JIC
    public YesNoAlwaysForm()
    { InitializeComponent(); }
 
    // TextBox String only Version.
    public YesNoAlwaysForm(string text)
    {
      if (!string.IsNullOrEmpty(text))
        _txt = text;
      InitializeComponent();
    }
 
    // Text AND Title Version.
    public YesNoAlwaysForm
      (string text, string title)
    {
      if (!string.IsNullOrEmpty( text))
        _txt = text;
      if (!string.IsNullOrEmpty(title))
        _ttl = title;
      InitializeComponent();
    }
 
    private void YnaFormLoading
      (object sender, EventArgs e)
    {
      if (!string.IsNullOrEmpty(_ttl))
        Text = _ttl;
      if (!string.IsNullOrEmpty(_txt))
        InfoTextBox.Text = _txt;
      if (HideAlways)
      {
        //label1.Hide();
        label1.Text = Resources.YNA_AYS;
        PreferenceCheckBox.Hide();
      }
      Location = Local;
    }
 
    private void
      YesButtonClick(object sender, EventArgs e)
    {
      Status = 1;
      CheckCheckBox();
    }
 
    private void
      NoButtonClick(object sender, EventArgs e)
    {
      Status = 2;
      CheckCheckBox();
    }
 
    private void CheckCheckBox()
    {
      if (PreferenceCheckBox.Checked)
        Status += 2;
      Local = Location;
      Close();
    }
    // YesNoAlways Status Legend:
    // 1 = Yes, 2 = No,
    // 3 = Yes as Pref. 4 = No as Pref.
  }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎