Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     var tm = new TimedMessages {File = "Data\\Answer.txt"};
     tm.Show();
 }
Ejemplo n.º 2
0
        private void btnAddLua_Click(object sender, EventArgs e)
        {
            var fileName = "";
            var p = MessageBox.Show("Would you like to create a new script, or run an existing one? Yes for new.", "New LUA", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (p == DialogResult.Cancel)
                return;

            if (p == DialogResult.Yes) {
                var newFile = new SaveFileDialog
                {
                    InitialDirectory = _serverProc.StartInfo.WorkingDirectory + "\\Lua\\",
                    Filter = "Lua Scripts | *.lua"
                };

                newFile.ShowDialog();
                fileName = newFile.FileName;

                var sNewFile = new StreamWriter(newFile.FileName);
                sNewFile.Write(" ");
                sNewFile.Close();

                if (fileName == "")
                    return;
            }
            if (p == DialogResult.No) {
                var newFile = new OpenFileDialog
                {
                    InitialDirectory = _serverProc.StartInfo.WorkingDirectory + "\\Lua\\",
                    Filter = "Lua Scripts | *.lua"
                };

                newFile.ShowDialog();
                fileName = newFile.FileName;

                if (fileName == "")
                    return;
            }
            var buttonName = Interaction.InputBox("Please give a name for the custom button", "Adding LUA");

            if (buttonName == "")
                return;

            var thisresult = MessageBox.Show("Would you like to edit the file now?", "Lua Add", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (thisresult == DialogResult.Yes) {
                var tm = new TimedMessages {File = fileName};
                tm.Show();
            }

            SettingsReader rc;

            if (!File.Exists("GUI.ini"))
                rc = new SettingsReader("GUI.ini", true);
            else {
                rc = new SettingsReader("GUI.ini");
                rc.ReadSettings();
            }

            var oldButtons = "";

            if (rc.Settings.ContainsKey("luas"))
                oldButtons = rc.Settings["luas"];

            oldButtons += buttonName + "," + fileName + "|";
            rc.Settings["luas"] = oldButtons;

            rc.SaveSettings();

            AddButton(buttonName, fileName);
        }
Ejemplo n.º 3
0
 private void btnUndo_Click(object sender, EventArgs e)
 {
     var tm = new TimedMessages {File = "Data\\Undo.txt"};
     tm.Show();
 }