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; }
private void SetupForm_Load(object sender, EventArgs e) { if (String.IsNullOrEmpty(TV2BlasterPlugin.ServerHost)) { ServerAddress serverAddress = new ServerAddress(); serverAddress.ShowDialog(this); TV2BlasterPlugin.ServerHost = serverAddress.ServerHost; } IPAddress serverIP = Client.GetIPFromName(TV2BlasterPlugin.ServerHost); IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort); if (!TV2BlasterPlugin.StartClient(endPoint)) MessageBox.Show(this, "Failed to start local comms. IR functions temporarily disabled.", "TV2 Blaster Plugin - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); RefreshIRList(); RefreshMacroList(); TV2BlasterPlugin.HandleMessage += ReceivedMessage; }
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("Web Remote.log"); Application.ThreadException += Application_ThreadException; LoadSettings(); if (String.IsNullOrEmpty(_serverHost)) { ServerAddress serverAddress = new ServerAddress(); serverAddress.ShowDialog(); _serverHost = serverAddress.ServerHost; } bool clientStarted = false; IPAddress serverIP = Network.GetIPFromName(_serverHost); IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort); try { clientStarted = StartClient(endPoint); } catch (Exception ex) { IrssLog.Error(ex); clientStarted = false; } if (clientStarted) { ContextMenuStrip contextMenu = new ContextMenuStrip(); contextMenu.Items.Add(new ToolStripMenuItem("&Setup", null, new EventHandler(ClickSetup))); contextMenu.Items.Add(new ToolStripMenuItem("&Quit", null, new EventHandler(ClickQuit))); _container = new Container(); _notifyIcon = new NotifyIcon(_container); _notifyIcon.ContextMenuStrip = contextMenu; _notifyIcon.DoubleClick += ClickSetup; _notifyIcon.Icon = Resources.Icon; _notifyIcon.Text = "Web Remote"; ChangeSkin(); try { _webServer = new WebServer(_webPort); _webServer.Run(); } catch (Exception ex) { IrssLog.Error(ex); } _notifyIcon.Visible = true; Application.Run(); _notifyIcon.Visible = false; if (_webServer != null) _webServer.Stop(); } SaveSettings(); StopClient(); Application.ThreadException -= Application_ThreadException; IrssLog.Close(); }
private void buttonChangeServer_Click(object sender, EventArgs e) { TV2BlasterPlugin.StopClient(); ServerAddress serverAddress = new ServerAddress(TV2BlasterPlugin.ServerHost); serverAddress.ShowDialog(this); TV2BlasterPlugin.ServerHost = serverAddress.ServerHost; IPAddress serverIP = Client.GetIPFromName(TV2BlasterPlugin.ServerHost); IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort); TV2BlasterPlugin.StartClient(endPoint); }
private void SetServer(object sender, EventArgs e) { ServerAddress serverAddress = new ServerAddress(Program.Config.ServerHost); if (serverAddress.ShowDialog(this) == DialogResult.OK) { Program.StopClient(); Program.Config.ServerHost = serverAddress.ServerHost; IPAddress serverIP = Network.GetIPFromName(Program.Config.ServerHost); IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort); Program.StartClient(endPoint); } }
private void changeServerToolStripMenuItem_Click(object sender, EventArgs e) { ServerAddress serverAddress = new ServerAddress(_serverHost); serverAddress.ShowDialog(this); _serverHost = serverAddress.ServerHost; SaveSettings(); }
private void SetServer(object sender, EventArgs e) { ServerAddress serverAddress = new ServerAddress(Program.Config.ServerHost); if (serverAddress.ShowDialog(this) == DialogResult.OK) { Program.StopClient(); Program.Config.ServerHost = serverAddress.ServerHost; IPAddress serverIP = Network.GetIPFromName(Program.Config.ServerHost); IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort); Program.StartClient(endPoint); commandManager.IRServer = Program.TransceiverInformation; Edited = true; } }
private void SetupForm_Load(object sender, EventArgs e) { if (String.IsNullOrEmpty(MPControlPlugin.ServerHost)) { ServerAddress serverAddress = new ServerAddress(); serverAddress.ShowDialog(this); MPControlPlugin.ServerHost = serverAddress.ServerHost; } IPAddress serverIP = Network.GetIPFromName(MPControlPlugin.ServerHost); IPEndPoint endPoint = new IPEndPoint(serverIP, Server.DefaultPort); if (!MPControlPlugin.StartClient(endPoint)) MessageBox.Show(this, "Failed to start local comms. IR functions temporarily disabled.", "MP Control Plugin - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); checkBoxRequiresFocus.Checked = MPControlPlugin.RequireFocus; checkBoxMultiMapping.Checked = MPControlPlugin.MultiMappingEnabled; checkBoxEventMapper.Checked = MPControlPlugin.EventMapperEnabled; checkBoxMouseMode.Checked = MPControlPlugin.MouseModeEnabled; RefreshIRList(); RefreshMacroList(); // Mouse Mode ... foreach (string button in Enum.GetNames(typeof (RemoteButton))) if (!button.Equals("None", StringComparison.OrdinalIgnoreCase)) comboBoxMouseModeButton.Items.Add(button); comboBoxMouseModeButton.SelectedItem = Enum.GetName(typeof (RemoteButton), MPControlPlugin.MouseModeButton); numericUpDownMouseStep.Value = new decimal(MPControlPlugin.MouseModeStep); checkBoxMouseAcceleration.Checked = MPControlPlugin.MouseModeAcceleration; // Multi-Mapping ... foreach (string button in Enum.GetNames(typeof (RemoteButton))) if (!button.Equals("None", StringComparison.OrdinalIgnoreCase)) comboBoxMultiButton.Items.Add(button); comboBoxMultiButton.SelectedItem = Enum.GetName(typeof (RemoteButton), MPControlPlugin.MultiMappingButton); foreach (string map in MPControlPlugin.MultiMaps) listBoxMappings.Items.Add(map); // Event Mapper ... RefreshEventMapperCommands(); comboBoxEvents.Items.Clear(); foreach (string eventType in Enum.GetNames(typeof (MappedEvent.MappingEvent))) if (!eventType.Equals("None", StringComparison.OrdinalIgnoreCase)) comboBoxEvents.Items.Add(eventType); // TODO: Add Enter/Exit screen events. //comboBoxEvents.Items.Add("Enter screen"); //comboBoxEvents.Items.Add("Exit screen"); comboBoxParameter.Items.Clear(); comboBoxParameter.Items.Add("Ignore Parameters"); comboBoxParameter.Items.Add("Label 1"); comboBoxParameter.Items.Add("Label 2"); comboBoxParameter.Items.Add("Label 3"); comboBoxParameter.Items.Add("Label 4"); comboBoxParameter.Items.Add("Parameter 1"); comboBoxParameter.Items.Add("Parameter 2"); comboBoxParameter.Items.Add("Parameter 3"); comboBoxParameter.Items.Add("Parameter 4"); comboBoxParameter.Items.Add("Send To Target Window"); comboBoxParameter.Items.Add("Sender Control ID"); comboBoxParameter.Items.Add("Target Control ID"); comboBoxParameter.Items.Add("Target Window ID"); comboBoxParameter.SelectedIndex = 0; LoadEvents(); // Remote Control Presets ... comboBoxRemotePresets.Items.Clear(); string[] presets = Directory.GetFiles(MPControlPlugin.RemotePresetsFolder, "*.xml", SearchOption.TopDirectoryOnly); foreach (string preset in presets) comboBoxRemotePresets.Items.Add(Path.GetFileNameWithoutExtension(preset)); comboBoxRemotePresets.SelectedIndex = 0; // Load Remotes ... treeViewRemotes.Nodes.Clear(); LoadRemotes(MPControlPlugin.RemotesFile); // Register for remote button presses _addNode = AddNode; MPControlPlugin.HandleMessage += ReceivedMessage; }
private static void Setup() { ServerAddress serverAddress = new ServerAddress(); if (serverAddress.ShowDialog() == DialogResult.OK) { _serverHost = serverAddress.ServerHost; SaveSettings(); } }