From: <an...@us...> - 2008-04-07 07:25:19
|
Revision: 1612 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1612&view=rev Author: and-81 Date: 2008-04-07 00:25:08 -0700 (Mon, 07 Apr 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.cs trunk/plugins/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs trunk/plugins/IR Server Suite/Applications/Web Remote/Program.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj trunk/plugins/IR Server Suite/Documentation/new.html trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Tray.cs Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.ComponentModel; using System.Data; using System.Diagnostics; using System.IO; @@ -62,6 +63,7 @@ #region Variables + Container _container; NotifyIcon _notifyIcon; bool _inConfiguration; @@ -96,7 +98,9 @@ public IRServer() { // Setup taskbar icon - _notifyIcon = new NotifyIcon(); + _container = new Container(); + + _notifyIcon = new NotifyIcon(_container); _notifyIcon.ContextMenuStrip = new ContextMenuStrip(); _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripLabel("IR Server")); @@ -140,8 +144,12 @@ StopServer(); StopClient(); + _notifyIcon.Visible = false; _notifyIcon.Dispose(); _notifyIcon = null; + + _container.Dispose(); + _container = null; } // Free native resources ... Modified: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -164,6 +164,7 @@ #region Variables + static Container _container; static NotifyIcon _notifyIcon; static bool _stealAppCommands = true; @@ -411,7 +412,8 @@ static void SetupNotify() { // Setup notify icon ... - _notifyIcon = new NotifyIcon(); + _container = new Container(); + _notifyIcon = new NotifyIcon(_container); _notifyIcon.Icon = Properties.Resources.Icon; _notifyIcon.Text = "Keyboard Input Relay - Connecting ..."; Modified: trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -124,7 +124,7 @@ Marshal.Copy(lpData, dataBytes, 0, dataStructure.cbData); string strData = Encoding.Default.GetString(dataBytes); - Program.ProcessCommand(strData, true); + Program.ProcessCommand(strData, false); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -38,6 +38,7 @@ #region Components + static Container _container; static NotifyIcon _notifyIcon; static MainForm _mainForm; static Client _client; @@ -161,7 +162,8 @@ */ // Setup notify icon ... - _notifyIcon = new NotifyIcon(); + _container = new Container(); + _notifyIcon = new NotifyIcon(_container); _notifyIcon.ContextMenuStrip = new ContextMenuStrip(); _notifyIcon.Icon = Properties.Resources.Icon16Connecting; _notifyIcon.Text = "Translator - Connecting ..."; @@ -228,9 +230,16 @@ _inConfiguration = false; } - + + // Dispose NotifyIcon ... _notifyIcon.Visible = false; + _notifyIcon.Dispose(); + _notifyIcon = null; + // Dispose Container ... + _container.Dispose(); + _container = null; + Application.ThreadException -= new ThreadExceptionEventHandler(Application_ThreadException); IrssLog.Close(); @@ -388,7 +397,6 @@ MapEvent(MappingEvent.PC_Shutdown); break; } - } internal static void UpdateNotifyMenu() @@ -1247,7 +1255,7 @@ if (!_notifyIcon.Visible) { _notifyIcon.Visible = true; - _notifyIcon.ShowBalloonTip(1000, "Translator", "Icon is now visible", ToolTipIcon.Info); + _notifyIcon.ShowBalloonTip(2000, "Translator", "Icon is now visible", ToolTipIcon.Info); } } else Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -42,6 +42,7 @@ bool _launchOnLoad; string _launchKeyCode; + Container _container; NotifyIcon _notifyIcon; bool _inConfiguration; @@ -74,7 +75,9 @@ contextMenu.Items.Add(new ToolStripMenuItem("&Setup", null, new EventHandler(ClickSetup))); contextMenu.Items.Add(new ToolStripMenuItem("&Quit", null, new EventHandler(ClickQuit))); - _notifyIcon = new NotifyIcon(); + _container = new Container(); + + _notifyIcon = new NotifyIcon(_container); _notifyIcon.ContextMenuStrip = contextMenu; _notifyIcon.DoubleClick += new EventHandler(ClickSetup); Modified: trunk/plugins/IR Server Suite/Applications/Web Remote/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Web Remote/Program.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Applications/Web Remote/Program.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; @@ -37,7 +38,8 @@ #endregion Constants #region Variables - + + static Container _container; static NotifyIcon _notifyIcon; static bool _inConfiguration; @@ -145,7 +147,8 @@ contextMenu.Items.Add(new ToolStripMenuItem("&Setup", null, new EventHandler(ClickSetup))); contextMenu.Items.Add(new ToolStripMenuItem("&Quit", null, new EventHandler(ClickQuit))); - _notifyIcon = new NotifyIcon(); + _container = new Container(); + _notifyIcon = new NotifyIcon(_container); _notifyIcon.ContextMenuStrip = contextMenu; _notifyIcon.DoubleClick += new EventHandler(ClickSetup); _notifyIcon.Icon = Properties.Resources.Icon; Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -505,24 +505,8 @@ // Give new process focus ... if (forceFocus && !process.StartInfo.CreateNoWindow && process.StartInfo.WindowStyle != ProcessWindowStyle.Hidden) { - Thread focusForcer = new Thread(new ParameterizedThreadStart(FocusForcer)); - focusForcer.Name = String.Format("Focus Forcer: {0}", process.MainWindowTitle); - focusForcer.IsBackground = true; - focusForcer.Start(process.Id); - - /* - int attempt = 0; - while (!process.HasExited && attempt++ < 50) - { - if (process.MainWindowHandle != IntPtr.Zero) - { - Win32.SetForegroundWindow(process.MainWindowHandle, true); - break; - } - - Thread.Sleep(500); - } - */ + FocusForcer forcer = new FocusForcer(process.Id); + forcer.Start(); } if (waitForExit) @@ -530,50 +514,6 @@ } } - - - static void FocusForcer(object processObj) - { - int processId = (int)processObj; - - Process process = Process.GetProcessById(processId); - - if (process == null) - throw new ArgumentException("Argument is not a Process object", "processObj"); - - process.WaitForInputIdle(15000); - - string title = String.Empty; - - - for (int i = 0; i < 30 && String.IsNullOrEmpty(title = process.MainWindowTitle) && process != null && !process.HasExited; i++) - Thread.Sleep(1000); - - if (String.IsNullOrEmpty(title) || process == null || process.HasExited) - return; - - IntPtr windowHandle; - - while ((windowHandle = Win32.FindWindowByTitle(title)) != IntPtr.Zero) - { - IntPtr focused = Win32.ForegroundWindow(); - - string focusedTitle = Win32.GetWindowTitle(focused); - - //Trace.WriteLine(String.Format("Focused: {0}", focused.ToInt32())); - - if (!title.Equals(focusedTitle, StringComparison.Ordinal) && !Win32.IsWindowChild(windowHandle, focused) && Win32.GetParentWindow(focused) != windowHandle) - { - Win32.SetForegroundWindow(windowHandle, true); - //Trace.WriteLine(String.Format("Give focus to {0}", windowHandle.ToInt32())); - } - - Thread.Sleep(1500); - - title = process.MainWindowTitle; - } - } - /// <summary> /// Given a split Serial Command this method will send the command over the serial port according to the command structure supplied. /// </summary> Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj 2008-04-07 07:25:08 UTC (rev 1612) @@ -21,7 +21,7 @@ <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG</DefineConstants> + <DefineConstants>TRACE;DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> @@ -44,6 +44,7 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> @@ -56,6 +57,7 @@ <Compile Include="Exceptions\CommandStructureException.cs" /> <Compile Include="Exceptions\CommandExecutionException.cs" /> <Compile Include="Exceptions\MacroStructureException.cs" /> + <Compile Include="FocusForcer.cs" /> <Compile Include="Forms\BlastCommand.cs"> <SubType>Form</SubType> </Compile> Modified: trunk/plugins/IR Server Suite/Documentation/new.html =================================================================== --- trunk/plugins/IR Server Suite/Documentation/new.html 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Documentation/new.html 2008-04-07 07:25:08 UTC (rev 1612) @@ -72,6 +72,7 @@ <LI>Input Service: Fixed some small plugin loading issues.</LI> <LI>Imon input plugin: Improved Imon plugin, now supports MCE and Imon PAD remote hardware.</LI> <LI>Tray Launcher: Now uses the Common program launching code (includes new focus forcing code).</LI> +<LI>Translator: Fixed a bug with the tray icon not re-appearing correctly after being hidden.</LI> </UL></P> <BR> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -280,7 +280,7 @@ DateTime _lastRemoteButtonTime = DateTime.Now; bool _remoteButtonRepeated = false; - byte _remoteToggle = 0x00; + byte _remoteToggle = 0; bool _keyboardKeyRepeated = false; DateTime _lastKeyboardKeyTime = DateTime.Now; @@ -644,12 +644,12 @@ if ((dataBytes[0] & 0xFC) == 0x28) // iMon PAD remote button { uint keyCode = IMON_PAD_BUTTON; - keyCode |= (uint)((dataBytes[0] & 0x03) << 6); - keyCode |= (uint)(dataBytes[1] & 0x30); - keyCode |= (uint)((dataBytes[1] & 0x06) << 1); - keyCode |= (uint)((dataBytes[2] & 0x80) >> 6); + keyCode += (uint)((dataBytes[0] & 0x03) << 6); + keyCode += (uint)(dataBytes[1] & 0x30); + keyCode += (uint)((dataBytes[1] & 0x06) << 1); + keyCode += (uint)((dataBytes[2] & 0xC0) >> 6); - if ((dataBytes[2] & 0x40) == 0) + if ((keyCode & 0x01) == 0 && (dataBytes[2] & 0x40) == 0) { RemoteEvent(keyCode, _remoteToggle != 1); _remoteToggle = 1; @@ -722,8 +722,6 @@ if (dataBytes[0] != 0xFF && dataBytes[0] != 0x00) ProcessInput(dataBytes); - - Thread.Sleep(50); } } } Modified: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Tray.cs =================================================================== --- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Tray.cs 2008-04-06 15:12:22 UTC (rev 1611) +++ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Tray.cs 2008-04-07 07:25:08 UTC (rev 1612) @@ -54,7 +54,8 @@ static string _learnIRFilename; static IRServerInfo _irServerInfo = new IRServerInfo(); - + + static Container _container; static NotifyIcon _notifyIcon; static MediaState _mediaState; @@ -134,7 +135,8 @@ contextMenu.Items.Add(new ToolStripMenuItem("&Setup", null, new EventHandler(ClickSetup))); contextMenu.Items.Add(new ToolStripMenuItem("&Quit", null, new EventHandler(ClickQuit))); - _notifyIcon = new NotifyIcon(); + _container = new Container(); + _notifyIcon = new NotifyIcon(_container); _notifyIcon.ContextMenuStrip = contextMenu; _notifyIcon.DoubleClick += new EventHandler(ClickSetup); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |