Exemplo n.º 1
0
        private void buttonTest_Click(object sender, EventArgs e)
        {
            string name = textBoxName.Text.Trim();

            if (name.Length == 0)
            {
                MessageBox.Show(this, "You must supply a name for this Macro", "Name missing", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                textBoxName.Focus();
                return;
            }

            if (!IrssUtils.Common.IsValidFileName(name))
            {
                MessageBox.Show(this, "You must supply a valid name for this Macro", "Invalid name", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                textBoxName.Focus();
                return;
            }

            try
            {
                WriteToFile(MPBlastZonePlugin.FolderMacros + name + IrssUtils.Common.FileExtensionMacro);

                MPBlastZonePlugin.ProcessCommand(IrssUtils.Common.CmdPrefixMacro + name, false);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                MessageBox.Show(this, ex.Message, "Test failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void RefreshMacroList()
        {
            listViewMacro.Items.Clear();

            string[] macroList = MPBlastZonePlugin.GetMacroList(false);
            if (macroList != null && macroList.Length > 0)
            {
                foreach (string macroFile in macroList)
                {
                    listViewMacro.Items.Add(macroFile);
                }
            }
        }
Exemplo n.º 3
0
        private void buttonChangeServer_Click(object sender, EventArgs e)
        {
            MPBlastZonePlugin.StopClient();

            ServerAddress serverAddress = new ServerAddress(MPBlastZonePlugin.ServerHost);

            serverAddress.ShowDialog(this);

            MPBlastZonePlugin.ServerHost = serverAddress.ServerHost;

            IPAddress  serverIP = Network.GetIPFromName(MPBlastZonePlugin.ServerHost);
            IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort);

            MPBlastZonePlugin.StartClient(endPoint);
        }
Exemplo n.º 4
0
        private void buttonTestMacro_Click(object sender, EventArgs e)
        {
            if (listViewMacro.SelectedItems.Count != 1)
            {
                return;
            }

            try
            {
                MPBlastZonePlugin.ProcessCommand(IrssUtils.Common.CmdPrefixMacro + listViewMacro.SelectedItems[0].Text, false);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                MessageBox.Show(this, ex.Message, "Test failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void SetupForm_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(MPBlastZonePlugin.ServerHost))
            {
                ServerAddress serverAddress = new ServerAddress();
                serverAddress.ShowDialog(this);

                MPBlastZonePlugin.ServerHost = serverAddress.ServerHost;
            }

            IPAddress  serverIP = Network.GetIPFromName(MPBlastZonePlugin.ServerHost);
            IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort);

            if (!MPBlastZonePlugin.StartClient(endPoint))
            {
                MessageBox.Show(this, "Failed to start local comms. IR functions temporarily disabled.",
                                "MP Blast Zone Plugin - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            RefreshIRList();
            RefreshMacroList();
            RefreshCommandsCombo();

            // Populate the tree
            treeViewMenu.Nodes.Clear();
            foreach (string collection in MPBlastZonePlugin.Menu.GetAllItems())
            {
                TreeNode collectionNode = new TreeNode(collection);
                treeViewMenu.Nodes.Add(collectionNode);

                foreach (string command in MPBlastZonePlugin.Menu.GetItem(collection).GetAllItems())
                {
                    TreeNode commandNode = new TreeNode(command);
                    commandNode.ForeColor = Color.Navy;
                    collectionNode.Nodes.Add(commandNode);

                    TreeNode commandValueNode = new TreeNode(MPBlastZonePlugin.Menu.GetItem(collection).GetItem(command).Command);
                    commandValueNode.ForeColor = Color.Blue;
                    commandNode.Nodes.Add(commandValueNode);
                }
            }

            MPBlastZonePlugin.HandleMessage += ReceivedMessage;
        }
Exemplo n.º 6
0
        private void RefreshCommandsCombo()
        {
            comboBoxCommands.Items.Clear();

            comboBoxCommands.Items.Add(IrssUtils.Common.UITextRun);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextSerial);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextWindowMsg);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextTcpMsg);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextEject);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextGotoScreen);
            //comboBoxCommands.Items.Add(IrssUtils.Common.UITextWindowState);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextExit);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextStandby);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextHibernate);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextReboot);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextShutdown);

            string[] fileList = MPBlastZonePlugin.GetFileList(true);

            if (fileList != null && fileList.Length > 0)
            {
                comboBoxCommands.Items.AddRange(fileList);
            }
        }
Exemplo n.º 7
0
        private void RefreshCommandList()
        {
            comboBoxCommands.Items.Clear();

            comboBoxCommands.Items.Add(IrssUtils.Common.UITextRun);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextPause);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextSerial);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextWindowMsg);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextTcpMsg);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextHttpMsg);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextKeys);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextMouse);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextEject);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextPopup);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextGotoScreen);
            //comboBoxCommands.Items.Add(IrssUtils.Common.UITextWindowState);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextFocus);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextExit);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextSendMPAction);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextSendMPMsg);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextVirtualKB);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextSmsKB);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextBeep);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextSound);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextDisplayMode);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextStandby);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextHibernate);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextReboot);
            comboBoxCommands.Items.Add(IrssUtils.Common.UITextShutdown);

            string[] fileList = MPBlastZonePlugin.GetFileList(true);
            if (fileList != null && fileList.Length > 0)
            {
                comboBoxCommands.Items.AddRange(fileList);
            }
        }