From: <an...@us...> - 2007-07-12 03:23:12
|
Revision: 686 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=686&view=rev Author: and-81 Date: 2007-07-11 20:23:10 -0700 (Wed, 11 Jul 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.cs trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceIrApi.cs trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceReplacementTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.cs trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.resx trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/UirtTransceiver.cs Added Paths: ----------- trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.Designer.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.resx Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -152,11 +152,7 @@ if (StartRelay()) IrssLog.Info("Started in Relay Mode"); else - { IrssLog.Error("Failed to start in Relay Mode"); - return false; - } - break; } @@ -165,10 +161,7 @@ if (StartRepeater()) IrssLog.Info("Started in Repeater Mode"); else - { IrssLog.Error("Failed to start in Repeater Mode"); - return false; - } break; } } @@ -331,7 +324,6 @@ return false; } - // Todo: Put in the proper retry system from other apps/plugins void StartMessageQueue() { _processMessageQueue = true; @@ -945,8 +937,8 @@ break; } - // Pause 1 second before instructing the client to start the IR learning ... - Thread.Sleep(1000); + // Pause half a second before instructing the client to start the IR learning ... + Thread.Sleep(500); // Send back a "Start Learn" trigger ... PipeMessage trigger = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Start Learn", null); Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -793,10 +793,12 @@ // radioButtonActiveWindow // this.radioButtonActiveWindow.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.radioButtonActiveWindow.Checked = true; this.radioButtonActiveWindow.Location = new System.Drawing.Point(16, 24); this.radioButtonActiveWindow.Name = "radioButtonActiveWindow"; this.radioButtonActiveWindow.Size = new System.Drawing.Size(104, 16); this.radioButtonActiveWindow.TabIndex = 0; + this.radioButtonActiveWindow.TabStop = true; this.radioButtonActiveWindow.Text = "Active window"; this.radioButtonActiveWindow.UseVisualStyleBackColor = true; this.radioButtonActiveWindow.CheckedChanged += new System.EventHandler(this.radioButtonActiveWindow_CheckedChanged); @@ -828,7 +830,6 @@ this.radioButtonWindowTitle.Name = "radioButtonWindowTitle"; this.radioButtonWindowTitle.Size = new System.Drawing.Size(96, 16); this.radioButtonWindowTitle.TabIndex = 3; - this.radioButtonWindowTitle.TabStop = true; this.radioButtonWindowTitle.Text = "Window title"; this.radioButtonWindowTitle.UseVisualStyleBackColor = true; this.radioButtonWindowTitle.CheckedChanged += new System.EventHandler(this.radioButtonWindowTitle_CheckedChanged); @@ -840,7 +841,6 @@ this.radioButtonApplication.Name = "radioButtonApplication"; this.radioButtonApplication.Size = new System.Drawing.Size(88, 16); this.radioButtonApplication.TabIndex = 1; - this.radioButtonApplication.TabStop = true; this.radioButtonApplication.Text = "Application"; this.radioButtonApplication.UseVisualStyleBackColor = true; this.radioButtonApplication.CheckedChanged += new System.EventHandler(this.radioButtonApplication_CheckedChanged); @@ -852,7 +852,6 @@ this.radioButtonClass.Name = "radioButtonClass"; this.radioButtonClass.Size = new System.Drawing.Size(72, 16); this.radioButtonClass.TabIndex = 2; - this.radioButtonClass.TabStop = true; this.radioButtonClass.Text = "Class"; this.radioButtonClass.UseVisualStyleBackColor = true; this.radioButtonClass.CheckedChanged += new System.EventHandler(this.radioButtonClass_CheckedChanged); Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -373,7 +373,9 @@ } else if (radioButtonWindowTitle.Checked) { - // TODO: Locate Window + WindowList windowList = new WindowList(); + if (windowList.ShowDialog(this) == DialogResult.OK) + textBoxMsgTarget.Text = windowList.SelectedWindowTitle; } } @@ -394,7 +396,7 @@ } private void radioButtonWindowTitle_CheckedChanged(object sender, EventArgs e) { - buttonFindMsgTarget.Enabled = false; + buttonFindMsgTarget.Enabled = true; textBoxMsgTarget.Enabled = true; } Added: trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.Designer.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -0,0 +1,70 @@ +namespace Translator +{ + partial class WindowList + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.listBoxWindows = new System.Windows.Forms.ListBox(); + this.SuspendLayout(); + // + // listBoxWindows + // + this.listBoxWindows.Dock = System.Windows.Forms.DockStyle.Fill; + this.listBoxWindows.FormattingEnabled = true; + this.listBoxWindows.HorizontalScrollbar = true; + this.listBoxWindows.IntegralHeight = false; + this.listBoxWindows.Location = new System.Drawing.Point(0, 0); + this.listBoxWindows.Name = "listBoxWindows"; + this.listBoxWindows.Size = new System.Drawing.Size(292, 376); + this.listBoxWindows.TabIndex = 0; + this.listBoxWindows.DoubleClick += new System.EventHandler(this.listBoxWindows_DoubleClick); + this.listBoxWindows.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.listBoxWindows_KeyPress); + // + // WindowList + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(292, 376); + this.Controls.Add(this.listBoxWindows); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "WindowList"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Window List"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox listBoxWindows; + } +} \ No newline at end of file Added: trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.cs (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; + +namespace Translator +{ + + public partial class WindowList : Form + { + + #region Interop + + public delegate bool EnumWindowsProc(int hWnd, int lParam); + + [DllImport("user32.dll")] + private static extern int GetWindowText(int hWnd, StringBuilder title, int size); + + [DllImport("user32.dll")] + private static extern int GetWindowModuleFileName(int hWnd, StringBuilder title, int size); + + [DllImport("user32.dll")] + private static extern int EnumWindows(EnumWindowsProc ewp, int lParam); + + #endregion Interop + + #region Properties + + public string SelectedWindowTitle + { + get { return listBoxWindows.SelectedItem as string; } + } + + #endregion Properties + + #region Constructor + + public WindowList() + { + InitializeComponent(); + + PopulateList(); + } + + #endregion Constructor + + void PopulateList() + { + EnumWindowsProc ewp = new EnumWindowsProc(EvalWindow); + + EnumWindows(ewp, 0); + } + + bool EvalWindow(int hWnd, int lParam) + { + StringBuilder title = new StringBuilder(256); + GetWindowText(hWnd, title, 256); + + //StringBuilder module = new StringBuilder(256); + //GetWindowModuleFileName(hWnd, module, 256); + + if (title.Length == 0) + return true; + + listBoxWindows.Items.Add(title.ToString()); + + return true; + } + + private void listBoxWindows_DoubleClick(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void listBoxWindows_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == 27) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + } + + } + +} Added: trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.resx =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.resx (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/WindowList.resx 2007-07-12 03:23:10 UTC (rev 686) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-07-12 03:23:10 UTC (rev 686) @@ -88,6 +88,12 @@ <Compile Include="Forms\MainForm.Designer.cs"> <DependentUpon>MainForm.cs</DependentUpon> </Compile> + <Compile Include="Forms\WindowList.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Forms\WindowList.Designer.cs"> + <DependentUpon>WindowList.cs</DependentUpon> + </Compile> <Compile Include="MappedEvent.cs" /> <Compile Include="Program.cs" /> <Compile Include="ProgramSettings.cs" /> @@ -120,6 +126,10 @@ <SubType>Designer</SubType> <DependentUpon>MainForm.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="Forms\WindowList.resx"> + <DependentUpon>WindowList.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.Designer.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.Designer.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -40,10 +40,15 @@ this.comboBoxBlasterType = new System.Windows.Forms.ComboBox(); this.labelBlasterType = new System.Windows.Forms.Label(); this.groupBoxBlaster = new System.Windows.Forms.GroupBox(); + this.groupBoxLearnTimeout = new System.Windows.Forms.GroupBox(); + this.labelLearnIRTimeout = new System.Windows.Forms.Label(); + this.numericUpDownLearnTimeout = new System.Windows.Forms.NumericUpDown(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonRepeatDelay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonHeldDelay)).BeginInit(); this.groupBoxTimes.SuspendLayout(); this.groupBoxBlaster.SuspendLayout(); + this.groupBoxLearnTimeout.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLearnTimeout)).BeginInit(); this.SuspendLayout(); // // labelButtonRepeatDelay @@ -127,7 +132,7 @@ // // buttonOK // - this.buttonOK.Location = new System.Drawing.Point(96, 168); + this.buttonOK.Location = new System.Drawing.Point(96, 232); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(64, 24); this.buttonOK.TabIndex = 2; @@ -138,7 +143,7 @@ // buttonCancel // this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(168, 168); + this.buttonCancel.Location = new System.Drawing.Point(168, 232); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(64, 24); this.buttonCancel.TabIndex = 3; @@ -189,14 +194,65 @@ this.groupBoxBlaster.TabStop = false; this.groupBoxBlaster.Text = "Blaster setup"; // + // groupBoxLearnTimeout + // + this.groupBoxLearnTimeout.Controls.Add(this.labelLearnIRTimeout); + this.groupBoxLearnTimeout.Controls.Add(this.numericUpDownLearnTimeout); + this.groupBoxLearnTimeout.Location = new System.Drawing.Point(8, 168); + this.groupBoxLearnTimeout.Name = "groupBoxLearnTimeout"; + this.groupBoxLearnTimeout.Size = new System.Drawing.Size(224, 56); + this.groupBoxLearnTimeout.TabIndex = 4; + this.groupBoxLearnTimeout.TabStop = false; + this.groupBoxLearnTimeout.Text = "Learn IR timeout (in milliseconds)"; + // + // labelLearnIRTimeout + // + this.labelLearnIRTimeout.Location = new System.Drawing.Point(8, 24); + this.labelLearnIRTimeout.Name = "labelLearnIRTimeout"; + this.labelLearnIRTimeout.Size = new System.Drawing.Size(120, 20); + this.labelLearnIRTimeout.TabIndex = 2; + this.labelLearnIRTimeout.Text = "Learn IR timeout:"; + this.labelLearnIRTimeout.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownLearnTimeout + // + this.numericUpDownLearnTimeout.Increment = new decimal(new int[] { + 500, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Location = new System.Drawing.Point(136, 24); + this.numericUpDownLearnTimeout.Maximum = new decimal(new int[] { + 60000, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Minimum = new decimal(new int[] { + 2000, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Name = "numericUpDownLearnTimeout"; + this.numericUpDownLearnTimeout.Size = new System.Drawing.Size(80, 20); + this.numericUpDownLearnTimeout.TabIndex = 3; + this.numericUpDownLearnTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownLearnTimeout.ThousandsSeparator = true; + this.toolTips.SetToolTip(this.numericUpDownLearnTimeout, "When teaching IR commands this is how long before the process times out"); + this.numericUpDownLearnTimeout.Value = new decimal(new int[] { + 8000, + 0, + 0, + 0}); + // // Configure // this.AcceptButton = this.buttonOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.buttonCancel; - this.ClientSize = new System.Drawing.Size(240, 202); + this.ClientSize = new System.Drawing.Size(240, 263); this.ControlBox = false; + this.Controls.Add(this.groupBoxLearnTimeout); this.Controls.Add(this.groupBoxBlaster); this.Controls.Add(this.groupBoxTimes); this.Controls.Add(this.buttonCancel); @@ -209,6 +265,8 @@ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonHeldDelay)).EndInit(); this.groupBoxTimes.ResumeLayout(false); this.groupBoxBlaster.ResumeLayout(false); + this.groupBoxLearnTimeout.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLearnTimeout)).EndInit(); this.ResumeLayout(false); } @@ -226,5 +284,8 @@ private System.Windows.Forms.ComboBox comboBoxBlasterType; private System.Windows.Forms.Label labelBlasterType; private System.Windows.Forms.GroupBox groupBoxBlaster; + private System.Windows.Forms.GroupBox groupBoxLearnTimeout; + private System.Windows.Forms.Label labelLearnIRTimeout; + private System.Windows.Forms.NumericUpDown numericUpDownLearnTimeout; } } \ No newline at end of file Modified: trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/Configure.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -31,6 +31,12 @@ set { numericUpDownButtonHeldDelay.Value = new Decimal(value); } } + public int LearnTimeout + { + get { return Decimal.ToInt32(numericUpDownLearnTimeout.Value); } + set { numericUpDownLearnTimeout.Value = new Decimal(value); } + } + #endregion Properties #region Constructor Modified: trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceIrApi.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceIrApi.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceIrApi.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -164,7 +164,6 @@ #region Methods [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrRegisterEvents(HandleRef windowHandle); /// <summary> /// Register your window handle to receive window messages from the MceIrApi. @@ -184,7 +183,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrUnregisterEvents(); /// <summary> /// Unregister from receiving window messages from the MceIrApi. @@ -203,7 +201,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrSetRepeatTimes(int firstRepeat, int nextRepeats); /// <summary> /// Sets the time between key presses being repeated. @@ -218,7 +215,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrRecordToFile(SafeFileHandle fileHandle, int timeout); /// <summary> /// Record an IR code to file. @@ -233,7 +229,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrPlaybackFromFile(SafeFileHandle fileHandle); /// <summary> /// Transmit an IR Code from a file. @@ -249,7 +244,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrSuspend(); /// <summary> /// Suspend the MceIrApi. @@ -265,7 +259,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrResume(); /// <summary> /// Resume the MceIrApi. @@ -282,7 +275,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrSelectBlaster(int portNumber); /// <summary> /// Select the Blaster port to use for transmitting IR Codes. @@ -295,7 +287,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrCheckFile(SafeFileHandle fileHandle); /// <summary> /// Check an IR Code file to ensure it is valid. @@ -309,7 +300,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrSetBlasterSpeed(int speed); /// <summary> /// Set the Speed to transmit IR Codes at. @@ -322,7 +312,6 @@ } [DllImport("MceIr.dll")] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool MceIrSetBlasterType(int type); /// <summary> /// Set the Type of MCE unit. Modified: trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceReplacementTransceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceReplacementTransceiver.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/MCE Replacement Transceiver/MceReplacementTransceiver.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -36,6 +36,7 @@ int _repeatDelay; int _heldDelay; + int _learnTimeout; #endregion Variables @@ -74,12 +75,14 @@ config.BlastType = _blasterType; config.RepeatDelay = _repeatDelay; config.HeldDelay = _heldDelay; + config.LearnTimeout = _learnTimeout; if (config.ShowDialog() == DialogResult.OK) { _blasterType = config.BlastType; _repeatDelay = config.RepeatDelay; _heldDelay = config.HeldDelay; + _learnTimeout = config.LearnTimeout; SaveSettings(); } @@ -157,19 +160,16 @@ DateTime start = DateTime.Now; - // TODO: Implement proper timeout ... - int timeout = 8000; + bool result = MceIrApi.RecordToFile(fileStream.SafeFileHandle, _learnTimeout); - bool result = MceIrApi.RecordToFile(fileStream.SafeFileHandle, timeout); - fileStream.Close(); TimeSpan timeTaken = start.Subtract(DateTime.Now); - if (timeTaken.Milliseconds >= timeout) + if (result) + return LearnStatus.Success; + else if (timeTaken.Milliseconds >= _learnTimeout) return LearnStatus.Timeout; - else if (result) - return LearnStatus.Success; else return LearnStatus.Failure; } @@ -215,6 +215,7 @@ _blasterType = (MceIrApi.BlasterType)Enum.Parse(typeof(MceIrApi.BlasterType), doc.DocumentElement.Attributes["BlastType"].Value); _repeatDelay = int.Parse(doc.DocumentElement.Attributes["RepeatDelay"].Value); _heldDelay = int.Parse(doc.DocumentElement.Attributes["HeldDelay"].Value); + _learnTimeout = int.Parse(doc.DocumentElement.Attributes["LearnTimeout"].Value); } catch (Exception ex) { @@ -223,6 +224,7 @@ _blasterType = MceIrApi.BlasterType.Microsoft; _repeatDelay = 500; _heldDelay = 250; + _learnTimeout = 8000; } } void SaveSettings() @@ -239,6 +241,7 @@ writer.WriteAttributeString("BlastType", Enum.GetName(typeof(MceIrApi.BlasterType), _blasterType)); writer.WriteAttributeString("RepeatDelay", _repeatDelay.ToString()); writer.WriteAttributeString("HeldDelay", _heldDelay.ToString()); + writer.WriteAttributeString("LearnTimeout", _learnTimeout.ToString()); writer.WriteEndElement(); // </settings> writer.WriteEndDocument(); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -40,10 +40,15 @@ this.comboBoxBlasterType = new System.Windows.Forms.ComboBox(); this.labelBlasterType = new System.Windows.Forms.Label(); this.groupBoxBlaster = new System.Windows.Forms.GroupBox(); + this.groupBoxLearnTimeout = new System.Windows.Forms.GroupBox(); + this.labelLearnIRTimeout = new System.Windows.Forms.Label(); + this.numericUpDownLearnTimeout = new System.Windows.Forms.NumericUpDown(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonRepeatDelay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonHeldDelay)).BeginInit(); this.groupBoxTimes.SuspendLayout(); this.groupBoxBlaster.SuspendLayout(); + this.groupBoxLearnTimeout.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLearnTimeout)).BeginInit(); this.SuspendLayout(); // // labelButtonRepeatDelay @@ -127,7 +132,7 @@ // // buttonOK // - this.buttonOK.Location = new System.Drawing.Point(96, 168); + this.buttonOK.Location = new System.Drawing.Point(96, 232); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(64, 24); this.buttonOK.TabIndex = 2; @@ -138,7 +143,7 @@ // buttonCancel // this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(168, 168); + this.buttonCancel.Location = new System.Drawing.Point(168, 232); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(64, 24); this.buttonCancel.TabIndex = 3; @@ -189,14 +194,65 @@ this.groupBoxBlaster.TabStop = false; this.groupBoxBlaster.Text = "Blaster setup"; // + // groupBoxLearnTimeout + // + this.groupBoxLearnTimeout.Controls.Add(this.labelLearnIRTimeout); + this.groupBoxLearnTimeout.Controls.Add(this.numericUpDownLearnTimeout); + this.groupBoxLearnTimeout.Location = new System.Drawing.Point(8, 168); + this.groupBoxLearnTimeout.Name = "groupBoxLearnTimeout"; + this.groupBoxLearnTimeout.Size = new System.Drawing.Size(224, 56); + this.groupBoxLearnTimeout.TabIndex = 5; + this.groupBoxLearnTimeout.TabStop = false; + this.groupBoxLearnTimeout.Text = "Learn IR timeout (in milliseconds)"; + // + // labelLearnIRTimeout + // + this.labelLearnIRTimeout.Location = new System.Drawing.Point(8, 24); + this.labelLearnIRTimeout.Name = "labelLearnIRTimeout"; + this.labelLearnIRTimeout.Size = new System.Drawing.Size(120, 20); + this.labelLearnIRTimeout.TabIndex = 2; + this.labelLearnIRTimeout.Text = "Learn IR timeout:"; + this.labelLearnIRTimeout.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownLearnTimeout + // + this.numericUpDownLearnTimeout.Increment = new decimal(new int[] { + 500, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Location = new System.Drawing.Point(136, 24); + this.numericUpDownLearnTimeout.Maximum = new decimal(new int[] { + 60000, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Minimum = new decimal(new int[] { + 2000, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Name = "numericUpDownLearnTimeout"; + this.numericUpDownLearnTimeout.Size = new System.Drawing.Size(80, 20); + this.numericUpDownLearnTimeout.TabIndex = 3; + this.numericUpDownLearnTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownLearnTimeout.ThousandsSeparator = true; + this.toolTips.SetToolTip(this.numericUpDownLearnTimeout, "When teaching IR commands this is how long before the process times out"); + this.numericUpDownLearnTimeout.Value = new decimal(new int[] { + 8000, + 0, + 0, + 0}); + // // Configure // this.AcceptButton = this.buttonOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.buttonCancel; - this.ClientSize = new System.Drawing.Size(240, 202); + this.ClientSize = new System.Drawing.Size(240, 263); this.ControlBox = false; + this.Controls.Add(this.groupBoxLearnTimeout); this.Controls.Add(this.groupBoxBlaster); this.Controls.Add(this.groupBoxTimes); this.Controls.Add(this.buttonCancel); @@ -209,6 +265,8 @@ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonHeldDelay)).EndInit(); this.groupBoxTimes.ResumeLayout(false); this.groupBoxBlaster.ResumeLayout(false); + this.groupBoxLearnTimeout.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLearnTimeout)).EndInit(); this.ResumeLayout(false); } @@ -226,5 +284,8 @@ private System.Windows.Forms.ComboBox comboBoxBlasterType; private System.Windows.Forms.Label labelBlasterType; private System.Windows.Forms.GroupBox groupBoxBlaster; + private System.Windows.Forms.GroupBox groupBoxLearnTimeout; + private System.Windows.Forms.Label labelLearnIRTimeout; + private System.Windows.Forms.NumericUpDown numericUpDownLearnTimeout; } } \ No newline at end of file Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -31,6 +31,12 @@ set { numericUpDownButtonHeldDelay.Value = new Decimal(value); } } + public int LearnTimeout + { + get { return Decimal.ToInt32(numericUpDownLearnTimeout.Value); } + set { numericUpDownLearnTimeout.Value = new Decimal(value); } + } + #endregion Properties #region Constructor Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -318,6 +318,8 @@ static int _repeatDelay; static int _heldDelay; + static int _learnTimeout; + static ArrayList _packetArray; static Guid _blasterGuid; static FileStream _blasterStream; @@ -367,12 +369,14 @@ config.BlastType = _blasterType; config.RepeatDelay = _repeatDelay; config.HeldDelay = _heldDelay; + config.LearnTimeout = _learnTimeout; if (config.ShowDialog() == DialogResult.OK) { _blasterType = config.BlastType; _repeatDelay = config.RepeatDelay; _heldDelay = config.HeldDelay; + _learnTimeout = config.LearnTimeout; SaveSettings(); } @@ -454,14 +458,11 @@ { _irData = null; - // TODO: Implement proper timeout - int timeout = 8000; - BeginLearn(new RemoteEventHandler(LearnIRDone)); // Wait for the learning to finish ... - while (_learning && Environment.TickCount < _learnStartTick + timeout) - Thread.Sleep(1000); + while (_learning && Environment.TickCount < _learnStartTick + _learnTimeout) + Thread.Sleep(500); if (_learning) { Modified: trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.Designer.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.Designer.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -36,8 +36,11 @@ this.toolTips = new System.Windows.Forms.ToolTip(this.components); this.labelRepeatCount = new System.Windows.Forms.Label(); this.numericUpDownRepeatCount = new System.Windows.Forms.NumericUpDown(); + this.labelLearnIRTimeout = new System.Windows.Forms.Label(); + this.numericUpDownLearnTimeout = new System.Windows.Forms.NumericUpDown(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonRepeatDelay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownRepeatCount)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLearnTimeout)).BeginInit(); this.SuspendLayout(); // // labelButtonRepeatDelay @@ -82,7 +85,7 @@ // buttonOK // this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOK.Location = new System.Drawing.Point(104, 72); + this.buttonOK.Location = new System.Drawing.Point(104, 104); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(64, 24); this.buttonOK.TabIndex = 4; @@ -94,7 +97,7 @@ // this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(176, 72); + this.buttonCancel.Location = new System.Drawing.Point(176, 104); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(64, 24); this.buttonCancel.TabIndex = 5; @@ -130,13 +133,54 @@ 0, 0}); // + // labelLearnIRTimeout + // + this.labelLearnIRTimeout.Location = new System.Drawing.Point(8, 72); + this.labelLearnIRTimeout.Name = "labelLearnIRTimeout"; + this.labelLearnIRTimeout.Size = new System.Drawing.Size(144, 20); + this.labelLearnIRTimeout.TabIndex = 6; + this.labelLearnIRTimeout.Text = "Learn IR timeout:"; + this.labelLearnIRTimeout.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownLearnTimeout + // + this.numericUpDownLearnTimeout.Increment = new decimal(new int[] { + 500, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Location = new System.Drawing.Point(152, 72); + this.numericUpDownLearnTimeout.Maximum = new decimal(new int[] { + 60000, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Minimum = new decimal(new int[] { + 2000, + 0, + 0, + 0}); + this.numericUpDownLearnTimeout.Name = "numericUpDownLearnTimeout"; + this.numericUpDownLearnTimeout.Size = new System.Drawing.Size(88, 20); + this.numericUpDownLearnTimeout.TabIndex = 7; + this.numericUpDownLearnTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownLearnTimeout.ThousandsSeparator = true; + this.toolTips.SetToolTip(this.numericUpDownLearnTimeout, "When teaching IR commands this is how long before the process times out"); + this.numericUpDownLearnTimeout.Value = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + // // Configure // this.AcceptButton = this.buttonOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.buttonCancel; - this.ClientSize = new System.Drawing.Size(248, 105); + this.ClientSize = new System.Drawing.Size(248, 137); + this.Controls.Add(this.labelLearnIRTimeout); + this.Controls.Add(this.numericUpDownLearnTimeout); this.Controls.Add(this.labelButtonRepeatDelay); this.Controls.Add(this.numericUpDownRepeatCount); this.Controls.Add(this.numericUpDownButtonRepeatDelay); @@ -145,7 +189,7 @@ this.Controls.Add(this.buttonOK); this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(256, 132); + this.MinimumSize = new System.Drawing.Size(256, 164); this.Name = "Configure"; this.ShowIcon = false; this.ShowInTaskbar = false; @@ -153,6 +197,7 @@ this.Text = "USB-UIRT Configuration"; ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonRepeatDelay)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownRepeatCount)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLearnTimeout)).EndInit(); this.ResumeLayout(false); } @@ -166,5 +211,7 @@ private System.Windows.Forms.ToolTip toolTips; private System.Windows.Forms.Label labelRepeatCount; private System.Windows.Forms.NumericUpDown numericUpDownRepeatCount; + private System.Windows.Forms.Label labelLearnIRTimeout; + private System.Windows.Forms.NumericUpDown numericUpDownLearnTimeout; } } \ No newline at end of file Modified: trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -24,6 +24,11 @@ get { return Decimal.ToInt32(numericUpDownRepeatCount.Value); } set { numericUpDownRepeatCount.Value = new Decimal(value); } } + public int LearnTimeout + { + get { return Decimal.ToInt32(numericUpDownLearnTimeout.Value); } + set { numericUpDownLearnTimeout.Value = new Decimal(value); } + } #endregion Properties Modified: trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.resx =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.resx 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Configure.resx 2007-07-12 03:23:10 UTC (rev 686) @@ -120,4 +120,7 @@ <metadata name="toolTips.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="toolTips.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/UirtTransceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/UirtTransceiver.cs 2007-07-11 22:05:26 UTC (rev 685) +++ trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/UirtTransceiver.cs 2007-07-12 03:23:10 UTC (rev 686) @@ -145,6 +145,7 @@ int _repeatDelay; int _blastRepeats; + int _learnTimeout; string _lastCode = String.Empty; DateTime _lastCodeTime = DateTime.Now; @@ -227,11 +228,13 @@ config.RepeatDelay = _repeatDelay; config.BlastRepeats = _blastRepeats; + config.LearnTimeout = _learnTimeout; if (config.ShowDialog() == DialogResult.OK) { _repeatDelay = config.RepeatDelay; _blastRepeats = config.BlastRepeats; + _learnTimeout = config.LearnTimeout; SaveSettings(); } @@ -308,9 +311,7 @@ _learnTimedOut = false; Timer timer = new Timer(); - - // TODO: Implement proper timeout ... - timer.Interval = 8000; + timer.Interval = _learnTimeout; timer.Tick += new EventHandler(timer_Tick); result = UirtTransceiver.UUIRTLearnIR( @@ -379,6 +380,7 @@ _repeatDelay = int.Parse(doc.DocumentElement.Attributes["RepeatDelay"].Value); _blastRepeats = int.Parse(doc.DocumentElement.Attributes["BlastRepeats"].Value); + _learnTimeout = int.Parse(doc.DocumentElement.Attributes["LearnTimeout"].Value); } catch (Exception ex) { @@ -386,6 +388,7 @@ _repeatDelay = 500; _blastRepeats = 4; + _learnTimeout = 10000; } } void SaveSettings() @@ -401,6 +404,7 @@ writer.WriteAttributeString("RepeatDelay", _repeatDelay.ToString()); writer.WriteAttributeString("BlastRepeats", _blastRepeats.ToString()); + writer.WriteAttributeString("LearnTimeout", _learnTimeout.ToString()); writer.WriteEndElement(); // </settings> writer.WriteEndDocument(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |