Beispiel #1
0
        private static void Main()
        {
            // Check for multiple instances.
            if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length != 1)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IrssLog.LogLevel = IrssLog.Level.Debug;
            IrssLog.Open("Media Center Blaster.log");

            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

            Tray tray = new Tray();

            if (tray.Start())
            {
                Application.Run();
            }

            Application.ThreadException -= new ThreadExceptionEventHandler(Application_ThreadException);

            IrssLog.Close();
        }
Beispiel #2
0
        private void RefreshCommandList()
        {
            comboBoxCommands.Items.Clear();

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

            string[] fileList = Tray.GetFileList(true);
            if (fileList != null && fileList.Length > 0)
            {
                comboBoxCommands.Items.AddRange(fileList);
            }
        }
Beispiel #3
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 (!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
            {
                string fileName = Path.Combine(Tray.FolderMacros, name + Common.FileExtensionMacro);
                WriteToFile(fileName);

                Tray.ProcessCommand(Common.CmdPrefixMacro + name, false);
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);
                MessageBox.Show(this, ex.Message, "Test failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #4
0
        private void RefreshMacroList()
        {
            listViewMacro.Items.Clear();

            string[] macroList = Tray.GetMacroList(false);
            if (macroList != null && macroList.Length > 0)
            {
                foreach (string macroFile in macroList)
                {
                    listViewMacro.Items.Add(macroFile);
                }
            }
        }
Beispiel #5
0
        private void buttonChangeServer_Click(object sender, EventArgs e)
        {
            Tray.StopClient();

            ServerAddress serverAddress = new ServerAddress(Tray.ServerHost);

            serverAddress.ShowDialog(this);

            Tray.ServerHost = serverAddress.ServerHost;

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

            Tray.StartClient(endPoint);
        }
Beispiel #6
0
        public StbSetup(int cardId)
        {
            InitializeComponent();

            _cardId = cardId;

            // Setup commands combo box
            comboBoxCommands.Items.Add(Common.UITextRun);
            comboBoxCommands.Items.Add(Common.UITextSerial);
            comboBoxCommands.Items.Add(Common.UITextWindowMsg);
            comboBoxCommands.Items.Add(Common.UITextTcpMsg);
            comboBoxCommands.Items.Add(Common.UITextHttpMsg);
            comboBoxCommands.Items.Add(Common.UITextKeys);
            comboBoxCommands.Items.Add(Common.UITextPopup);

            string[] fileList = Tray.GetFileList(true);
            if (fileList != null)
            {
                comboBoxCommands.Items.AddRange(fileList);
            }

            comboBoxCommands.SelectedIndex = 0;

            // Setup command list
            ListViewItem item;

            string[] subItems = new string[2];
            for (int i = 0; i < 10; i++)
            {
                subItems[0] = "Digit " + i.ToString();
                subItems[1] = String.Empty;
                item        = new ListViewItem(subItems);
                listViewExternalCommands.Items.Add(item);
            }

            subItems[0] = "Select";
            subItems[1] = String.Empty;
            item        = new ListViewItem(subItems);
            listViewExternalCommands.Items.Add(item);

            subItems[0] = "PreChange";
            subItems[1] = String.Empty;
            item        = new ListViewItem(subItems);
            listViewExternalCommands.Items.Add(item);

            SetToCard();
        }
Beispiel #7
0
        private void buttonTestMacro_Click(object sender, EventArgs e)
        {
            if (listViewMacro.SelectedItems.Count != 1)
            {
                return;
            }

            try
            {
                Tray.ProcessCommand(Common.CmdPrefixMacro + listViewMacro.SelectedItems[0].Text, false);
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);
                MessageBox.Show(this, ex.Message, "Test failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    private static void Main()
    {
      // Check for multiple instances.
      if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length != 1)
        return;

      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);

      IrssLog.LogLevel = IrssLog.Level.Debug;
      IrssLog.Open("Media Center Blaster.log");

      Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

      Tray tray = new Tray();

      if (tray.Start())
        Application.Run();

      Application.ThreadException -= new ThreadExceptionEventHandler(Application_ThreadException);

      IrssLog.Close();
    }
Beispiel #9
0
        private void buttonTest_Click(object sender, EventArgs e)
        {
            try
            {
                StbSetup setup = _tvCardStbSetup;

                int    channelTest = Decimal.ToInt32(numericUpDownTest.Value);
                string channel;
                switch (setup.ChannelDigits)
                {
                case 2:
                    channel = channelTest.ToString("00");
                    break;

                case 3:
                    channel = channelTest.ToString("000");
                    break;

                case 4:
                    channel = channelTest.ToString("0000");
                    break;

                default:
                    channel = channelTest.ToString();
                    break;
                }

                int    charVal;
                string command;

                for (int repeatCount = 0; repeatCount <= setup.RepeatChannelCommands; repeatCount++)
                {
                    if (repeatCount > 0 && setup.RepeatPauseTime > 0)
                    {
                        Thread.Sleep(setup.RepeatPauseTime);
                    }

                    if (setup.UsePreChangeCommand && !String.IsNullOrEmpty(setup.PreChangeCommand))
                    {
                        Tray.ProcessExternalCommand(setup.PreChangeCommand, -1, channel);

                        if (setup.PauseTime > 0)
                        {
                            Thread.Sleep(setup.PauseTime);
                        }
                    }

                    foreach (char digit in channel)
                    {
                        charVal = digit - 48;

                        command = setup.Digits[charVal];
                        if (!String.IsNullOrEmpty(command))
                        {
                            Tray.ProcessExternalCommand(command, charVal, channel);

                            if (setup.PauseTime > 0)
                            {
                                Thread.Sleep(setup.PauseTime);
                            }
                        }
                    }

                    if (setup.SendSelect && !String.IsNullOrEmpty(setup.SelectCommand))
                    {
                        Tray.ProcessExternalCommand(setup.SelectCommand, -1, channel);

                        if (setup.DoubleChannelSelect)
                        {
                            if (setup.PauseTime > 0)
                            {
                                Thread.Sleep(setup.PauseTime);
                            }

                            Tray.ProcessExternalCommand(setup.SelectCommand, -1, channel);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Failed to test external channel", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }