private void SettingsControl_Load(object sender, System.EventArgs e)
 {
     if (System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\Settings.ini"))
     {
         Classes.INIObject settingsini = new Classes.INIObject(System.Windows.Forms.Application.StartupPath + "\\Settings.ini");
         curvalue3     = settingsini.Read("Settings.ini", "ElsDir");
         curvalue      = settingsini.Read("Settings.ini", "IconWhileElsNotRunning");
         curvalue2     = settingsini.Read("Settings.ini", "IconWhileElsRunning");
         TextBox1.Text = curvalue3;
         Label4.Text   = curvalue;
         Label5.Text   = curvalue2;
         if (Label4.Text == "0")
         {
             RadioButton1.Checked = true;
         }
         else if (Label4.Text == "1")
         {
             RadioButton2.Checked = true;
         }
         else if (Label4.Text == "2")
         {
             RadioButton3.Checked = true;
         }
         else if (Label4.Text == "...")
         {
             RadioButton3.Checked = true;
         }
         if (Label5.Text == "0")
         {
             RadioButton4.Checked = true;
         }
         else if (Label5.Text == "1")
         {
             RadioButton5.Checked = true;
         }
         else if (Label5.Text == "2")
         {
             RadioButton6.Checked = true;
         }
         else if (Label5.Text == "...")
         {
             RadioButton5.Checked = true;
         }
         TreeView1.SelectedNode = TreeView1.Nodes[0];
     }
 }
Exemple #2
0
 public void LoadControl()
 {
     if (System.IO.File.Exists(Application.StartupPath + "\\Settings.ini"))
     {
         settingsini = new Classes.INIObject(Application.StartupPath + "\\Settings.ini");
         ElsDir      = settingsini.Read("Settings.ini", "ElsDir");
         if (ElsDir.Length > 0)
         {
             //The Setting actually exists and is not a empty String so we do not need to open the dialog again.
         }
         else
         {
             ConfigForm2?.Invoke(this, new EventArgs());
         }
     }
     else
     {
         ConfigForm2?.Invoke(this, new EventArgs());
     }
     timer5.Enabled = true;
 }
 /// <summary>
 /// Saves the Settings that changed in this Control's buffers.
 /// </summary>
 public void SaveSettings()
 {
     Classes.INIObject settingsini = new Classes.INIObject(System.Windows.Forms.Application.StartupPath + "\\Settings.ini");
     if (!ReferenceEquals(TextBox1.Text, curvalue3))
     {
         if (TextBox1.Text.Length > 0)
         {
             settingsini.Write("Settings.ini", "ElsDir", TextBox1.Text);
         }
         else
         {
             Classes.MessageManager.ShowWarning("You Should Set a Working Elsword Directory.", "Warning!");
         }
     }
     if (!ReferenceEquals(Label4.Text, curvalue))
     {
         if (Label5.Text == "...")
         {
             settingsini.Write("Settings.ini", "IconWhileElsNotRunning", "2");
         }
         else
         {
             settingsini.Write("Settings.ini", "IconWhileElsNotRunning", Label4.Text);
         }
     }
     if (!ReferenceEquals(Label5.Text, curvalue2))
     {
         if (Label5.Text == "...")
         {
             settingsini.Write("Settings.ini", "IconWhileElsRunning", "1");
         }
         else
         {
             settingsini.Write("Settings.ini", "IconWhileElsRunning", Label5.Text);
         }
     }
 }
 public void SaveSettings()
 {
     Classes.INIObject settingsini = new Classes.INIObject(Application.StartupPath + "\\Settings.ini");
     if (!ReferenceEquals(TextBox1.Text, curvalue3))
     {
         if (TextBox1.Text.Length > 0)
         {
             settingsini.Write("Settings.ini", "ElsDir", TextBox1.Text);
         }
         else
         {
             MessageBox.Show("You Should Set a Working Elsword Directory.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     if (!ReferenceEquals(Label4.Text, curvalue))
     {
         if (Label5.Text == "...")
         {
             settingsini.Write("Settings.ini", "IconWhileElsNotRunning", "2");
         }
         else
         {
             settingsini.Write("Settings.ini", "IconWhileElsNotRunning", Label4.Text);
         }
     }
     if (!ReferenceEquals(Label5.Text, curvalue2))
     {
         if (Label5.Text == "...")
         {
             settingsini.Write("Settings.ini", "IconWhileElsRunning", "1");
         }
         else
         {
             settingsini.Write("Settings.ini", "IconWhileElsRunning", Label5.Text);
         }
     }
 }