/// <summary> /// Setups the socket connection /// </summary> private void SetupSocket() { if (this.settingObject.Enabled && !SingleInstanceApp.AlreadyExists) { this.xmlSocket = new XmlSocket(this.settingObject.Host, this.settingObject.Port); this.xmlSocket.XmlReceived += new XmlReceivedEventHandler(this.HandleXml); } }
/** * Initializes the plugin */ public void Initialize() { this.mainForm = this.pluginHost.MainForm; try { /** * Check settings */ if (!this.mainForm.MainSettings.HasKey("FlashConnect.Host")) { this.mainForm.MainSettings.AddValue("FlashConnect.Host", "127.0.0.1"); } if (!this.mainForm.MainSettings.HasKey("FlashConnect.Enabled")) { this.mainForm.MainSettings.AddValue("FlashConnect.Enabled", "true"); } if (!this.mainForm.MainSettings.HasKey("FlashConnect.Port")) { this.mainForm.MainSettings.AddValue("FlashConnect.Port", "6969"); } if (!this.mainForm.MainSettings.HasKey("FlashConnect.Debug")) { this.mainForm.MainSettings.AddValue("FlashConnect.Debug", "false"); } /** * Retrieve settings */ this.cHost = this.mainForm.MainSettings.GetValue("FlashConnect.Host"); this.cEnabled = this.mainForm.MainSettings.GetBool("FlashConnect.Enabled"); this.cDebug = this.mainForm.MainSettings.GetBool("FlashConnect.Debug"); this.cPort = this.mainForm.MainSettings.GetInt("FlashConnect.Port"); /** * Set up xml socket */ if (this.cEnabled) { this.xmlSocket = new XmlSocket(this.cHost, this.cPort); this.xmlSocket.XmlReceived += new XmlReceivedEventHandler(this.HandleXml); this.xmlSocket.DataReceived += new DataReceivedEventHandler(this.HandleData); } } catch (Exception ex) { ErrorHandler.ShowError("Error while initializing FlashConnect plugin.", ex); } }
/// <summary> /// Setups the socket connection /// </summary> private void SetupSocket() { this.pendingSetup = new Timer(); this.pendingSetup.Interval = 5000; this.pendingSetup.Tick += (sender, e) => { this.pendingSetup.Stop(); this.pendingSetup = null; if (this.settingObject.Enabled && !SingleInstanceApp.AlreadyExists) { this.xmlSocket = new XmlSocket(this.settingObject.Host, this.settingObject.Port); this.xmlSocket.XmlReceived += new XmlReceivedEventHandler(this.HandleXml); } }; this.pendingSetup.Start(); }