//================================================================================ public void onFirstLaunch() { string poeFolder = CajFuns.findPoeFolder(); if (poeFolder != "") { txtPoeFolder.Text = poeFolder; CajApp.onOptionsChange(poeFolder, cbHotkey.Text); } txtPoeFolder.Focus(); //select it, so user can notice and correct it. }
//================================================================================ void ButSaveClick(object sender, EventArgs e) { string sErr = ""; string poeFolder = txtPoeFolder.Text.Trim(); if (poeFolder == "" || !System.IO.Directory.Exists(poeFolder)) { sErr = "Can't find PoE folder."; } string sHotkey = cbHotkey.Text.Trim(); if (sHotkey == "None") { sHotkey = ""; } if (sHotkey == "Tilde") { sHotkey = "Oemtilde"; } if (sHotkey != "") { bool isOkHotkey = true; try { int h = (int)Enum.Parse(typeof(Keys), sHotkey); if (h == 0) { isOkHotkey = false; } } catch (Exception ex) { isOkHotkey = false; } if (!isOkHotkey) { sErr = "Incorrect hotkey." + "\n\nCorrect examples:\nCapital\nK\nF5" + "\n\nSet text field empty to disable hotkey"; } } if (sErr == "") { CajApp.onOptionsChange(poeFolder, sHotkey); this.Hide(); } else { MessageBox.Show(sErr, elementTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }