Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Email Bomber Con Allegato - Setting.cs

Setting.cs

Caricato da:
Scarica il programma completo

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6.  
  7. namespace AnonymousMail
  8. {
  9.         /// <summary>
  10.         /// Summary description for Setting.
  11.         /// </summary>
  12.         public class Setting : System.Windows.Forms.Form
  13.         {
  14.                 private System.Windows.Forms.GroupBox groupBox1;
  15.                 private System.Windows.Forms.GroupBox groupBox2;
  16.                 private System.Windows.Forms.RadioButton highRB;
  17.                 private System.Windows.Forms.RadioButton normalRB;
  18.                 private System.Windows.Forms.RadioButton lowRB;
  19.                 private System.Windows.Forms.RadioButton asciiRB;
  20.                 private System.Windows.Forms.RadioButton unicodeRB;
  21.                 private System.Windows.Forms.RadioButton utf7RB;
  22.                 private System.Windows.Forms.RadioButton utf8RB;
  23.                 private System.Windows.Forms.Button okBtn;
  24.                 private System.Windows.Forms.Button cancelBtn;
  25.                 /// <summary>
  26.                 /// Required designer variable.
  27.                 /// </summary>
  28.                 private System.ComponentModel.Container components = null;
  29.  
  30.                 private Priorities prEnum;
  31.                 private Encodings edEnum;
  32.                 private Priorities storePrEnum;
  33.                 private Encodings storeEdEnum;
  34.                 private static bool okClicked;
  35.  
  36.                 public Setting()
  37.                 {
  38.                         //
  39.                         // Required for Windows Form Designer support
  40.                         //
  41.                         InitializeComponent();
  42.  
  43.                         //
  44.                         // TODO: Add any constructor code after InitializeComponent call
  45.                         //
  46.                         reset();
  47.                 }
  48.  
  49.                 /// <summary>
  50.                 /// Clean up any resources being used.
  51.                 /// </summary>
  52.                 protected override void Dispose( bool disposing )
  53.                 {
  54.                         if( disposing )
  55.                         {
  56.                                 if(components != null)
  57.                                 {
  58.                                         components.Dispose();
  59.                                 }
  60.                         }
  61.                         base.Dispose( disposing );
  62.                 }
  63.  
  64.                 #region Windows Form Designer generated code
  65.                 /// <summary>
  66.                 /// Required method for Designer support - do not modify
  67.                 /// the contents of this method with the code editor.
  68.                 /// </summary>
  69.                 private void InitializeComponent()
  70.                 {
  71.                         System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Setting));
  72.                         this.groupBox1 = new System.Windows.Forms.GroupBox();
  73.                         this.lowRB = new System.Windows.Forms.RadioButton();
  74.                         this.normalRB = new System.Windows.Forms.RadioButton();
  75.                         this.highRB = new System.Windows.Forms.RadioButton();
  76.                         this.groupBox2 = new System.Windows.Forms.GroupBox();
  77.                         this.utf8RB = new System.Windows.Forms.RadioButton();
  78.                         this.utf7RB = new System.Windows.Forms.RadioButton();
  79.                         this.unicodeRB = new System.Windows.Forms.RadioButton();
  80.                         this.asciiRB = new System.Windows.Forms.RadioButton();
  81.                         this.okBtn = new System.Windows.Forms.Button();
  82.                         this.cancelBtn = new System.Windows.Forms.Button();
  83.                         this.groupBox1.SuspendLayout();
  84.                         this.groupBox2.SuspendLayout();
  85.                         this.SuspendLayout();
  86.                         //
  87.                         // groupBox1
  88.                         //
  89.                         this.groupBox1.BackColor = System.Drawing.Color.Transparent;
  90.                         this.groupBox1.Controls.Add(this.lowRB);
  91.                         this.groupBox1.Controls.Add(this.normalRB);
  92.                         this.groupBox1.Controls.Add(this.highRB);
  93.                         this.groupBox1.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  94.                         this.groupBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(255)), ((System.Byte)(128)));
  95.                         this.groupBox1.Location = new System.Drawing.Point(24, 24);
  96.                         this.groupBox1.Name = "groupBox1";
  97.                         this.groupBox1.Size = new System.Drawing.Size(128, 152);
  98.                         this.groupBox1.TabIndex = 0;
  99.                         this.groupBox1.TabStop = false;
  100.                         this.groupBox1.Text = "Priorità";
  101.                         //
  102.                         // lowRB
  103.                         //
  104.                         this.lowRB.Location = new System.Drawing.Point(16, 104);
  105.                         this.lowRB.Name = "lowRB";
  106.                         this.lowRB.TabIndex = 2;
  107.                         this.lowRB.Text = "Bassa";
  108.                         //
  109.                         // normalRB
  110.                         //
  111.                         this.normalRB.Location = new System.Drawing.Point(16, 64);
  112.                         this.normalRB.Name = "normalRB";
  113.                         this.normalRB.TabIndex = 1;
  114.                         this.normalRB.Text = "Normale";
  115.                         //
  116.                         // highRB
  117.                         //
  118.                         this.highRB.Location = new System.Drawing.Point(16, 32);
  119.                         this.highRB.Name = "highRB";
  120.                         this.highRB.Size = new System.Drawing.Size(72, 16);
  121.                         this.highRB.TabIndex = 0;
  122.                         this.highRB.Text = "Alta";
  123.                         //
  124.                         // groupBox2
  125.                         //
  126.                         this.groupBox2.BackColor = System.Drawing.Color.Transparent;
  127.                         this.groupBox2.Controls.Add(this.utf8RB);
  128.                         this.groupBox2.Controls.Add(this.utf7RB);
  129.                         this.groupBox2.Controls.Add(this.unicodeRB);
  130.                         this.groupBox2.Controls.Add(this.asciiRB);
  131.                         this.groupBox2.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  132.                         this.groupBox2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(255)), ((System.Byte)(128)));
  133.                         this.groupBox2.Location = new System.Drawing.Point(184, 24);
  134.                         this.groupBox2.Name = "groupBox2";
  135.                         this.groupBox2.Size = new System.Drawing.Size(128, 184);
  136.                         this.groupBox2.TabIndex = 1;
  137.                         this.groupBox2.TabStop = false;
  138.                         this.groupBox2.Text = "Encoding";
  139.                         //
  140.                         // utf8RB
  141.                         //
  142.                         this.utf8RB.Location = new System.Drawing.Point(16, 144);
  143.                         this.utf8RB.Name = "utf8RB";
  144.                         this.utf8RB.TabIndex = 3;
  145.                         this.utf8RB.Text = "UTF8";
  146.                         //
  147.                         // utf7RB
  148.                         //
  149.                         this.utf7RB.Location = new System.Drawing.Point(16, 104);
  150.                         this.utf7RB.Name = "utf7RB";
  151.                         this.utf7RB.TabIndex = 2;
  152.                         this.utf7RB.Text = "UTF7";
  153.                         //
  154.                         // unicodeRB
  155.                         //
  156.                         this.unicodeRB.Location = new System.Drawing.Point(16, 64);
  157.                         this.unicodeRB.Name = "unicodeRB";
  158.                         this.unicodeRB.TabIndex = 1;
  159.                         this.unicodeRB.Text = "Unicode";
  160.                         //
  161.                         // asciiRB
  162.                         //
  163.                         this.asciiRB.Location = new System.Drawing.Point(16, 32);
  164.                         this.asciiRB.Name = "asciiRB";
  165.                         this.asciiRB.TabIndex = 0;
  166.                         this.asciiRB.Text = "ASCII";
  167.                         //
  168.                         // okBtn
  169.                         //
  170.                         this.okBtn.BackColor = System.Drawing.Color.Transparent;
  171.                         this.okBtn.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  172.                         this.okBtn.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(255)), ((System.Byte)(128)));
  173.                         this.okBtn.Location = new System.Drawing.Point(72, 240);
  174.                         this.okBtn.Name = "okBtn";
  175.                         this.okBtn.TabIndex = 2;
  176.                         this.okBtn.Text = "OK";
  177.                         this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
  178.                         //
  179.                         // cancelBtn
  180.                         //
  181.                         this.cancelBtn.BackColor = System.Drawing.Color.Transparent;
  182.                         this.cancelBtn.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  183.                         this.cancelBtn.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(255)), ((System.Byte)(128)));
  184.                         this.cancelBtn.Location = new System.Drawing.Point(200, 240);
  185.                         this.cancelBtn.Name = "cancelBtn";
  186.                         this.cancelBtn.Size = new System.Drawing.Size(80, 23);
  187.                         this.cancelBtn.TabIndex = 3;
  188.                         this.cancelBtn.Text = "Cancella";
  189.                         this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
  190.                         //
  191.                         // Setting
  192.                         //
  193.                         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  194.                         this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  195.                         this.ClientSize = new System.Drawing.Size(344, 286);
  196.                         this.Controls.Add(this.cancelBtn);
  197.                         this.Controls.Add(this.okBtn);
  198.                         this.Controls.Add(this.groupBox2);
  199.                         this.Controls.Add(this.groupBox1);
  200.                         this.MaximizeBox = false;
  201.                         this.Name = "Setting";
  202.                         this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  203.                         this.Text = "Settaggi";
  204.                         this.Closing += new System.ComponentModel.CancelEventHandler(this.closingEvent);
  205.                         this.Load += new System.EventHandler(this.Setting_Load);
  206.                         this.VisibleChanged += new System.EventHandler(this.visibleChange);
  207.                         this.groupBox1.ResumeLayout(false);
  208.                         this.groupBox2.ResumeLayout(false);
  209.                         this.ResumeLayout(false);
  210.  
  211.                 }
  212.                 #endregion
  213.  
  214.  
  215.                 private void okBtn_Click(object sender, System.EventArgs e)
  216.                 {
  217.                         if (highRB.Checked)
  218.                         {
  219.                                 PrEnum = Priorities.High;
  220.                         }
  221.                         else if (normalRB.Checked)
  222.                         {
  223.                                 PrEnum = Priorities.Normal;
  224.                         }
  225.                         else
  226.                         {
  227.                                 PrEnum = Priorities.Low;
  228.                         }
  229.                        
  230.                         if (asciiRB.Checked)
  231.                         {
  232.                                 EdEnum = Encodings.ASCII;
  233.                         }
  234.                         else if (unicodeRB.Checked)
  235.                         {
  236.                                 EdEnum = Encodings.Unicode;
  237.                         }
  238.                         else if (utf7RB.Checked)
  239.                         {
  240.                                 EdEnum = Encodings.UTF7;
  241.                         }
  242.                         else
  243.                         {
  244.                                 EdEnum = Encodings.UTF8;
  245.                         }
  246.                         okClicked = true;
  247.                         this.Close();
  248.                 }
  249.  
  250.                 private void reset()
  251.                 {
  252.                         normalRB.Checked = true;
  253.                         PrEnum = Priorities.Normal;
  254.                         utf8RB.Checked = true;
  255.                         EdEnum = Encodings.UTF8;
  256.                 }
  257.  
  258.                 private void cancelBtn_Click(object sender, System.EventArgs e)
  259.                 {
  260.                         backToPrevious();
  261.                         this.Close();
  262.                 }
  263.  
  264.                 public Priorities PrEnum
  265.                 {
  266.                         get
  267.                         {
  268.                                 return prEnum;
  269.                         }
  270.                         set
  271.                         {
  272.                                 prEnum = value;
  273.                         }
  274.                 }
  275.  
  276.                 public Encodings EdEnum
  277.                 {
  278.                         get
  279.                         {
  280.                                 return edEnum;
  281.                         }
  282.                         set
  283.                         {
  284.                                 edEnum = value;
  285.                         }
  286.                 }
  287.  
  288.                 private void backToPrevious()
  289.                 {
  290.                         switch (storePrEnum)
  291.                         {
  292.                                 case Priorities.High:
  293.                                         highRB.Checked = true;
  294.                                         break;
  295.                                 case Priorities.Normal:
  296.                                         normalRB.Checked = true;
  297.                                         break;
  298.                                 case Priorities.Low:
  299.                                         lowRB.Checked = true;
  300.                                         break;
  301.                         }
  302.                         switch (storeEdEnum)
  303.                         {
  304.                                 case Encodings.ASCII:
  305.                                         asciiRB.Checked = true;
  306.                                         break;
  307.                                 case Encodings.Unicode:
  308.                                         unicodeRB.Checked = true;
  309.                                         break;
  310.                                 case Encodings.UTF7:
  311.                                         utf7RB.Checked = true;
  312.                                         break;
  313.                                 case Encodings.UTF8:
  314.                                         utf8RB.Checked = true;
  315.                                         break;
  316.                         }
  317.                 }
  318.  
  319.                 private void visibleChange(object sender, System.EventArgs e)
  320.                 {
  321.                         storePrEnum = prEnum;
  322.                         storeEdEnum = edEnum;
  323.                         okClicked = false;
  324.                 }
  325.  
  326.                 private void closingEvent(object sender, System.ComponentModel.CancelEventArgs e)
  327.                 {
  328.                         if (okClicked == false)
  329.                                 backToPrevious();
  330.                 }
  331.  
  332.                 private void Setting_Load(object sender, System.EventArgs e)
  333.                 {
  334.                
  335.                 }
  336.         }
  337.  
  338. }