roam-commit Mailing List for Roam, a Windows Mobile library (Page 2)
Status: Alpha
Brought to you by:
jonfroehlich
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
(9) |
Apr
(10) |
May
|
Jun
|
Jul
(10) |
Aug
(1) |
Sep
(7) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(1) |
Feb
(9) |
Mar
(11) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jon...@us...> - 2008-02-09 11:59:21
|
Revision: 113
http://roam.svn.sourceforge.net/roam/?rev=113&view=rev
Author: jonfroehlich
Date: 2008-02-09 03:59:17 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
1. added snoozing events to NotificationForm
2. added the FileUtils static utility class and wrote one function which returns the binary data of a file
Modified Paths:
--------------
Trunk/Source/Roam.Common/Roam.Common.csproj
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Forms/NotificationForm.cs
Added Paths:
-----------
Trunk/Source/Roam.Common/Utils/FileUtils.cs
Modified: Trunk/Source/Roam.Common/Roam.Common.csproj
===================================================================
--- Trunk/Source/Roam.Common/Roam.Common.csproj 2008-02-08 03:11:13 UTC (rev 112)
+++ Trunk/Source/Roam.Common/Roam.Common.csproj 2008-02-09 11:59:17 UTC (rev 113)
@@ -78,6 +78,7 @@
<Compile Include="Utils\DirectoryUtils.cs" />
<Compile Include="Utils\EnumUtils.cs" />
<Compile Include="Utils\ErrorUtils.cs" />
+ <Compile Include="Utils\FileUtils.cs" />
<Compile Include="Utils\ImagingUtils.cs" />
<Compile Include="Utils\MeasurementUtils.cs" />
<Compile Include="Utils\SummaryStatistics.cs" />
Added: Trunk/Source/Roam.Common/Utils/FileUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/FileUtils.cs (rev 0)
+++ Trunk/Source/Roam.Common/Utils/FileUtils.cs 2008-02-09 11:59:17 UTC (rev 113)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+
+namespace Roam.Common.Utils
+{
+ public static class FileUtils
+ {
+ public static byte[] GetBinaryData(string filename)
+ {
+ FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
+ int length = (int)fs.Length;
+ byte[] data = new byte[length];
+ int bytesRead = fs.Read(data, 0, length);
+ fs.Close();
+ return data;
+ }
+ }
+}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2008-02-08 03:11:13 UTC (rev 112)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2008-02-09 11:59:17 UTC (rev 113)
@@ -83,12 +83,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Media\MediaCapturedTest.cs">
- <SubType>Form</SubType>
- </Compile>
- <Compile Include="Media\MediaCapturedTest.Designer.cs">
- <DependentUpon>MediaCapturedTest.cs</DependentUpon>
- </Compile>
<Compile Include="Media\SoundLoopPlayerTest.cs">
<SubType>Form</SubType>
</Compile>
@@ -138,10 +132,6 @@
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
- <EmbeddedResource Include="Media\MediaCapturedTest.resx">
- <SubType>Designer</SubType>
- <DependentUpon>MediaCapturedTest.cs</DependentUpon>
- </EmbeddedResource>
<EmbeddedResource Include="Media\SoundLoopPlayerTest.resx">
<SubType>Designer</SubType>
<DependentUpon>SoundLoopPlayerTest.cs</DependentUpon>
@@ -574,7 +564,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Forms/NotificationForm.cs
===================================================================
--- Trunk/Source/Roam.UI/Forms/NotificationForm.cs 2008-02-08 03:11:13 UTC (rev 112)
+++ Trunk/Source/Roam.UI/Forms/NotificationForm.cs 2008-02-09 11:59:17 UTC (rev 113)
@@ -41,6 +41,9 @@
{
private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(typeof(NotificationForm));
+ public event EventHandler Snoozing;
+ public event EventHandler Snoozed;
+
#region Private Fields
private IImage _imgOverlay;
private IImage _img;
@@ -405,6 +408,22 @@
_log.DebugFormat("{0}:OnLoad : Exited", Text);
}
+ protected virtual void OnSnoozing(EventArgs e)
+ {
+ if (Snoozing != null)
+ {
+ Snoozing(this, e);
+ }
+ }
+
+ protected virtual void OnSnoozed(EventArgs e)
+ {
+ if (Snoozed != null)
+ {
+ Snoozed(this, e);
+ }
+ }
+
protected virtual void StartNotify()
{
if (_turnOnScreen)
@@ -502,8 +521,10 @@
{
_reminderCount++;
_timer.Interval = (int)_snoozeInterval.TotalMilliseconds;
+ OnSnoozing(EventArgs.Empty);
_isSnoozing = true;
this.Visible = false;
+ OnSnoozed(EventArgs.Empty);
_log.DebugFormat("{0}:UpdateSnoozeDisplayTimer : Repeat count set to {1}; SnoozeInterval timer set to {2}",
Text, _reminderCount, _snoozeInterval);
}
@@ -525,7 +546,6 @@
Text, _isSnoozing, this.Visible, _reminderCount, _timer.Enabled);
}
}
-
#endregion Protected Methods
#region Private Methods
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2008-02-08 03:11:14
|
Revision: 112
http://roam.svn.sourceforge.net/roam/?rev=112&view=rev
Author: jonfroehlich
Date: 2008-02-07 19:11:13 -0800 (Thu, 07 Feb 2008)
Log Message:
-----------
1. fixed issue with KeyUtils mapping 12-key keypads to characters when a character was not found. it's not 100% fixed but i added characters for the common cases
2. updated ScrollableLabel with two new methods: ScrollToTop and ScrollToBottom and added the property RequiresScrolling
Modified Paths:
--------------
Trunk/Source/Roam.Common/Utils/ColorUtils.cs
Trunk/Source/Roam.Common/Utils/KeyUtils.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Common/Utils/ColorUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/ColorUtils.cs 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.Common/Utils/ColorUtils.cs 2008-02-08 03:11:13 UTC (rev 112)
@@ -19,6 +19,7 @@
using System.Drawing;
using System.Collections.Generic;
using System.Reflection;
+using System.Globalization;
namespace Roam.Common.Utils
{
@@ -60,6 +61,12 @@
return color.ToArgb().ToString("X").Substring(2);
}
+ public static Color FromHexadecimalRgb(string rbgString)
+ {
+ int rgbValue = int.Parse(rbgString, NumberStyles.HexNumber);
+ return Color.FromArgb(rgbValue);
+ }
+
public static string ToString(Color color)
{
return string.Format("[{0}, {1}, {2}, {3}]", color.R, color.G, color.B, color.A);
Modified: Trunk/Source/Roam.Common/Utils/KeyUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/KeyUtils.cs 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.Common/Utils/KeyUtils.cs 2008-02-08 03:11:13 UTC (rev 112)
@@ -186,6 +186,21 @@
case 'z':
return '9';
case '*':
+ case '(':
+ case ')':
+ case '%':
+ case '<':
+ case '>':
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '|':
+ case '^':
+ case '$':
+ case '=':
+ case '~':
+ case '`':
return '*';
case ' ':
case '#':
@@ -199,6 +214,10 @@
{
switch (c)
{
+ case '#':
+ return new char[] { ' ', '#' };
+ case '*':
+ return new char[] { '*', '(', ')', '%', '<', '>', '{', '}', '[', ']', '|', '^', '$', '=', '~', '`' };
case '0':
return new char[] { '0' };
case '1':
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2008-02-08 03:11:13 UTC (rev 112)
@@ -83,6 +83,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Media\MediaCapturedTest.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Media\MediaCapturedTest.Designer.cs">
+ <DependentUpon>MediaCapturedTest.cs</DependentUpon>
+ </Compile>
<Compile Include="Media\SoundLoopPlayerTest.cs">
<SubType>Form</SubType>
</Compile>
@@ -132,6 +138,10 @@
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="Media\MediaCapturedTest.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MediaCapturedTest.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Media\SoundLoopPlayerTest.resx">
<SubType>Designer</SubType>
<DependentUpon>SoundLoopPlayerTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs 2008-02-08 03:11:13 UTC (rev 112)
@@ -45,6 +45,7 @@
private bool _useScrollLock = false;
private bool _showScrollBar = true;
private bool _beginUpdate = false;
+ private bool _requiresScrolling = false;
private Bitmap _bmpOffScreen = new Bitmap(1, 1);
private Keys _keyDown = Keys.None;
private int _keyDownCount = 0;
@@ -58,6 +59,8 @@
private Fill _backFill = new FillSimpleLinearGradient(new SimpleLinearGradient(Color.FromArgb(206, 223, 239), Color.White, SimpleLinearGradient.FillDirection.TopToBottom));
private Insets _textInsets = new Insets(1, 1, 1, 1);
#endregion Private Fields
+
+ #region Constructors
public ScrollableLabel()
: this(String.Empty)
{
@@ -83,9 +86,9 @@
OnResize(EventArgs.Empty);
Text = text;
}
+ #endregion Constructors
#region Properties
-
public Insets TextInsets
{
get { return _textInsets; }
@@ -238,6 +241,14 @@
}
}
+ /// <summary>
+ /// Returns true if the amount of text in the label is enough to warrant scrolling.
+ /// </summary>
+ public bool RequiresScrolling
+ {
+ get { return _requiresScrolling; }
+ }
+
public int PreferredHeight
{
get
@@ -278,6 +289,18 @@
#endregion Properties
#region Public Methods
+ public void ScrollToTop()
+ {
+ this.VScrollBar.Value = this.VScrollBar.Minimum;
+ this.Invalidate();
+ }
+
+ public void ScrollToBottom()
+ {
+ this.VScrollBar.Value = this.VScrollBar.Maximum;
+ this.Invalidate();
+ }
+
public void BeginUpdate()
{
_beginUpdate = true;
@@ -405,6 +428,12 @@
drawableArea.Width - _textInsets.TotalHorizontalInset);
float textHeightWithInsets = _textBounds.Height + _textInsets.TotalVerticalInset;
+ //the minus 5 is just so we don't get scrolling when it's really not needed
+ if (textHeightWithInsets - 5 > drawableArea.Height)
+ {
+ _requiresScrolling = true;
+ }
+
//set the scroll bar parameters based on text bounds
if (textHeightWithInsets > drawableArea.Height && _showScrollBar)
{
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2008-01-07 17:05:14
|
Revision: 111
http://roam.svn.sourceforge.net/roam/?rev=111&view=rev
Author: jonfroehlich
Date: 2008-01-07 09:05:10 -0800 (Mon, 07 Jan 2008)
Log Message:
-----------
updated csproj
Modified Paths:
--------------
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-12-12 08:38:05 UTC (rev 110)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2008-01-07 17:05:10 UTC (rev 111)
@@ -702,7 +702,7 @@
<DependentUpon>SystemColorTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\TabControlTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\TabControlTest.Designer.cs">
<DependentUpon>TabControlTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-12-12 08:38:10
|
Revision: 110
http://roam.svn.sourceforge.net/roam/?rev=110&view=rev
Author: jonfroehlich
Date: 2007-12-12 00:38:05 -0800 (Wed, 12 Dec 2007)
Log Message:
-----------
updated CameraMediaCapturedSniffer
Modified Paths:
--------------
Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs
Trunk/Source/Roam/Roam.csproj
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.sln
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs
===================================================================
--- Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs 2007-12-07 06:40:03 UTC (rev 109)
+++ Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs 2007-12-12 08:38:05 UTC (rev 110)
@@ -20,6 +20,7 @@
using System.Threading;
using Microsoft.WindowsMobile.Status;
using System.Diagnostics;
+using Roam.Utils;
namespace Roam.Media
{
@@ -38,6 +39,7 @@
{
public event EventHandler<MediaCapturedEventArgs> MediaCaptured;
+ #region Fields
private List<FileSystemWatcher> _listFileSystemWatchers = new List<FileSystemWatcher>();
/// <summary>
@@ -47,8 +49,10 @@
/// not work. Therefore, our filter is set to *.* -- we can always filter
/// after we receive a FileCreatedEvent
/// </summary>
- private string _filter = "*.*";
+ private string _filter = "*.*";
+ #endregion Fields
+ #region Constructors
public CameraMediaCapturedSniffer()
{
string[] paths = GetMediaPathsToMonitor();
@@ -62,27 +66,21 @@
FileSystemWatcher fsw = new FileSystemWatcher(paths[i], _filter);
fsw.Created += new FileSystemEventHandler(OnFileCreated);
+ fsw.IncludeSubdirectories = true;
fsw.EnableRaisingEvents = true;
- fsw.NotifyFilter = NotifyFilters.FileName;
+ fsw.NotifyFilter = NotifyFilters.FileName;// | NotifyFilters.DirectoryName;
- FileSystemWatcher fsw2 = new FileSystemWatcher(paths[i], _filter);
- fsw2.Changed += new FileSystemEventHandler(OnFileChanged);
- fsw2.EnableRaisingEvents = true;
- fsw2.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
-
_listFileSystemWatchers.Add(fsw);
}
}
+ #endregion Constructors
- public virtual void OnFileChanged(object sender, FileSystemEventArgs e)
- {
- Debug.WriteLine("OnFileChanged: " + e.FullPath);
- }
-
+ #region Methods
public virtual void Dispose()
{
foreach (FileSystemWatcher fsw in _listFileSystemWatchers)
{
+ fsw.Created -= new FileSystemEventHandler(OnFileCreated);
fsw.Dispose();
}
_listFileSystemWatchers.Clear();
@@ -90,39 +88,33 @@
protected virtual string[] GetMediaPathsToMonitor()
{
- //jeffixme the location of the date dir needs to change
- //when the day rollovers;
- //we can either update them each time the date changes or
- //only when the camera application is being used (check system state)
- string dateDir = DateTime.Now.ToString("MM-dd-yyyy") + " 00001";
-
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- //a previous version of this class received these paths
+ //TODO: a previous version of this class received these paths
//from the Registry--should I go back to that?
- string localPicturePath = @"My Documents\My Pictures\";
- string storagePicturePath = @"\Storage Card\My Documents\My Pictures\";
- string localVideoPath = @"My Documents\My Videos\";
- string storageVideoPath = @"\Storage Card\My Documents\My Videos\";
+ //the path is [HKEY_CURRENT_USER\Software\Microsoft\Pictures\Camera\USER]
+ //it seems like this value is empty (defaultdir) is empty though.
+ List<string> paths = new List<string>(8);
+ string localPicturePath = @"\My Documents\My Pictures";
+ string localVideoPath = @"\My Documents\My Videos";
+ paths.Add(localPicturePath);
+ paths.Add(localVideoPath);
- string[] paths = new string[] {
- localPicturePath, storagePicturePath, localVideoPath, storageVideoPath,
- Path.Combine(localPicturePath, dateDir), Path.Combine(storagePicturePath, dateDir),
- Path.Combine(localVideoPath, dateDir), Path.Combine(storageVideoPath, dateDir)
- };
- return paths;
+ if (StorageCardUtils.FlashCardExists())
+ {
+ string storageCardPath = StorageCardUtils.GetFirstFlashCardPath();
+ string storagePicturePath = "\\" + Path.Combine(storageCardPath, @"My Documents\My Pictures");
+ string storageVideoPath = "\\" + Path.Combine(storageCardPath, @"My Documents\My Videos");
+ paths.Add(storagePicturePath);
+ paths.Add(storageVideoPath);
+ }
+
+ return paths.ToArray();
}
private void OnFileCreated(object sender, FileSystemEventArgs e)
{
- Debug.WriteLine("OnFileCreated: " + e.FullPath);
string activeApp = SystemState.ActiveApplication;
-
+ Debug.WriteLine("OnFileCreated: " + e.FullPath);
+
//use file exists to make sure its a file and not a dir that
//passed through the filter
if (File.Exists(e.FullPath))
@@ -148,7 +140,7 @@
{
if (File.Exists(mediaCapturedEventArgs.FullPath))
{
- //see if we can open the file (OnFileCreated is called before the file is fully written)
+ //see if we can open the file (OnFileCreated can be called before the file is fully written)
Stream s = File.Open(mediaCapturedEventArgs.FullPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
s.Close();
successfullyOpened = true;
@@ -183,6 +175,7 @@
MediaCaptured(sender, mcea);
}
}
+ #endregion Methods
}
/// <summary>
@@ -194,11 +187,14 @@
/// <author>Jon Froehlich</author>
public class MediaCapturedEventArgs : EventArgs
{
+ #region Fields
private string _directory;
private string _filename;
private string _activeApp;
private MediaType _mediaType;
+ #endregion Fields
+ #region Constructors
public MediaCapturedEventArgs(string directory, string filename, string activeAppAtTimeOfCapture)
{
_directory = directory;
@@ -206,13 +202,17 @@
_activeApp = activeAppAtTimeOfCapture;
_mediaType = GetMediaType(filename);
}
+ #endregion Constructors
+ #region Properties
public string ActiveApplication { get { return _activeApp; } }
public string FullPath { get { return Path.Combine(_directory, _filename); } }
public string Directory { get { return _directory; } }
public string Filename { get { return _filename; } }
public MediaType MediaType { get { return _mediaType; } }
+ #endregion Properties
+ #region Methods
protected virtual MediaType GetMediaType(string filename)
{
string ext = Path.GetExtension(filename);
@@ -232,6 +232,7 @@
return MediaType.Unknown;
}
}
+ #endregion Methods
}
/// <summary>
Modified: Trunk/Source/Roam/Roam.csproj
===================================================================
--- Trunk/Source/Roam/Roam.csproj 2007-12-07 06:40:03 UTC (rev 109)
+++ Trunk/Source/Roam/Roam.csproj 2007-12-12 08:38:05 UTC (rev 110)
@@ -69,7 +69,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Media\CameraMediaSniffer.cs" />
+ <Compile Include="Media\CameraMediaCapturedSniffer.cs" />
<Compile Include="Media\CyclePlayer.cs" />
<Compile Include="Media\LedPlayer.cs" />
<Compile Include="Media\Player.cs" />
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-12-07 06:40:03 UTC (rev 109)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-12-12 08:38:05 UTC (rev 110)
@@ -564,7 +564,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.sln
===================================================================
--- Trunk/Source/Roam.sln 2007-12-07 06:40:03 UTC (rev 109)
+++ Trunk/Source/Roam.sln 2007-12-12 08:38:05 UTC (rev 110)
@@ -18,10 +18,6 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.Roam", "Sandbox.Roam\Sandbox.Roam.csproj", "{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerTest", "PowerTest\PowerTest.csproj", "{3B5B1E77-4C54-4C1F-A7CC-127951DA9165}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2C7DA866-BB34-4F97-98E9-A5CD2DB49090}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -132,25 +128,8 @@
{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Debug|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Any CPU.Build.0 = Release|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {3B5B1E77-4C54-4C1F-A7CC-127951DA9165} = {2C7DA866-BB34-4F97-98E9-A5CD2DB49090}
- EndGlobalSection
EndGlobal
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-12-07 06:40:08
|
Revision: 109
http://roam.svn.sourceforge.net/roam/?rev=109&view=rev
Author: jonfroehlich
Date: 2007-12-06 22:40:03 -0800 (Thu, 06 Dec 2007)
Log Message:
-----------
renamed CameraMediaSniffer.cs to CameraMediaCapturedSniffer.cs
Modified Paths:
--------------
Trunk/Source/Roam.Test/UI/Controls/CameraMediaSnifferTest.cs
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs
Removed Paths:
-------------
Trunk/Source/Roam/Media/CameraMediaSniffer.cs
Added: Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs
===================================================================
--- Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs (rev 0)
+++ Trunk/Source/Roam/Media/CameraMediaCapturedSniffer.cs 2007-12-07 06:40:03 UTC (rev 109)
@@ -0,0 +1,250 @@
+#region Copyright & License
+//
+// Copyright (c) 2005 - 2007 The Regents of the University of Washington, Intel
+// Research Seattle, and the Roam project. All rights reserved.
+//
+// This software is open-source under the BSD license. You may obtain a copy
+// of this license at
+//
+// http://roam.sourceforge.net/license.txt
+//
+// Alternatively, please see "license.txt" which should be included in
+// this source code distribution.
+//
+#endregion Copyright & License
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenNETCF.IO;
+using System.IO;
+using System.Threading;
+using Microsoft.WindowsMobile.Status;
+using System.Diagnostics;
+
+namespace Roam.Media
+{
+ /// <summary>
+ /// jeffixme : need to update this to work dynamically when a storage card is
+ /// removed/added
+ /// </summary>
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ public class CameraMediaCapturedSniffer : IDisposable
+ {
+ public event EventHandler<MediaCapturedEventArgs> MediaCaptured;
+
+ private List<FileSystemWatcher> _listFileSystemWatchers = new List<FileSystemWatcher>();
+
+ /// <summary>
+ /// So, unfortunately, we cannot combine file extensions in our filter string.
+ /// This is a limitation of the FileSystemWatcher. So, for example, a filter
+ /// string of "*.mp4, *.avi" to watch for two different video file formats would
+ /// not work. Therefore, our filter is set to *.* -- we can always filter
+ /// after we receive a FileCreatedEvent
+ /// </summary>
+ private string _filter = "*.*";
+
+ public CameraMediaCapturedSniffer()
+ {
+ string[] paths = GetMediaPathsToMonitor();
+
+ for (int i = 0; i < paths.Length; i++)
+ {
+ //jeffixme : we should never create the Storage Card directory
+ //so we should check to see if they have a Storage Card
+ //i suppose we should also dynamically check if they place/remove a storage card
+ if (!Directory.Exists(paths[i])) { Directory.CreateDirectory(paths[i]); }
+
+ FileSystemWatcher fsw = new FileSystemWatcher(paths[i], _filter);
+ fsw.Created += new FileSystemEventHandler(OnFileCreated);
+ fsw.EnableRaisingEvents = true;
+ fsw.NotifyFilter = NotifyFilters.FileName;
+
+ FileSystemWatcher fsw2 = new FileSystemWatcher(paths[i], _filter);
+ fsw2.Changed += new FileSystemEventHandler(OnFileChanged);
+ fsw2.EnableRaisingEvents = true;
+ fsw2.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
+
+ _listFileSystemWatchers.Add(fsw);
+ }
+ }
+
+ public virtual void OnFileChanged(object sender, FileSystemEventArgs e)
+ {
+ Debug.WriteLine("OnFileChanged: " + e.FullPath);
+ }
+
+ public virtual void Dispose()
+ {
+ foreach (FileSystemWatcher fsw in _listFileSystemWatchers)
+ {
+ fsw.Dispose();
+ }
+ _listFileSystemWatchers.Clear();
+ }
+
+ protected virtual string[] GetMediaPathsToMonitor()
+ {
+ //jeffixme the location of the date dir needs to change
+ //when the day rollovers;
+ //we can either update them each time the date changes or
+ //only when the camera application is being used (check system state)
+ string dateDir = DateTime.Now.ToString("MM-dd-yyyy") + " 00001";
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ //a previous version of this class received these paths
+ //from the Registry--should I go back to that?
+ string localPicturePath = @"My Documents\My Pictures\";
+ string storagePicturePath = @"\Storage Card\My Documents\My Pictures\";
+ string localVideoPath = @"My Documents\My Videos\";
+ string storageVideoPath = @"\Storage Card\My Documents\My Videos\";
+
+ string[] paths = new string[] {
+ localPicturePath, storagePicturePath, localVideoPath, storageVideoPath,
+ Path.Combine(localPicturePath, dateDir), Path.Combine(storagePicturePath, dateDir),
+ Path.Combine(localVideoPath, dateDir), Path.Combine(storageVideoPath, dateDir)
+ };
+ return paths;
+ }
+
+ private void OnFileCreated(object sender, FileSystemEventArgs e)
+ {
+ Debug.WriteLine("OnFileCreated: " + e.FullPath);
+ string activeApp = SystemState.ActiveApplication;
+
+ //use file exists to make sure its a file and not a dir that
+ //passed through the filter
+ if (File.Exists(e.FullPath))
+ {
+ ThreadPool.QueueUserWorkItem(MediaCapturedCallback,
+ new MediaCapturedEventArgs(Path.GetDirectoryName(e.FullPath),
+ e.Name, activeApp));
+ }
+ }
+
+ private void MediaCapturedCallback(object state)
+ {
+ MediaCapturedEventArgs mediaCapturedEventArgs = (MediaCapturedEventArgs)state;
+
+ int maxRetries = 200;
+ int retryCount = 0;
+ int delayMS = 50;
+ int maxSingleDelayMS = 5000;
+ bool successfullyOpened = false;
+ while (!successfullyOpened && retryCount < maxRetries)
+ {
+ try
+ {
+ if (File.Exists(mediaCapturedEventArgs.FullPath))
+ {
+ //see if we can open the file (OnFileCreated is called before the file is fully written)
+ Stream s = File.Open(mediaCapturedEventArgs.FullPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
+ s.Close();
+ successfullyOpened = true;
+ }
+ else
+ {
+ throw new FileNotFoundException(mediaCapturedEventArgs.FullPath);
+ }
+ }
+ catch (IOException ioe)
+ {
+ Debug.WriteLine(ioe.Message);
+ int delay = Math.Min(delayMS * (retryCount + 1), maxSingleDelayMS);
+ Thread.Sleep(delay);
+ retryCount++;
+ }
+ }
+
+ Debug.WriteLine(string.Format("SuccessFullyOpened: {2} RetryCount: {1} MaxRetries: {0}",
+ maxRetries, retryCount, successfullyOpened));
+
+ if (successfullyOpened)
+ {
+ OnMediaCapturedEvent(this, mediaCapturedEventArgs);
+ }
+ }
+
+ protected virtual void OnMediaCapturedEvent(object sender, MediaCapturedEventArgs mcea)
+ {
+ if (MediaCaptured != null)
+ {
+ MediaCaptured(sender, mcea);
+ }
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ public class MediaCapturedEventArgs : EventArgs
+ {
+ private string _directory;
+ private string _filename;
+ private string _activeApp;
+ private MediaType _mediaType;
+
+ public MediaCapturedEventArgs(string directory, string filename, string activeAppAtTimeOfCapture)
+ {
+ _directory = directory;
+ _filename = filename;
+ _activeApp = activeAppAtTimeOfCapture;
+ _mediaType = GetMediaType(filename);
+ }
+
+ public string ActiveApplication { get { return _activeApp; } }
+ public string FullPath { get { return Path.Combine(_directory, _filename); } }
+ public string Directory { get { return _directory; } }
+ public string Filename { get { return _filename; } }
+ public MediaType MediaType { get { return _mediaType; } }
+
+ protected virtual MediaType GetMediaType(string filename)
+ {
+ string ext = Path.GetExtension(filename);
+ switch (ext)
+ {
+ case ".jpg":
+ case ".png":
+ case ".gif":
+ return MediaType.Photo;
+ case ".3gp":
+ case ".mp4":
+ case ".qt":
+ case ".mpg":
+ case ".avi":
+ return MediaType.Video;
+ default:
+ return MediaType.Unknown;
+ }
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ public enum MediaType
+ {
+ Photo,
+ Video,
+ Unknown
+ }
+}
Deleted: Trunk/Source/Roam/Media/CameraMediaSniffer.cs
===================================================================
--- Trunk/Source/Roam/Media/CameraMediaSniffer.cs 2007-12-07 06:31:14 UTC (rev 108)
+++ Trunk/Source/Roam/Media/CameraMediaSniffer.cs 2007-12-07 06:40:03 UTC (rev 109)
@@ -1,250 +0,0 @@
-#region Copyright & License
-//
-// Copyright (c) 2005 - 2007 The Regents of the University of Washington, Intel
-// Research Seattle, and the Roam project. All rights reserved.
-//
-// This software is open-source under the BSD license. You may obtain a copy
-// of this license at
-//
-// http://roam.sourceforge.net/license.txt
-//
-// Alternatively, please see "license.txt" which should be included in
-// this source code distribution.
-//
-#endregion Copyright & License
-using System;
-using System.Collections.Generic;
-using System.Text;
-using OpenNETCF.IO;
-using System.IO;
-using System.Threading;
-using Microsoft.WindowsMobile.Status;
-using System.Diagnostics;
-
-namespace Roam.Media
-{
- /// <summary>
- /// jeffixme : need to update this to work dynamically when a storage card is
- /// removed/added
- /// </summary>
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- public class CameraMediaSniffer : IDisposable
- {
- public event EventHandler<MediaCapturedEventArgs> MediaCaptured;
-
- private List<FileSystemWatcher> _listFileSystemWatchers = new List<FileSystemWatcher>();
-
- /// <summary>
- /// So, unfortunately, we cannot combine file extensions in our filter string.
- /// This is a limitation of the FileSystemWatcher. So, for example, a filter
- /// string of "*.mp4, *.avi" to watch for two different video file formats would
- /// not work. Therefore, our filter is set to *.* -- we can always filter
- /// after we receive a FileCreatedEvent
- /// </summary>
- private string _filter = "*.*";
-
- public CameraMediaSniffer()
- {
- string[] paths = GetMediaPathsToMonitor();
-
- for (int i = 0; i < paths.Length; i++)
- {
- //jeffixme : we should never create the Storage Card directory
- //so we should check to see if they have a Storage Card
- //i suppose we should also dynamically check if they place/remove a storage card
- if (!Directory.Exists(paths[i])) { Directory.CreateDirectory(paths[i]); }
-
- FileSystemWatcher fsw = new FileSystemWatcher(paths[i], _filter);
- fsw.Created += new FileSystemEventHandler(OnFileCreated);
- fsw.EnableRaisingEvents = true;
- fsw.NotifyFilter = NotifyFilters.FileName;
-
- FileSystemWatcher fsw2 = new FileSystemWatcher(paths[i], _filter);
- fsw2.Changed += new FileSystemEventHandler(OnFileChanged);
- fsw2.EnableRaisingEvents = true;
- fsw2.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
-
- _listFileSystemWatchers.Add(fsw);
- }
- }
-
- public virtual void OnFileChanged(object sender, FileSystemEventArgs e)
- {
- Debug.WriteLine("OnFileChanged: " + e.FullPath);
- }
-
- public virtual void Dispose()
- {
- foreach (FileSystemWatcher fsw in _listFileSystemWatchers)
- {
- fsw.Dispose();
- }
- _listFileSystemWatchers.Clear();
- }
-
- protected virtual string[] GetMediaPathsToMonitor()
- {
- //jeffixme the location of the date dir needs to change
- //when the day rollovers;
- //we can either update them each time the date changes or
- //only when the camera application is being used (check system state)
- string dateDir = DateTime.Now.ToString("MM-dd-yyyy") + " 00001";
-
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- //a previous version of this class received these paths
- //from the Registry--should I go back to that?
- string localPicturePath = @"My Documents\My Pictures\";
- string storagePicturePath = @"\Storage Card\My Documents\My Pictures\";
- string localVideoPath = @"My Documents\My Videos\";
- string storageVideoPath = @"\Storage Card\My Documents\My Videos\";
-
- string[] paths = new string[] {
- localPicturePath, storagePicturePath, localVideoPath, storageVideoPath,
- Path.Combine(localPicturePath, dateDir), Path.Combine(storagePicturePath, dateDir),
- Path.Combine(localVideoPath, dateDir), Path.Combine(storageVideoPath, dateDir)
- };
- return paths;
- }
-
- private void OnFileCreated(object sender, FileSystemEventArgs e)
- {
- Debug.WriteLine("OnFileCreated: " + e.FullPath);
- string activeApp = SystemState.ActiveApplication;
-
- //use file exists to make sure its a file and not a dir that
- //passed through the filter
- if (File.Exists(e.FullPath))
- {
- ThreadPool.QueueUserWorkItem(MediaCapturedCallback,
- new MediaCapturedEventArgs(Path.GetDirectoryName(e.FullPath),
- e.Name, activeApp));
- }
- }
-
- private void MediaCapturedCallback(object state)
- {
- MediaCapturedEventArgs mediaCapturedEventArgs = (MediaCapturedEventArgs)state;
-
- int maxRetries = 200;
- int retryCount = 0;
- int delayMS = 50;
- int maxSingleDelayMS = 5000;
- bool successfullyOpened = false;
- while (!successfullyOpened && retryCount < maxRetries)
- {
- try
- {
- if (File.Exists(mediaCapturedEventArgs.FullPath))
- {
- //see if we can open the file (OnFileCreated is called before the file is fully written)
- Stream s = File.Open(mediaCapturedEventArgs.FullPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
- s.Close();
- successfullyOpened = true;
- }
- else
- {
- throw new FileNotFoundException(mediaCapturedEventArgs.FullPath);
- }
- }
- catch (IOException ioe)
- {
- Debug.WriteLine(ioe.Message);
- int delay = Math.Min(delayMS * (retryCount + 1), maxSingleDelayMS);
- Thread.Sleep(delay);
- retryCount++;
- }
- }
-
- Debug.WriteLine(string.Format("SuccessFullyOpened: {2} RetryCount: {1} MaxRetries: {0}",
- maxRetries, retryCount, successfullyOpened));
-
- if (successfullyOpened)
- {
- OnMediaCapturedEvent(this, mediaCapturedEventArgs);
- }
- }
-
- protected virtual void OnMediaCapturedEvent(object sender, MediaCapturedEventArgs mcea)
- {
- if (MediaCaptured != null)
- {
- MediaCaptured(sender, mcea);
- }
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- public class MediaCapturedEventArgs : EventArgs
- {
- private string _directory;
- private string _filename;
- private string _activeApp;
- private MediaType _mediaType;
-
- public MediaCapturedEventArgs(string directory, string filename, string activeAppAtTimeOfCapture)
- {
- _directory = directory;
- _filename = filename;
- _activeApp = activeAppAtTimeOfCapture;
- _mediaType = GetMediaType(filename);
- }
-
- public string ActiveApplication { get { return _activeApp; } }
- public string FullPath { get { return Path.Combine(_directory, _filename); } }
- public string Directory { get { return _directory; } }
- public string Filename { get { return _filename; } }
- public MediaType MediaType { get { return _mediaType; } }
-
- protected virtual MediaType GetMediaType(string filename)
- {
- string ext = Path.GetExtension(filename);
- switch (ext)
- {
- case ".jpg":
- case ".png":
- case ".gif":
- return MediaType.Photo;
- case ".3gp":
- case ".mp4":
- case ".qt":
- case ".mpg":
- case ".avi":
- return MediaType.Video;
- default:
- return MediaType.Unknown;
- }
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- public enum MediaType
- {
- Photo,
- Video,
- Unknown
- }
-}
Modified: Trunk/Source/Roam.Test/UI/Controls/CameraMediaSnifferTest.cs
===================================================================
--- Trunk/Source/Roam.Test/UI/Controls/CameraMediaSnifferTest.cs 2007-12-07 06:31:14 UTC (rev 108)
+++ Trunk/Source/Roam.Test/UI/Controls/CameraMediaSnifferTest.cs 2007-12-07 06:40:03 UTC (rev 109)
@@ -38,7 +38,7 @@
/// <author>Jon Froehlich</author>
public partial class CameraMediaSnifferTest : Form
{
- private CameraMediaSniffer _cameraMediaSniffer = new CameraMediaSniffer();
+ private CameraMediaCapturedSniffer _cameraMediaSniffer = new CameraMediaCapturedSniffer();
public CameraMediaSnifferTest()
{
InitializeComponent();
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-12-07 06:31:15
|
Revision: 108
http://roam.svn.sourceforge.net/roam/?rev=108&view=rev
Author: jonfroehlich
Date: 2007-12-06 22:31:14 -0800 (Thu, 06 Dec 2007)
Log Message:
-----------
Modified Paths:
--------------
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-11-29 18:52:10 UTC (rev 107)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-12-07 06:31:14 UTC (rev 108)
@@ -702,7 +702,7 @@
<DependentUpon>SystemColorTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\TabControlTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\TabControlTest.Designer.cs">
<DependentUpon>TabControlTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-11-29 18:52:13
|
Revision: 107
http://roam.svn.sourceforge.net/roam/?rev=107&view=rev
Author: jonfroehlich
Date: 2007-11-29 10:52:10 -0800 (Thu, 29 Nov 2007)
Log Message:
-----------
added PowerTest
Modified Paths:
--------------
Trunk/Source/Roam.sln
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/PowerTest/
Trunk/Source/PowerTest/Power2TestForm.Designer.cs
Trunk/Source/PowerTest/Power2TestForm.cs
Trunk/Source/PowerTest/Power2TestForm.resx
Trunk/Source/PowerTest/PowerTest.csproj
Trunk/Source/PowerTest/PowerTest.csproj.user
Trunk/Source/PowerTest/Program.cs
Trunk/Source/PowerTest/Properties/
Trunk/Source/PowerTest/Properties/AssemblyInfo.cs
Trunk/Source/PowerTest/Properties/Resources.Designer.cs
Trunk/Source/PowerTest/Properties/Resources.resx
Property Changed:
----------------
Trunk/Source/
Property changes on: Trunk/Source
___________________________________________________________________
Name: svn:ignore
- Roam.ncb
PowerTest
+ Roam.ncb
Property changes on: Trunk/Source/PowerTest
___________________________________________________________________
Name: svn:ignore
+ bin
obj
Added: Trunk/Source/PowerTest/Power2TestForm.Designer.cs
===================================================================
--- Trunk/Source/PowerTest/Power2TestForm.Designer.cs (rev 0)
+++ Trunk/Source/PowerTest/Power2TestForm.Designer.cs 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,139 @@
+namespace Roam.Test.Utils
+{
+ partial class Power2TestForm
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+ private System.Windows.Forms.MainMenu mainMenu1;
+
+ /// <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.mainMenu1 = new System.Windows.Forms.MainMenu();
+ this._menuItemClose = new System.Windows.Forms.MenuItem();
+ this.menuItem2 = new System.Windows.Forms.MenuItem();
+ this._menuItemGoIdle2 = new System.Windows.Forms.MenuItem();
+ this.menuItem1 = new System.Windows.Forms.MenuItem();
+ this._scrollableLabel1 = new Roam.UI.Controls.ScrollableLabel();
+ this._scrollableLabel2 = new Roam.UI.Controls.ScrollableLabel();
+ this._menuItemSubscribe1 = new System.Windows.Forms.MenuItem();
+ this._menuItemSubscribe2 = new System.Windows.Forms.MenuItem();
+ this._menuItemGoIdle = new System.Windows.Forms.MenuItem();
+ this.SuspendLayout();
+ //
+ // mainMenu1
+ //
+ this.mainMenu1.MenuItems.Add(this._menuItemClose);
+ this.mainMenu1.MenuItems.Add(this.menuItem2);
+ //
+ // _menuItemClose
+ //
+ this._menuItemClose.Text = "Close";
+ this._menuItemClose.Click += new System.EventHandler(this._menuItemClose_Click);
+ //
+ // menuItem2
+ //
+ this.menuItem2.MenuItems.Add(this._menuItemGoIdle);
+ this.menuItem2.MenuItems.Add(this._menuItemGoIdle2);
+ this.menuItem2.MenuItems.Add(this.menuItem1);
+ this.menuItem2.MenuItems.Add(this._menuItemSubscribe1);
+ this.menuItem2.MenuItems.Add(this._menuItemSubscribe2);
+ this.menuItem2.Text = "Menu";
+ //
+ // _menuItemGoIdle2
+ //
+ this._menuItemGoIdle2.Text = "Go Idle 2";
+ this._menuItemGoIdle2.Click += new System.EventHandler(this._menuItemGoIdle2_Click);
+ //
+ // menuItem1
+ //
+ this.menuItem1.Text = "Clear Logs";
+ this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
+ //
+ // _scrollableLabel1
+ //
+ this._scrollableLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this._scrollableLabel1.Font = new System.Drawing.Font("Segoe Condensed", 6F, System.Drawing.FontStyle.Regular);
+ this._scrollableLabel1.Location = new System.Drawing.Point(0, 0);
+ this._scrollableLabel1.Name = "_scrollableLabel1";
+ this._scrollableLabel1.Size = new System.Drawing.Size(240, 139);
+ this._scrollableLabel1.TabIndex = 1;
+ this._scrollableLabel1.Text = "scrollableLabel1";
+ //
+ // _scrollableLabel2
+ //
+ this._scrollableLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this._scrollableLabel2.Font = new System.Drawing.Font("Segoe Condensed", 6F, System.Drawing.FontStyle.Regular);
+ this._scrollableLabel2.Location = new System.Drawing.Point(0, 145);
+ this._scrollableLabel2.Name = "_scrollableLabel2";
+ this._scrollableLabel2.Size = new System.Drawing.Size(240, 121);
+ this._scrollableLabel2.TabIndex = 2;
+ this._scrollableLabel2.Text = "scrollableLabel1";
+ //
+ // _menuItemSubscribe1
+ //
+ this._menuItemSubscribe1.Text = "Subscribe 1";
+ this._menuItemSubscribe1.Click += new System.EventHandler(this._menuItemSubscribe1_Click);
+ //
+ // _menuItemSubscribe2
+ //
+ this._menuItemSubscribe2.Text = "Subscribe 2";
+ this._menuItemSubscribe2.Click += new System.EventHandler(this._menuItemSubscribe2_Click);
+ //
+ // _menuItemGoIdle
+ //
+ this._menuItemGoIdle.Text = "Go Idle";
+ this._menuItemGoIdle.Click += new System.EventHandler(this._menuItemGoIdle_Click);
+ //
+ // Power2TestForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(131F, 131F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.AutoScroll = true;
+ this.BackColor = System.Drawing.Color.Black;
+ this.ClientSize = new System.Drawing.Size(240, 266);
+ this.Controls.Add(this._scrollableLabel2);
+ this.Controls.Add(this._scrollableLabel1);
+ this.Menu = this.mainMenu1;
+ this.Name = "Power2TestForm";
+ this.Text = "Power2TestForm";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuItem _menuItemClose;
+ private System.Windows.Forms.MenuItem menuItem2;
+ private System.Windows.Forms.MenuItem _menuItemGoIdle2;
+ private Roam.UI.Controls.ScrollableLabel _scrollableLabel1;
+ private Roam.UI.Controls.ScrollableLabel _scrollableLabel2;
+ private System.Windows.Forms.MenuItem menuItem1;
+ private System.Windows.Forms.MenuItem _menuItemSubscribe1;
+ private System.Windows.Forms.MenuItem _menuItemSubscribe2;
+ private System.Windows.Forms.MenuItem _menuItemGoIdle;
+
+ }
+}
\ No newline at end of file
Added: Trunk/Source/PowerTest/Power2TestForm.cs
===================================================================
--- Trunk/Source/PowerTest/Power2TestForm.cs (rev 0)
+++ Trunk/Source/PowerTest/Power2TestForm.cs 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Roam.Utils;
+using Roam.UI.Utils;
+using OpenNETCF.WindowsCE;
+
+namespace Roam.Test.Utils
+{
+ public partial class Power2TestForm : Form
+ {
+ private PowerNotificationUIThread _powerNotification1;
+ private PowerNotificationUIThread _powerNotification2;
+
+ public Power2TestForm()
+ {
+ InitializeComponent();
+
+ ClearLogs();
+
+ _powerNotification1 = new PowerNotificationUIThread(this);
+ _powerNotification2 = new PowerNotificationUIThread(this);
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _powerNotification1.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent1);
+ _powerNotification2.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent2);
+
+ base.OnClosing(e);
+ }
+
+ private void OnPowerNotificationEvent1(object sender, PowerNotificationEventArgs e)
+ {
+ _scrollableLabel1.AddLine("Message: " + e.PowerBroadcast.Message);
+ _scrollableLabel1.AddLine("PowerState: " + e.PowerBroadcast.GetSystemPowerStateAsString());
+ }
+
+ private void OnPowerNotificationEvent2(object sender, PowerNotificationEventArgs e)
+ {
+ _scrollableLabel2.AddLine("Message: " + e.PowerBroadcast.Message);
+ _scrollableLabel2.AddLine("PowerState: " + e.PowerBroadcast.GetSystemPowerStateAsString());
+ }
+
+ private void _menuItemClose_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void _menuItemGoIdle2_Click(object sender, EventArgs e)
+ {
+ PowerUtils.SetSystemPowerState(IntPtr.Zero, PowerStateFlags.Idle2, PowerUtils.POWER_FORCE);
+ }
+
+ private void _menuItemGoIdle_Click(object sender, EventArgs e)
+ {
+ PowerManagement.SetIdleState();
+ }
+
+ private void menuItem1_Click(object sender, EventArgs e)
+ {
+ ClearLogs();
+ }
+
+ private void ClearLogs()
+ {
+ _scrollableLabel1.Clear();
+ _scrollableLabel2.Clear();
+ }
+
+ private void _menuItemSubscribe1_Click(object sender, EventArgs e)
+ {
+ if (_menuItemSubscribe1.Text.IndexOf("Unsubscribe") != -1)
+ {
+ _menuItemSubscribe1.Text = "Subscribe 1";
+ _powerNotification1.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent1);
+ }
+ else
+ {
+ _menuItemSubscribe1.Text = "Unsubscribe 1";
+ _powerNotification1.PowerNotificationEvent += new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent1);
+ }
+ }
+
+ private void _menuItemSubscribe2_Click(object sender, EventArgs e)
+ {
+ if (_menuItemSubscribe2.Text.IndexOf("Unsubscribe") != -1)
+ {
+ _menuItemSubscribe2.Text = "Subscribe 2";
+ _powerNotification2.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent2);
+ }
+ else
+ {
+ _menuItemSubscribe2.Text = "Unsubscribe 2";
+ _powerNotification2.PowerNotificationEvent += new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent2);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: Trunk/Source/PowerTest/Power2TestForm.resx
===================================================================
--- Trunk/Source/PowerTest/Power2TestForm.resx (rev 0)
+++ Trunk/Source/PowerTest/Power2TestForm.resx 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,129 @@
+<?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>
+ <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
+ <value>Smartphone QVGA</value>
+ </metadata>
+ <metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+</root>
\ No newline at end of file
Added: Trunk/Source/PowerTest/PowerTest.csproj
===================================================================
--- Trunk/Source/PowerTest/PowerTest.csproj (rev 0)
+++ Trunk/Source/PowerTest/PowerTest.csproj 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,113 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{3B5B1E77-4C54-4C1F-A7CC-127951DA9165}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>PowerTest</RootNamespace>
+ <AssemblyName>PowerTest</AssemblyName>
+ <ProjectTypeGuids>{B334EBA9-3188-4e79-9C95-ECEFC6669C5A};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <PlatformFamilyName>Smartphone</PlatformFamilyName>
+ <PlatformID>BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39</PlatformID>
+ <OSVersion>5.01</OSVersion>
+ <DeployDirSuffix>\Storage Card\Program Files\PowerTest</DeployDirSuffix>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ <FormFactorID>
+ </FormFactorID>
+ <DeployDirPrefix>\</DeployDirPrefix>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <FileAlignment>512</FileAlignment>
+ <WarningLevel>4</WarningLevel>
+ <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <FileAlignment>512</FileAlignment>
+ <WarningLevel>4</WarningLevel>
+ <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="mscorlib" />
+ <Reference Include="OpenNETCF.WindowsCE, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e60dbea84bb431b7, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\Library\Release\OpenNETCF.WindowsCE.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="OpenNETCF" />
+ <Reference Include="OpenNETCF.Data" />
+ <Reference Include="OpenNETCF.Drawing" />
+ <Reference Include="OpenNETCF.Windows.Forms" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Power2TestForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Power2TestForm.Designer.cs">
+ <DependentUpon>Power2TestForm.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="Power2TestForm.resx">
+ <DependentUpon>Power2TestForm.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ <DesignTime>True</DesignTime>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Roam.UI\Roam.UI.csproj">
+ <Project>{DAC64B51-A973-4AB8-9B3D-6548EDC6E867}</Project>
+ <Name>Roam.UI</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Roam\Roam.csproj">
+ <Project>{2478CBD2-0FCB-443A-ABBE-4D6396A8E689}</Project>
+ <Name>Roam</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
+ <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
+ <HostingProcess disable="1" />
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: Trunk/Source/PowerTest/PowerTest.csproj.user
===================================================================
--- Trunk/Source/PowerTest/PowerTest.csproj.user (rev 0)
+++ Trunk/Source/PowerTest/PowerTest.csproj.user 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <DeployDeviceID>BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39d6518ffb-710f-11d3-99f2-00105a0df099</DeployDeviceID>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: Trunk/Source/PowerTest/Program.cs
===================================================================
--- Trunk/Source/PowerTest/Program.cs (rev 0)
+++ Trunk/Source/PowerTest/Program.cs 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using Roam.Test.Utils;
+
+namespace PowerTest
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [MTAThread]
+ static void Main()
+ {
+ Application.Run(new Power2TestForm());
+ }
+ }
+}
\ No newline at end of file
Added: Trunk/Source/PowerTest/Properties/AssemblyInfo.cs
===================================================================
--- Trunk/Source/PowerTest/Properties/AssemblyInfo.cs (rev 0)
+++ Trunk/Source/PowerTest/Properties/AssemblyInfo.cs 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("PowerTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PowerTest")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e12e52a1-3849-44fb-9df6-9b70b668899a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+
Added: Trunk/Source/PowerTest/Properties/Resources.Designer.cs
===================================================================
--- Trunk/Source/PowerTest/Properties/Resources.Designer.cs (rev 0)
+++ Trunk/Source/PowerTest/Properties/Resources.Designer.cs 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,60 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.832
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PowerTest.Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PowerTest.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
Added: Trunk/Source/PowerTest/Properties/Resources.resx
===================================================================
--- Trunk/Source/PowerTest/Properties/Resources.resx (rev 0)
+++ Trunk/Source/PowerTest/Properties/Resources.resx 2007-11-29 18:52:10 UTC (rev 107)
@@ -0,0 +1,117 @@
+<?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.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: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" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </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" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </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.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: Trunk/Source/Roam.sln
===================================================================
--- Trunk/Source/Roam.sln 2007-11-29 08:31:22 UTC (rev 106)
+++ Trunk/Source/Roam.sln 2007-11-29 18:52:10 UTC (rev 107)
@@ -20,6 +20,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerTest", "PowerTest\PowerTest.csproj", "{3B5B1E77-4C54-4C1F-A7CC-127951DA9165}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2C7DA866-BB34-4F97-98E9-A5CD2DB49090}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -148,4 +150,7 @@
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165} = {2C7DA866-BB34-4F97-98E9-A5CD2DB49090}
+ EndGlobalSection
EndGlobal
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-11-29 08:31:28
|
Revision: 106
http://roam.svn.sourceforge.net/roam/?rev=106&view=rev
Author: jonfroehlich
Date: 2007-11-29 00:31:22 -0800 (Thu, 29 Nov 2007)
Log Message:
-----------
fixed a slight "bug" in PowerNotification where the P2PMessageQueue name was always the same; thus if multiple applications used PowerNotifications, they would get sucked up by the first P2PMessageQueue. It appears that the names are unique that this doesn't occur and the message queue plays nice across processes.
Modified Paths:
--------------
Trunk/Source/Roam/Utils/PowerNotification.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.sln
Trunk/Source/Roam.suo
Trunk/Source/Sandbox.Roam/Sandbox.Roam.csproj
Added Paths:
-----------
Trunk/Source/Roam.Test/Utils/Power2TestForm.Designer.cs
Trunk/Source/Roam.Test/Utils/Power2TestForm.cs
Trunk/Source/Roam.Test/Utils/Power2TestForm.resx
Property Changed:
----------------
Trunk/Source/
Property changes on: Trunk/Source
___________________________________________________________________
Name: svn:ignore
- Roam.ncb
+ Roam.ncb
PowerTest
Modified: Trunk/Source/Roam/Utils/PowerNotification.cs
===================================================================
--- Trunk/Source/Roam/Utils/PowerNotification.cs 2007-11-08 19:08:18 UTC (rev 105)
+++ Trunk/Source/Roam/Utils/PowerNotification.cs 2007-11-29 08:31:22 UTC (rev 106)
@@ -56,7 +56,11 @@
public PowerNotification()
{
- _messageQueue = new P2PMessageQueue(true, "PowerEventWaitQueue");
+ //i append the tick count here as a cheap hacky way to ensure that the
+ //P2PMessageQueue doesn't already exist--this obviously won't work if two
+ //instantiations of PowerNotification occur at the exact same time but this is
+ //unlikely (and this problem doesn't deserve more of my time).
+ _messageQueue = new P2PMessageQueue(true, "PowerEventWaitQueue" + Environment.TickCount);
_messageQueue.DataOnQueueChanged += new EventHandler(OnMessageDataQueueChanged);
_handlePowerNotifications = PowerUtils.RequestPowerNotifications(_messageQueue.Handle, PowerBroadcastFlags.PBT_RESUME | PowerBroadcastFlags.PBT_TRANSITION);
}
@@ -85,6 +89,9 @@
int maxRetries = 3;
while (_messageQueue.MessagesInQueueNow > 0 && retryCnt < maxRetries)
{
+ //TODO: MAYBE DO A PEEK HERE INSTEAD? We're running into
+ //issues when multiple apps on the phone are using this class
+ //the power notification gets swallowed and not forwarded on!
ReadWriteResult rwr = _messageQueue.Receive(pb, 1000);
if (rwr == ReadWriteResult.OK)
{
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-11-08 19:08:18 UTC (rev 105)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-11-29 08:31:22 UTC (rev 106)
@@ -377,6 +377,10 @@
<SubType>Designer</SubType>
<DependentUpon>MeasureStringTest.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Utils\Power2TestForm.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>Power2TestForm.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Utils\PowerTestForm.resx">
<SubType>Designer</SubType>
<DependentUpon>PowerTestForm.cs</DependentUpon>
@@ -560,7 +564,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
@@ -698,7 +702,7 @@
<DependentUpon>SystemColorTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\TabControlTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\TabControlTest.Designer.cs">
<DependentUpon>TabControlTest.cs</DependentUpon>
@@ -775,6 +779,12 @@
<Compile Include="Utils\MeasureStringTest.Designer.cs">
<DependentUpon>MeasureStringTest.cs</DependentUpon>
</Compile>
+ <Compile Include="Utils\Power2TestForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Utils\Power2TestForm.Designer.cs">
+ <DependentUpon>Power2TestForm.cs</DependentUpon>
+ </Compile>
<Compile Include="Utils\PowerTestForm.cs">
<SubType>Form</SubType>
</Compile>
Added: Trunk/Source/Roam.Test/Utils/Power2TestForm.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/Power2TestForm.Designer.cs (rev 0)
+++ Trunk/Source/Roam.Test/Utils/Power2TestForm.Designer.cs 2007-11-29 08:31:22 UTC (rev 106)
@@ -0,0 +1,139 @@
+namespace Roam.Test.Utils
+{
+ partial class Power2TestForm
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+ private System.Windows.Forms.MainMenu mainMenu1;
+
+ /// <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.mainMenu1 = new System.Windows.Forms.MainMenu();
+ this._menuItemClose = new System.Windows.Forms.MenuItem();
+ this.menuItem2 = new System.Windows.Forms.MenuItem();
+ this._menuItemGoIdle2 = new System.Windows.Forms.MenuItem();
+ this.menuItem1 = new System.Windows.Forms.MenuItem();
+ this._scrollableLabel1 = new Roam.UI.Controls.ScrollableLabel();
+ this._scrollableLabel2 = new Roam.UI.Controls.ScrollableLabel();
+ this._menuItemSubscribe1 = new System.Windows.Forms.MenuItem();
+ this._menuItemSubscribe2 = new System.Windows.Forms.MenuItem();
+ this._menuItemGoIdle = new System.Windows.Forms.MenuItem();
+ this.SuspendLayout();
+ //
+ // mainMenu1
+ //
+ this.mainMenu1.MenuItems.Add(this._menuItemClose);
+ this.mainMenu1.MenuItems.Add(this.menuItem2);
+ //
+ // _menuItemClose
+ //
+ this._menuItemClose.Text = "Close";
+ this._menuItemClose.Click += new System.EventHandler(this._menuItemClose_Click);
+ //
+ // menuItem2
+ //
+ this.menuItem2.MenuItems.Add(this._menuItemGoIdle);
+ this.menuItem2.MenuItems.Add(this._menuItemGoIdle2);
+ this.menuItem2.MenuItems.Add(this.menuItem1);
+ this.menuItem2.MenuItems.Add(this._menuItemSubscribe1);
+ this.menuItem2.MenuItems.Add(this._menuItemSubscribe2);
+ this.menuItem2.Text = "Menu";
+ //
+ // _menuItemGoIdle2
+ //
+ this._menuItemGoIdle2.Text = "Go Idle 2";
+ this._menuItemGoIdle2.Click += new System.EventHandler(this._menuItemGoIdle2_Click);
+ //
+ // menuItem1
+ //
+ this.menuItem1.Text = "Clear Logs";
+ this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
+ //
+ // _scrollableLabel1
+ //
+ this._scrollableLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this._scrollableLabel1.Font = new System.Drawing.Font("Segoe Condensed", 6F, System.Drawing.FontStyle.Regular);
+ this._scrollableLabel1.Location = new System.Drawing.Point(0, 0);
+ this._scrollableLabel1.Name = "_scrollableLabel1";
+ this._scrollableLabel1.Size = new System.Drawing.Size(240, 139);
+ this._scrollableLabel1.TabIndex = 1;
+ this._scrollableLabel1.Text = "scrollableLabel1";
+ //
+ // _scrollableLabel2
+ //
+ this._scrollableLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this._scrollableLabel2.Font = new System.Drawing.Font("Segoe Condensed", 6F, System.Drawing.FontStyle.Regular);
+ this._scrollableLabel2.Location = new System.Drawing.Point(0, 145);
+ this._scrollableLabel2.Name = "_scrollableLabel2";
+ this._scrollableLabel2.Size = new System.Drawing.Size(240, 121);
+ this._scrollableLabel2.TabIndex = 2;
+ this._scrollableLabel2.Text = "scrollableLabel1";
+ //
+ // _menuItemSubscribe1
+ //
+ this._menuItemSubscribe1.Text = "Subscribe 1";
+ this._menuItemSubscribe1.Click += new System.EventHandler(this._menuItemSubscribe1_Click);
+ //
+ // _menuItemSubscribe2
+ //
+ this._menuItemSubscribe2.Text = "Subscribe 2";
+ this._menuItemSubscribe2.Click += new System.EventHandler(this._menuItemSubscribe2_Click);
+ //
+ // _menuItemGoIdle
+ //
+ this._menuItemGoIdle.Text = "Go Idle";
+ this._menuItemGoIdle.Click += new System.EventHandler(this._menuItemGoIdle_Click);
+ //
+ // Power2TestForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(131F, 131F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.AutoScroll = true;
+ this.BackColor = System.Drawing.Color.Black;
+ this.ClientSize = new System.Drawing.Size(240, 266);
+ this.Controls.Add(this._scrollableLabel2);
+ this.Controls.Add(this._scrollableLabel1);
+ this.Menu = this.mainMenu1;
+ this.Name = "Power2TestForm";
+ this.Text = "Power2TestForm";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuItem _menuItemClose;
+ private System.Windows.Forms.MenuItem menuItem2;
+ private System.Windows.Forms.MenuItem _menuItemGoIdle2;
+ private Roam.UI.Controls.ScrollableLabel _scrollableLabel1;
+ private Roam.UI.Controls.ScrollableLabel _scrollableLabel2;
+ private System.Windows.Forms.MenuItem menuItem1;
+ private System.Windows.Forms.MenuItem _menuItemSubscribe1;
+ private System.Windows.Forms.MenuItem _menuItemSubscribe2;
+ private System.Windows.Forms.MenuItem _menuItemGoIdle;
+
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Utils/Power2TestForm.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/Power2TestForm.cs (rev 0)
+++ Trunk/Source/Roam.Test/Utils/Power2TestForm.cs 2007-11-29 08:31:22 UTC (rev 106)
@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Roam.Utils;
+using Roam.UI.Utils;
+using OpenNETCF.WindowsCE;
+
+namespace Roam.Test.Utils
+{
+ public partial class Power2TestForm : Form
+ {
+ private PowerNotificationUIThread _powerNotification1;
+ private PowerNotificationUIThread _powerNotification2;
+
+ public Power2TestForm()
+ {
+ InitializeComponent();
+
+ ClearLogs();
+
+ _powerNotification1 = new PowerNotificationUIThread(this);
+ _powerNotification2 = new PowerNotificationUIThread(this);
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _powerNotification1.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent1);
+ _powerNotification2.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent2);
+
+ base.OnClosing(e);
+ }
+
+ private void OnPowerNotificationEvent1(object sender, PowerNotificationEventArgs e)
+ {
+ _scrollableLabel1.AddLine("Message: " + e.PowerBroadcast.Message);
+ _scrollableLabel1.AddLine("PowerState: " + e.PowerBroadcast.GetSystemPowerStateAsString());
+ }
+
+ private void OnPowerNotificationEvent2(object sender, PowerNotificationEventArgs e)
+ {
+ _scrollableLabel2.AddLine("Message: " + e.PowerBroadcast.Message);
+ _scrollableLabel2.AddLine("PowerState: " + e.PowerBroadcast.GetSystemPowerStateAsString());
+ }
+
+ private void _menuItemClose_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void _menuItemGoIdle2_Click(object sender, EventArgs e)
+ {
+ PowerUtils.SetSystemPowerState(IntPtr.Zero, PowerStateFlags.Idle2, PowerUtils.POWER_FORCE);
+ }
+
+ private void _menuItemGoIdle_Click(object sender, EventArgs e)
+ {
+ PowerManagement.SetIdleState();
+ }
+
+ private void menuItem1_Click(object sender, EventArgs e)
+ {
+ ClearLogs();
+ }
+
+ private void ClearLogs()
+ {
+ _scrollableLabel1.Clear();
+ _scrollableLabel2.Clear();
+ }
+
+ private void _menuItemSubscribe1_Click(object sender, EventArgs e)
+ {
+ if (_menuItemSubscribe1.Text.IndexOf("Unsubscribe") != -1)
+ {
+ _menuItemSubscribe1.Text = "Subscribe 1";
+ _powerNotification1.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent1);
+ }
+ else
+ {
+ _menuItemSubscribe1.Text = "Unsubscribe 1";
+ _powerNotification1.PowerNotificationEvent += new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent1);
+ }
+ }
+
+ private void _menuItemSubscribe2_Click(object sender, EventArgs e)
+ {
+ if (_menuItemSubscribe2.Text.IndexOf("Unsubscribe") != -1)
+ {
+ _menuItemSubscribe2.Text = "Subscribe 2";
+ _powerNotification2.PowerNotificationEvent -= new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent2);
+ }
+ else
+ {
+ _menuItemSubscribe2.Text = "Unsubscribe 2";
+ _powerNotification2.PowerNotificationEvent += new EventHandler<PowerNotificationEventArgs>(OnPowerNotificationEvent2);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Utils/Power2TestForm.resx
===================================================================
--- Trunk/Source/Roam.Test/Utils/Power2TestForm.resx (rev 0)
+++ Trunk/Source/Roam.Test/Utils/Power2TestForm.resx 2007-11-29 08:31:22 UTC (rev 106)
@@ -0,0 +1,129 @@
+<?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>
+ <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
+ <value>Smartphone QVGA</value>
+ </metadata>
+ <metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+</root>
\ No newline at end of file
Modified: Trunk/Source/Roam.sln
===================================================================
--- Trunk/Source/Roam.sln 2007-11-08 19:08:18 UTC (rev 105)
+++ Trunk/Source/Roam.sln 2007-11-29 08:31:22 UTC (rev 106)
@@ -18,6 +18,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.Roam", "Sandbox.Roam\Sandbox.Roam.csproj", "{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerTest", "PowerTest\PowerTest.csproj", "{3B5B1E77-4C54-4C1F-A7CC-127951DA9165}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -128,6 +130,20 @@
{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{19CDE0E2-71D7-4F81-841D-5A89F709E3D9}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Debug|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
+ {3B5B1E77-4C54-4C1F-A7CC-127951DA9165}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
Modified: Trunk/Source/Sandbox.Roam/Sandbox.Roam.csproj
===================================================================
--- Trunk/Source/Sandbox.Roam/Sandbox.Roam.csproj 2007-11-08 19:08:18 UTC (rev 105)
+++ Trunk/Source/Sandbox.Roam/Sandbox.Roam.csproj 2007-11-29 08:31:22 UTC (rev 106)
@@ -13,10 +13,11 @@
<PlatformFamilyName>Smartphone</PlatformFamilyName>
<PlatformID>BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39</PlatformID>
<OSVersion>5.01</OSVersion>
- <DeployDirSuffix>Sandbox.Roam</DeployDirSuffix>
+ <DeployDirSuffix>\Storage Card\Program Files\Sandbox.Roam</DeployDirSuffix>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FormFactorID>
</FormFactorID>
+ <DeployDirPrefix>\</DeployDirPrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-11-08 19:08:18
|
Revision: 105
http://roam.svn.sourceforge.net/roam/?rev=105&view=rev
Author: jonfroehlich
Date: 2007-11-08 11:08:18 -0800 (Thu, 08 Nov 2007)
Log Message:
-----------
Modified Paths:
--------------
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-11-08 18:07:41
|
Revision: 104
http://roam.svn.sourceforge.net/roam/?rev=104&view=rev
Author: jonfroehlich
Date: 2007-11-08 10:07:38 -0800 (Thu, 08 Nov 2007)
Log Message:
-----------
added CountNumberOfCommonStrings method to StringUtils
Modified Paths:
--------------
Trunk/Source/Roam.Common/Utils/StringUtils.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Modified: Trunk/Source/Roam.Common/Utils/StringUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/StringUtils.cs 2007-11-05 16:45:36 UTC (rev 103)
+++ Trunk/Source/Roam.Common/Utils/StringUtils.cs 2007-11-08 18:07:38 UTC (rev 104)
@@ -16,6 +16,7 @@
using System.Text;
using System.Collections;
using System.Collections.Generic;
+using Roam.Common.Collections;
namespace Roam.Common.Utils
{
@@ -108,5 +109,20 @@
{
return s.IndexOf(value) != -1;
}
+
+ /// <summary>
+ /// For this method to work correctly, neither string collection can have duplicate strings within
+ /// its own collection.
+ /// </summary>
+ /// <param name="stringsA"></param>
+ /// <param name="stringsB"></param>
+ /// <returns></returns>
+ public static int CountNumberOfCommonStrings(ICollection<string> stringsA, ICollection<string> stringsB)
+ {
+ HashSet<string> setUniqueStrings = new HashSet<string>();
+ foreach (string s in stringsA) { setUniqueStrings.Add(s); }
+ foreach (string s in stringsB) { setUniqueStrings.Add(s); }
+ return stringsA.Count + stringsB.Count - setUniqueStrings.Count;
+ }
}
}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-11-05 16:45:36 UTC (rev 103)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-11-08 18:07:38 UTC (rev 104)
@@ -560,7 +560,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-11-05 16:45:44
|
Revision: 103
http://roam.svn.sourceforge.net/roam/?rev=103&view=rev
Author: jonfroehlich
Date: 2007-11-05 08:45:36 -0800 (Mon, 05 Nov 2007)
Log Message:
-----------
added backlight turn on option to NotificationForm
Modified Paths:
--------------
Trunk/Source/Roam.UI/Forms/NotificationForm.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.UI/Forms/NotificationForm.cs
===================================================================
--- Trunk/Source/Roam.UI/Forms/NotificationForm.cs 2007-11-03 21:23:49 UTC (rev 102)
+++ Trunk/Source/Roam.UI/Forms/NotificationForm.cs 2007-11-05 16:45:36 UTC (rev 103)
@@ -26,6 +26,7 @@
using Roam.Common.Utils;
using Microsoft.WindowsMobile.Status;
using Roam.Media;
+using Roam.Utils;
namespace Roam.UI.Forms
{
@@ -60,6 +61,7 @@
private bool _autoAppendSnoozeCount = true;
private bool _useSound = true;
private bool _useVibration = true;
+ private bool _turnOnScreen = true;
private bool _useLed = true;
private bool _ignorePhoneProfile = false;
@@ -72,6 +74,7 @@
#endregion Private Fields
+ #region Constructors
public NotificationForm()
{
InitializeComponent();
@@ -94,6 +97,7 @@
imageFactory.CreateImageFromFile(strOverlayImage, out _imgOverlay);
imageFactory.CreateImageFromFile(strBackgroundImage, out _img);
}
+ #endregion Constructors
#region Properties
public NotificationResult NotificationResult
@@ -133,6 +137,12 @@
set { _useLed = value; }
}
+ public bool TurnOnScreen
+ {
+ get { return _turnOnScreen; }
+ set { _turnOnScreen = value; }
+ }
+
public bool IgnorePhoneProfile
{
get { return _ignorePhoneProfile; }
@@ -397,6 +407,11 @@
protected virtual void StartNotify()
{
+ if (_turnOnScreen)
+ {
+ PowerUtils.SetSystemPowerState(IntPtr.Zero, PowerStateFlags.On, PowerUtils.POWER_FORCE);
+ }
+
if (_useSound&& (_ignorePhoneProfile||
(!_ignorePhoneProfile && SystemState.PhoneProfile != "Silent")))
{
@@ -458,8 +473,13 @@
protected virtual void OnTimerTick(object sender, EventArgs e)
{
+ UpdateSnoozeDisplayTimer();
+ }
+
+ protected virtual void UpdateSnoozeDisplayTimer()
+ {
if (_isDisposed || _timer == null) { return; }
- _log.DebugFormat("{0}:OnTimerTick : Entered, Snoozing: {1}, Visible: {2}, RepeatCount: {3}",
+ _log.DebugFormat("{0}:UpdateSnoozeDisplayTimer : Entered, Snoozing: {1}, Visible: {2}, RepeatCount: {3}",
Text, _isSnoozing, this.Visible, _reminderCount);
_timer.Enabled = false;
@@ -475,7 +495,7 @@
_menuItemSnooze.Enabled = false;
}
StartNotify();
- _log.DebugFormat("{0}:OnTimerTick : DisplayInterval timer set to {1}",
+ _log.DebugFormat("{0}:UpdateSnoozeDisplayTimer : DisplayInterval timer set to {1}",
Text, _displayInterval);
}
else
@@ -484,16 +504,16 @@
_timer.Interval = (int)_snoozeInterval.TotalMilliseconds;
_isSnoozing = true;
this.Visible = false;
- _log.DebugFormat("{0}:OnTimerTick : Repeat count set to {1}; SnoozeInterval timer set to {2}",
+ _log.DebugFormat("{0}:UpdateSnoozeDisplayTimer : Repeat count set to {1}; SnoozeInterval timer set to {2}",
Text, _reminderCount, _snoozeInterval);
}
if (_reminderCount > _maximumReminders)
{
- _log.DebugFormat("{0}:OnTimerTick : Repeat count {1} has exceeded the reminder count threshold {2}",
+ _log.DebugFormat("{0}:UpdateSnoozeDisplayTimer : Repeat count {1} has exceeded the reminder count threshold {2}",
Text, _reminderCount, _maximumReminders);
- _log.DebugFormat("{0}:OnTimerTick : Exiting, SnoozeInterval: {1}, Visible: {2}, RepeatCount: {3}, TimerEnabled: {4}",
+ _log.DebugFormat("{0}:UpdateSnoozeDisplayTimer : Exiting, SnoozeInterval: {1}, Visible: {2}, RepeatCount: {3}, TimerEnabled: {4}",
Text, _isSnoozing, this.Visible, _reminderCount, _timer.Enabled);
NotificationResult = NotificationResult.AutoDismissed;
DialogResult = DialogResult.No;
@@ -501,7 +521,7 @@
else
{
_timer.Enabled = true;
- _log.DebugFormat("{0}:OnTimerTick : Exiting, SnoozeInterval: {1}, Visible: {2}, RepeatCount: {3}, TimerEnabled: {4}",
+ _log.DebugFormat("{0}:UpdateSnoozeDisplayTimer : Exiting, SnoozeInterval: {1}, Visible: {2}, RepeatCount: {3}, TimerEnabled: {4}",
Text, _isSnoozing, this.Visible, _reminderCount, _timer.Enabled);
}
}
@@ -516,14 +536,7 @@
NotificationResult = NotificationResult.OK;
_log.DebugFormat("{0}:OnMenuItemOkClick : Exited", Text);
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- //setting this property with a value from the DialogResult enumeration
+ //setting this property with a value from the DialogResult enumeration
//sets the value of the dialog box result for the form, hides the modal
//dialog box, and returns control to the calling form
DialogResult = DialogResult.OK;
@@ -536,13 +549,6 @@
NotificationResult = NotificationResult.ManuallyDismissed;
_log.DebugFormat("{0}:OnMenuItemDismissClick : Exited", Text);
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
//setting this property with a value from the DialogResult enumeration
//sets the value of the dialog box result for the form, hides the modal
//dialog box, and returns control to the calling form
@@ -552,7 +558,8 @@
private void OnMenuItemSnoozeClick(object sender, EventArgs e)
{
_log.DebugFormat("{0}:OnMenuItemSnoozeClick : Entered", Text);
- OnTimerTick(this, EventArgs.Empty);
+ StopNotify();
+ UpdateSnoozeDisplayTimer();
_log.DebugFormat("{0}:OnMenuItemSnoozeClick : Exited", Text);
}
#endregion Private Methods
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-11-03 21:23:50
|
Revision: 102
http://roam.svn.sourceforge.net/roam/?rev=102&view=rev
Author: jonfroehlich
Date: 2007-11-03 14:23:49 -0700 (Sat, 03 Nov 2007)
Log Message:
-----------
updated Border to have default constructor
Modified Paths:
--------------
Trunk/Source/Roam.UI/Controls/Border.Designer.cs
Trunk/Source/Roam.UI/Controls/Border.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.UI/Controls/Border.Designer.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/Border.Designer.cs 2007-10-23 05:45:56 UTC (rev 101)
+++ Trunk/Source/Roam.UI/Controls/Border.Designer.cs 2007-11-03 21:23:49 UTC (rev 102)
@@ -12,6 +12,7 @@
// this source code distribution.
//
#endregion Copyright & License
+using System;
namespace Roam.UI.Controls
{
/// <summary>
@@ -34,6 +35,12 @@
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ _control.GotFocus -= new EventHandler(OnControlGotFocus);
+ _control.LostFocus -= new EventHandler(OnControlLostFocus);
+ }
+
if (disposing && (components != null))
{
components.Dispose();
Modified: Trunk/Source/Roam.UI/Controls/Border.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/Border.cs 2007-10-23 05:45:56 UTC (rev 101)
+++ Trunk/Source/Roam.UI/Controls/Border.cs 2007-11-03 21:23:49 UTC (rev 102)
@@ -50,22 +50,30 @@
/// <author>Jon Froehlich</author>
public partial class Border : Control
{
+ #region Fields
private Control _control;
private int _borderThickness = 1;
private BorderBehavior _borderBehavior = BorderBehavior.DrawBorderWhenNotFocused;
private bool _autoResizeControlOnFocus = false;
+ #endregion Fields
+ #region Constructors
+ public Border()
+ {
+ }
+
public Border(Control control)
{
_control = control;
InitializeComponent();
this.Controls.Add(_control);
- //jeffixme do we need to explicitly unhook these on disposal?
_control.GotFocus += new EventHandler(OnControlGotFocus);
_control.LostFocus += new EventHandler(OnControlLostFocus);
}
+ #endregion Constructors
+ #region Properties
public bool AutoResizeControlOnFocus
{
get { return _autoResizeControlOnFocus; }
@@ -92,6 +100,24 @@
}
}
+ public Control Control
+ {
+ get { return _control; }
+ set
+ {
+ if (_control != null)
+ {
+ _control.GotFocus -= new EventHandler(OnControlGotFocus);
+ _control.LostFocus -= new EventHandler(OnControlLostFocus);
+ }
+ _control = value;
+ _control.GotFocus += new EventHandler(OnControlGotFocus);
+ _control.LostFocus += new EventHandler(OnControlLostFocus);
+ }
+ }
+ #endregion Properties
+
+ #region Methods
protected virtual void OnControlLostFocus(object sender, EventArgs e)
{
this.TabStop = true;
@@ -110,11 +136,6 @@
this.Refresh();
}
- public Control Control
- {
- get { return _control; }
- }
-
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
@@ -123,10 +144,16 @@
switch (_borderBehavior)
{
case BorderBehavior.DrawBorderWhenFocused:
- bDrawBorder = _control.Focused;
+ if (_control != null)
+ {
+ bDrawBorder = _control.Focused;
+ }
break;
case BorderBehavior.DrawBorderWhenNotFocused:
- bDrawBorder = !_control.Focused;
+ if (_control != null)
+ {
+ bDrawBorder = !_control.Focused;
+ }
break;
case BorderBehavior.AlwaysDrawBorder:
bDrawBorder = true;
@@ -174,16 +201,18 @@
protected override void OnResize(EventArgs e)
{
+ if (_control == null) { return; }
UpdateLayout();
base.OnResize(e);
}
protected override void OnGotFocus(EventArgs e)
{
+ if (_control == null) { return; }
//this.TabStop = false;
_control.Focus();
base.OnGotFocus(e);
}
-
+ #endregion Methods
}
}
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-10-23 05:46:06
|
Revision: 101
http://roam.svn.sourceforge.net/roam/?rev=101&view=rev
Author: jonfroehlich
Date: 2007-10-22 22:45:56 -0700 (Mon, 22 Oct 2007)
Log Message:
-----------
1. updated SoundLoopPlayer to expose Volume
2. fixed NotificationForm bug when ReminderCount starts at 0, the Snooze menu item is now disabled
Modified Paths:
--------------
Trunk/Source/Roam/Media/SoundLoopPlayer.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Forms/NotificationForm.cs
Modified: Trunk/Source/Roam/Media/SoundLoopPlayer.cs
===================================================================
--- Trunk/Source/Roam/Media/SoundLoopPlayer.cs 2007-10-22 18:16:32 UTC (rev 100)
+++ Trunk/Source/Roam/Media/SoundLoopPlayer.cs 2007-10-23 05:45:56 UTC (rev 101)
@@ -71,25 +71,31 @@
private InvokeDelegate _invokeDelegate;
#endregion Private Fields
+ #region Constructors
public SoundLoopPlayer(InvokeDelegate invokeDelegate, string soundFile)
: base(new TimeSpan(0, 30, 0), new TimeSpan(0,0,2), 2)
{
_soundFile = soundFile;
}
- //public SoundLoopPlayer(string soundFile, TimeSpan pauseDuration, int repeatCount)
- // : base(new TimeSpan(0, 30, 0), pauseDuration, repeatCount)
- //{
- // _soundFile = soundFile;
- //}
-
public SoundLoopPlayer(InvokeDelegate invokeDelegate, string soundFile, TimeSpan pauseDuration, int repeatCount)
: base(new TimeSpan(0, 30, 0), pauseDuration, repeatCount)
{
_soundFile = soundFile;
_invokeDelegate = invokeDelegate;
}
+ #endregion Constructors
+
+ #region Properties
+ public int Volume
+ {
+ get { return _soundPlayer.Volume; }
+ set { _soundPlayer.Volume = value; }
+ }
+ #endregion Properties
+
+ #region Methods
protected virtual void StartInternalDelegate(object state)
{
_soundPlayer.DonePlaying += new WaveDoneHandler(OnSoundPlayerDonePlaying);
@@ -122,5 +128,6 @@
{
OnTimer(null);
}
+ #endregion Methods
}
}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-22 18:16:32 UTC (rev 100)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-23 05:45:56 UTC (rev 101)
@@ -560,7 +560,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Forms/NotificationForm.cs
===================================================================
--- Trunk/Source/Roam.UI/Forms/NotificationForm.cs 2007-10-22 18:16:32 UTC (rev 100)
+++ Trunk/Source/Roam.UI/Forms/NotificationForm.cs 2007-10-23 05:45:56 UTC (rev 101)
@@ -158,6 +158,12 @@
if (_maximumReminders != value)
{
_maximumReminders = value;
+
+ if (_reminderCount >= _maximumReminders)
+ {
+ _menuItemSnooze.Enabled = false;
+ }
+
this.Invalidate();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-10-22 18:16:34
|
Revision: 100
http://roam.svn.sourceforge.net/roam/?rev=100&view=rev
Author: jonfroehlich
Date: 2007-10-22 11:16:32 -0700 (Mon, 22 Oct 2007)
Log Message:
-----------
fixed bug in ScrollableLabel where UpdateLayout was not called when a new font was set
Modified Paths:
--------------
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-14 07:46:15 UTC (rev 99)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-22 18:16:32 UTC (rev 100)
@@ -560,7 +560,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs 2007-10-14 07:46:15 UTC (rev 99)
+++ Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs 2007-10-22 18:16:32 UTC (rev 100)
@@ -257,6 +257,19 @@
get { return _beginUpdate; }
}
+ public override Font Font
+ {
+ get { return base.Font; }
+ set
+ {
+ if (!base.Font.Equals(value))
+ {
+ base.Font = value;
+ UpdateLayout();
+ }
+ }
+ }
+
protected VScrollBar VScrollBar
{
get { return _vScrollBar; }
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-10-14 07:46:18
|
Revision: 99
http://roam.svn.sourceforge.net/roam/?rev=99&view=rev
Author: jonfroehlich
Date: 2007-10-14 00:46:15 -0700 (Sun, 14 Oct 2007)
Log Message:
-----------
exposed RetryInterval in Sms class
Modified Paths:
--------------
Trunk/Source/Roam/PocketOutlook/Sms.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.suo
Property Changed:
----------------
Trunk/Source/Roam.Win32/
Modified: Trunk/Source/Roam/PocketOutlook/Sms.cs
===================================================================
--- Trunk/Source/Roam/PocketOutlook/Sms.cs 2007-10-13 06:57:01 UTC (rev 98)
+++ Trunk/Source/Roam/PocketOutlook/Sms.cs 2007-10-14 07:46:15 UTC (rev 99)
@@ -165,6 +165,11 @@
}
}
+ public TimeSpan RetryInterval
+ {
+ get { return _retryInterval; }
+ }
+
#endregion Properties
public virtual bool Send()
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-13 06:57:01 UTC (rev 98)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-14 07:46:15 UTC (rev 99)
@@ -560,7 +560,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
Property changes on: Trunk/Source/Roam.Win32
___________________________________________________________________
Name: svn:ignore
- Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+ Windows Mobile 5.0 Smartphone SDK (ARMV4I)
Roam.Win32.vcproj.XPS410.Jon Froehlich.user
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-10-13 06:57:03
|
Revision: 98
http://roam.svn.sourceforge.net/roam/?rev=98&view=rev
Author: jonfroehlich
Date: 2007-10-12 23:57:01 -0700 (Fri, 12 Oct 2007)
Log Message:
-----------
updated SqlCeConnectionManager to note use the ThreadPool
Modified Paths:
--------------
Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs
===================================================================
--- Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs 2007-09-19 04:32:31 UTC (rev 97)
+++ Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs 2007-10-13 06:57:01 UTC (rev 98)
@@ -221,7 +221,7 @@
if (_connections.ContainsKey(threadCurrent))
{
_log.DebugFormat("Open : The current thread {0} has an assigned connection", threadCurrent.Name);
- return _connections[threadCurrent];
+ sqlConn = _connections[threadCurrent];
}
else if (_pooledConnections.Count > 0)
{
@@ -274,7 +274,10 @@
//check to see if we should actually close the connection
if (_pooledConnections.Count > _minPooledConnections)
{
- ThreadPool.QueueUserWorkItem(new WaitCallback(Close), sqlConn);
+ //Updated 10/10/2007. Do not rely on the thread pool to close the connection
+ //ThreadPool.QueueUserWorkItem(new WaitCallback(CloseCallback), sqlConn);
+ sqlConn.Close();
+ sqlConn.Dispose();
}
else
{
@@ -319,7 +322,7 @@
/// Called by thread.
/// </summary>
/// <param name="state"></param>
- private void Close(object state)
+ private void CloseCallback(object state)
{
SqlCeConnection sqlConn = (SqlCeConnection)state;
sqlConn.Close();
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-09-19 04:32:31 UTC (rev 97)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-13 06:57:01 UTC (rev 98)
@@ -698,7 +698,7 @@
<DependentUpon>SystemColorTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\TabControlTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\TabControlTest.Designer.cs">
<DependentUpon>TabControlTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs 2007-09-19 04:32:31 UTC (rev 97)
+++ Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs 2007-10-13 06:57:01 UTC (rev 98)
@@ -50,6 +50,13 @@
private bool _showAddButton = true;
private bool _automaticallyUpdateNoMatchesMessage = true;
private bool _showConfirmationDialog = true;
+
+ /// <summary>
+ /// Having trouble preventing the add button from gaining focus
+ /// when UserControl first shown. This field is used to prevent the
+ /// problem
+ /// </summary>
+ private bool _allowAddButtonFocus = false;
#endregion Private Fields
/// <summary>
@@ -64,9 +71,12 @@
InitializeComponent();
_textBorder.BorderBehavior = BorderBehavior.AlwaysDrawBorder;
+ _textBorder.TabStop = true;
+ _textBorder.TabIndex = 1;
+
_textBox = (TextBox)_textBorder.Control;
- _textBox.TabStop = true;
- _textBox.TabIndex = 0;
+ //_textBox.TabStop = false;
+ //_textBox.TabIndex = 0;
_textBox.KeyUp += new KeyEventHandler(OnKeyUpTextBox);
_textBox.TextChanged += new EventHandler(OnTextChangedTextBox);
_textBox.KeyDown += new KeyEventHandler(OnKeyDownTextBox);
@@ -76,32 +86,31 @@
_addButton.Text = "Add";
_addButton.TabStop = true;
- _addButton.TabIndex = 1;
+ _addButton.TabIndex = 2;
_addButton.ButtonPressed += new EventHandler(OnAddButtonPressed);
+ //_addButton.GotFocus += new EventHandler(OnAddButtonGotFocus);
_filteredListBox.HandleNumberKeys = false;
_filteredListBox.TabStop = true;
- _filteredListBox.TabIndex = 2;
+ _filteredListBox.TabIndex = 3;
_filteredListBox.ItemClicked += new EventHandler<VisualItemEventArgs>(OnFilteredListBoxItemClicked);
_filteredListBox.KeyDown += new KeyEventHandler(OnKeyDownFilteredListBox);
_filteredListBox.KeyPress += new KeyPressEventHandler(OnKeyPressFilteredListBox);
_filteredListBox.GotFocus += new EventHandler(OnGotFocusFilteredListBox);
- this.Controls.Add(_textBorder);
this.Controls.Add(_filteredListBox);
this.Controls.Add(_addButton);
- _textBox.Focus();
+ this.Controls.Add(_textBorder);
+
+ _textBorder.TabIndex = 1;
+ _addButton.TabIndex = 2;
+ _filteredListBox.TabIndex = 3;
+
+ //_textBox.Focus();
+ //_textBorder.Focus();
UpdateNoMatchesFoundMessage();
}
- private void OnGotFocusFilteredListBox(object sender, EventArgs e)
- {
- if (FilteredListBox.Items.Count > 0 && FilteredListBox.SelectedIndex == -1)
- {
- FilteredListBox.SelectedIndex = 0;
- }
- }
-
#region Properties
/// <summary>
/// If true, prevents multiple items with the same label to be added through
@@ -208,14 +217,17 @@
public virtual void UpdateLayout()
{
- _addButton.Visible = _showAddButton;
+ if (_addButton.Visible != _showAddButton)
+ {
+ _addButton.Visible = _showAddButton;
+ }
//_textBox.Location = new Point(0, 0);
//_textBox.Width = this.Width;
_textBorder.Location = new Point(0, 0);
_textBorder.Width = this.Width;
- if (_addButton.Visible)
+ if (_showAddButton)
{
int spaceBetweenTextAndButton = 1;
@@ -239,12 +251,27 @@
#endregion Public Methods
#region Protected Methods
+
+ //protected virtual void OnAddButtonGotFocus(object sender, EventArgs e)
+ //{
+ // if (!_allowAddButtonFocus)
+ // {
+ // _textBox.Focus();
+ // }
+ //}
+
protected override void OnResize(EventArgs e)
{
UpdateLayout();
base.OnResize(e);
}
+ protected override void OnGotFocus(EventArgs e)
+ {
+ base.OnGotFocus(e);
+ _textBox.Focus();
+ }
+
protected virtual void OnFilteredListBoxItemClicked(object sender, VisualItemEventArgs e)
{
_textBox.Text = _filteredListBox.SelectedItem.ToString();
@@ -385,6 +412,8 @@
protected virtual void OnKeyDownTextBox(object sender, KeyEventArgs e)
{
+ //_allowAddButtonFocus = true;
+
//jeffixme : on the imate kjam, the TabStop & TabIndex does not seem to be working for the
//up/down key press. Thus, we will have to handle this in a custom manner (by checking
//here for an e.KeyCode of Keys.Up and Keys.Down). I'm curious how other keyboard based
@@ -441,6 +470,17 @@
_filteredListBox.NoMatchesFoundMessage = message;
}
#endregion Protected Methods
+
+ #region Private Methods
+
+ private void OnGotFocusFilteredListBox(object sender, EventArgs e)
+ {
+ if (FilteredListBox.Items.Count > 0 && FilteredListBox.SelectedIndex == -1)
+ {
+ FilteredListBox.SelectedIndex = 0;
+ }
+ }
+ #endregion
}
}
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-09-19 04:32:33
|
Revision: 97
http://roam.svn.sourceforge.net/roam/?rev=97&view=rev
Author: jonfroehlich
Date: 2007-09-18 21:32:31 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
added incomplete ImageMap class to Roam.Test/Sandbox
Modified Paths:
--------------
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam.Test/Sandbox/ImageMap.Designer.cs
Trunk/Source/Roam.Test/Sandbox/ImageMap.cs
Added: Trunk/Source/Roam.Test/Sandbox/ImageMap.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/Sandbox/ImageMap.Designer.cs (rev 0)
+++ Trunk/Source/Roam.Test/Sandbox/ImageMap.Designer.cs 2007-09-19 04:32:31 UTC (rev 97)
@@ -0,0 +1,36 @@
+namespace Roam.UI.Controls
+{
+ partial class ImageMap
+ {
+ /// <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 Component 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()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
Added: Trunk/Source/Roam.Test/Sandbox/ImageMap.cs
===================================================================
--- Trunk/Source/Roam.Test/Sandbox/ImageMap.cs (rev 0)
+++ Trunk/Source/Roam.Test/Sandbox/ImageMap.cs 2007-09-19 04:32:31 UTC (rev 97)
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Roam.UI.Controls
+{
+ public enum ImageMapOverlayMode
+ {
+ None,
+ DrawGrid,
+ DrawGridWithNumbers
+ }
+
+ public enum ImageMapSizeMode
+ {
+ /// <summary>
+ /// The image is placed in the upper-left corner of the ImageMap.
+ /// The image is clipped if it is larger than the ImageMap it is contained in.
+ /// </summary>
+ Normal,
+
+ /// <summary>
+ /// The image within the ImageMap is stretched or shrunk to fit the size of the ImageMap.
+ /// </summary>
+ StretchImage
+ }
+
+ public partial class ImageMap : Control
+ {
+ private Image _image;
+ private ImageMapOverlayMode _overlayMode = ImageMapOverlayMode.DrawGridWithNumbers;
+ private ImageMapSizeMode _sizeMode = ImageMapSizeMode.Normal;
+ private float _gridAlpha = 0.5f;
+ private Font _gridFont = new Font(FontFamily.GenericSansSerif, 14, FontStyle.Bold);
+ private Color _gridColor = Color.PowderBlue;
+ private float _gridThickness = 2;
+
+ public ImageMap()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnPaint(PaintEventArgs pe)
+ {
+ Graphics g = pe.Graphics;
+ DrawGrid(g, null, this.ClientRectangle);
+ // Calling the base class OnPaint
+ base.OnPaint(pe);
+ }
+
+ protected virtual void DrawGrid(Graphics g, Image bottomLayers, Rectangle drawingArea)
+ {
+ Pen gridPen = new Pen(_gridColor, _gridThickness);
+ SolidBrush gridBrush = new SolidBrush(_gridColor);
+
+ //split up area into a 3x3 grid
+ const int numGrids = 3;
+ Size gridSize = new Size((int)(drawingArea.Width / (float)numGrids), (int)(drawingArea.Height / (float)numGrids));
+ for (int gridLine = 1; gridLine < numGrids; gridLine++)
+ {
+ //draw horizontal horizontal line
+ int y = drawingArea.Top + gridLine * gridSize.Height;
+ g.DrawLine(gridPen, drawingArea.Left, y, drawingArea.Right, y);
+
+ //draw vertical grid line
+ int x = drawingArea.Left + gridLine * gridSize.Width;
+ g.DrawLine(gridPen, x, drawingArea.Top, x, drawingArea.Bottom);
+ }
+
+ //draw labels within grid
+ for (int i = 1; i <= numGrids * numGrids; i++)
+ {
+ string label = i.ToString();
+ SizeF labelSize = g.MeasureString(label, _gridFont);
+ int row = (int)Math.Floor(i / (float)numGrids);
+ int col = (i - 1) % numGrids;
+
+ int xLeftGrid = drawingArea.Left + col * gridSize.Width;
+ int yTopGrid = drawingArea.Top + row * gridSize.Height;
+
+ float xLabel = xLeftGrid + gridSize.Width / 2f - labelSize.Width / 2f;
+ float yLabel = yTopGrid + gridSize.Height / 2f - labelSize.Width / 2f;
+
+ g.DrawString(label, _gridFont, gridBrush, xLabel, yLabel);
+ }
+
+ gridPen.Dispose();
+ gridBrush.Dispose();
+ }
+ }
+}
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-09-17 23:18:46
|
Revision: 96
http://roam.svn.sourceforge.net/roam/?rev=96&view=rev
Author: jonfroehlich
Date: 2007-09-17 16:18:45 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
added required OpenNETCF libraries to the Library folder so that users don't have to install that separately
Modified Paths:
--------------
Trunk/Library/Release/POLS.PhoneLib.dll
Trunk/Library/Release/POLS.PhoneLib.pdb
Trunk/Library/Release/POLS.SharedLib.dll
Trunk/Library/Release/POLS.SharedLib.pdb
Trunk/Source/Roam/Roam.csproj
Trunk/Source/Roam.SqlCe/Roam.SqlCe.csproj
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Roam.UI.csproj
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Library/Release/OpenNETCF.Drawing.dll
Trunk/Library/Release/OpenNETCF.Drawing.xml
Trunk/Library/Release/OpenNETCF.Net.dll
Trunk/Library/Release/OpenNETCF.Net.xml
Trunk/Library/Release/OpenNETCF.Phone.XML
Trunk/Library/Release/OpenNETCF.Phone.dll
Trunk/Library/Release/OpenNETCF.Windows.Forms.XML
Trunk/Library/Release/OpenNETCF.Windows.Forms.dll
Trunk/Library/Release/OpenNETCF.WindowsCE.XML
Trunk/Library/Release/OpenNETCF.WindowsCE.dll
Trunk/Library/Release/OpenNETCF.WindowsMobile.XML
Trunk/Library/Release/OpenNETCF.WindowsMobile.dll
Trunk/Library/Release/OpenNETCF.dll
Trunk/Library/Release/OpenNETCF.xml
Added: Trunk/Library/Release/OpenNETCF.Drawing.dll
===================================================================
(Binary files differ)
Property changes on: Trunk/Library/Release/OpenNETCF.Drawing.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: Trunk/Library/Release/OpenNETCF.Drawing.xml
===================================================================
--- Trunk/Library/Release/OpenNETCF.Drawing.xml (rev 0)
+++ Trunk/Library/Release/OpenNETCF.Drawing.xml 2007-09-17 23:18:45 UTC (rev 96)
@@ -0,0 +1,2296 @@
+<?xml version="1.0"?>
+<doc>
+ <assembly>
+ <name>OpenNETCF.Drawing</name>
+ </assembly>
+ <members>
+ <member name="T:OpenNETCF.Win32.BitmapFileHeader">
+ <summary>
+ This structure contains information about the type, size, and layout of a file that containing a device-independent bitmap (DIB).
+ </summary>
+ <remarks>Wraps the native <b>BITMAPFILEHEADER</b> structure</remarks>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapFileHeader.Type">
+ <summary>
+ Specifies the file type. It must be BM.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapFileHeader.Size">
+ <summary>
+ Specifies the size, in bytes, of the bitmap file.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapFileHeader.OffBits">
+ <summary>
+ Specifies the offset, in bytes, from the <b>BitmapFileHeader</b> structure to the bitmap bits.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapFileHeader.Data">
+ <summary>
+ Internal data
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Drawing.Imaging.ImageTag">
+ <summary>
+ Image property ID tags (PROPID's from the EXIF tags)
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_EXIF_IFD">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_GPS_IFD">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_NEW_SUBFILE_TYPE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_SUBFILE_TYPE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_IMAGE_WIDTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_IMAGE_HEIGHT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_BITS_PER_SAMPLE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_COMPRESSION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PHOTOMETRIC_INTERP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THRESH_HOLDING">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_CELL_WIDTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_CELL_HEIGHT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_FILL_ORDER">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_DOCUMENT_NAME">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_IMAGE_DESCRIPTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_EQUIP_MAKE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_EQUIP_MODEL">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_STRIP_OFFSETS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_ORIENTATION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_SAMPLES_PER_PIXEL">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_ROWS_PER_STRIP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_STRIP_BYTES_COUNT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_MIN_SAMPLE_VALUE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_MAX_SAMPLE_VALUE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_X_RESOLUTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_Y_RESOLUTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PLANAR_CONFIG">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PAGE_NAME">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_X_POSITION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_Y_POSITION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_FREE_OFFSET">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_FREE_BYTE_COUNTS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_GRAY_RESPONSE_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_GRAY_RESPONSE_CURVE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_T4_OPTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_T6_OPTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_RESOLUTION_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PAGE_NUMBER">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_TRANSFER_FUNCTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_SOFTWARE_USED">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_DATE_TIME">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_ARTIST">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HOST_COMPUTER">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PREDICTOR">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_WHITE_POINT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PRIMAY_CHROMATICS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_COLOR_MAP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HALFTONE_HINTS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_TILE_WIDTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_TILE_LENGTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_TILE_OFFSET">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_TILE_BYTE_COUNTS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_INK_SET">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_INK_NAMES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_NUMBER_OF_INKS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_DOT_RANGE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_TARGET_PRINTER">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_EXTRA_SAMPLES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_SAMPLE_FORMAT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_SMIN_SAMPLE_VALUE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_SMAX_SAMPLE_VALUE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_TRANSFER_RANGE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_PROC">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_INTER_FORMAT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_INTER_LENGTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_RESTART_INTERVAL">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_LOSSLESS_PREDICTORS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_POINT_TRANSFORMS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_Q_TABLES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_DC_TABLES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_AC_TABLES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_YCbCr_COEFFICIENTS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_YCbCr_SUBSAMPLING">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_YCbCr_POSITIONING">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_REF_BLACK_WHITE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_ICC_PROFILE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_GAMMA">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_ICC_PROFILE_DESCRIPTOR">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_SRGB_RENDERING_INTENT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_IMAGE_TITLE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_COPYRIGHT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_RESOLUTION_X_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_RESOLUTION_Y_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_RESOLUTION_X_LENGTH_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_RESOLUTION_Y_LENGTH_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PRINT_FLAGS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PRINT_FLAGS_VERSION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PRINT_FLAGS_CROP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PRINT_FLAGS_BLEEDWIDTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PRINT_FLAGS_BLEEDWIDTHSCALE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HALFTONE_LPI">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HALFTONE_LPI_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HALFTONE_DEGREE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HALFTONE_SHAPE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HALFTONE_MISC">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_HALFTONE_SCREEN">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_JPEG_QUALITY">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_GRID_SIZE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_FORMAT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_WIDTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_HEIGHT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_COLORDEPTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_PLANES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_RAWBYTES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_SIZE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_COMPRESSED_SIZE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_COLORTRANSFER_FUNCTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_DATA">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_IMAGE_WIDTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_IMAGE_HEIGHT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_BITS_PER_SAMPLE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_COMPRESSION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_PHOTOMETRIC_INTERP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_IMAGE_DESCRIPTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_EQUIP_MAKE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_EQUIP_MODEL">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_STRIP_OFFSETS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_ORIENTATION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_SAMPLES_PER_PIXEL">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_ROWS_PER_STRIP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_STRIP_BYTES_COUNT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_RESOLUTION_X">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_RESOLUTION_Y">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_PLANAR_CONFIG">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_RESOLUTION_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_TRANSFER_FUNCTION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_SOFTWARE_USED">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_DATE_TIME">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_ARTIST">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_WHITE_POINT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_PRIMAY_CHROMATICS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_YCbCr_COEFFICIENTS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_YCbCr_SUBSAMPLING">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_YCbCr_POSITIONING">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_REF_BLACK_WHITE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_THUMBNAIL_COPYRIGHT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_LUMINANCE_TABLE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_CHROMINANCE_TABLE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_FRAMEDELAY">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_LOOPCOUNT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PIXEL_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PIXEL_PER_UNIT_X">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PIXEL_PER_UNIT_Y">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.TAG_PALETTE_HISTOGRAM">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_EXPOSURE_TIME">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_F_NUMBER">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_EXPOSURE_PROG">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_SPECTRAL_SENSE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_ISO_SPEED">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_OECF">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_VER">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_D_T_ORIG">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_D_T_DIGITIZED">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_COMP_CONFIG">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_COMP_BPP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_SHUTTER_SPEED">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_APERATURE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_BRIGHTNESS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_EXPOSURE_BIAS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_MAX_APERATURE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_SUBJECT_DIST">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_METERING_MODE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_LIGHT_SOURCE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FLASH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FOCAL_LENGTH">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_MAKER_NOTE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_USER_COMMENT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_D_T_SUBSEC">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_D_T_ORIG_SS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_D_T_DIG_SS">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FPX_VER">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_COLOR_SPACE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_PIX_X_DIM">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_PIX_Y_DIM">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_RELATED_WAV">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_INTEROP">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FLASH_ENERGY">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_SPATIAL_FR">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FOCAL_X_RES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FOCAL_Y_RES">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FOCAL_RES_UNIT">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_SUBJECT_LOC">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_EXPOSURE_INDEX">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_SENSING_METHOD">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_FILE_SOURCE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_SCENE_TYPE">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.ImageTag.EXIF_TAG_CFA_PATTERN">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Drawing.Imaging.TagType">
+ <summary>
+ Image tyge type
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.BYTE">
+ <summary>
+ 8-bit unsigned int
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.ASCII">
+ <summary>
+ 8-bit byte containing one 7-bit ASCII code.
+ NULL terminated.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.SHORT">
+ <summary>
+ 16-bit unsigned int
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.LONG">
+ <summary>
+ 32-bit unsigned int
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.RATIONAL">
+ <summary>
+ Two LONGs. The first LONG is the numerator,
+ the second LONG expresses the denomintor.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.UNDEFINED">
+ <summary>
+ 8-bit byte that can take any value depending
+ on field definition
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.SLONG">
+ <summary>
+ 32-bit singed integer (2's complement notation)
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.Imaging.TagType.SRATIONAL">
+ <summary>
+ Two SLONGs. First is numerator, second is denominator
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Win32.GDI">
+ <summary>
+ GDI P/Invokes and definitions.
+ </summary>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.SetTextColor(System.IntPtr,System.Int32)">
+ <summary>
+ Set the forecolor of text in the selected DC
+ </summary>
+ <param name="hdc"></param>
+ <param name="crColor"></param>
+ <returns></returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.GetTextColor(System.IntPtr)">
+ <summary>
+ Get the forecolor of text in the selected DC
+ </summary>
+ <param name="hdc"></param>
+ <returns></returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.SetBkColor(System.IntPtr,System.Int32)">
+ <summary>
+ Set the backcolor in the selected DC
+ </summary>
+ <param name="hdc"></param>
+ <param name="crColor"></param>
+ <returns></returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.SetBkMode(System.IntPtr,OpenNETCF.Win32.GDI.BackgroundMode)">
+ <summary>
+ Set the backmode in the selected DC
+ </summary>
+ <param name="hdc"></param>
+ <param name="iBkMode"></param>
+ <returns></returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.SelectObject(System.IntPtr,System.IntPtr)">
+ <summary>
+ Select a system object (FONT, DC, etc.)
+ </summary>
+ <param name="hdc"></param>
+ <param name="hgdiobj"></param>
+ <returns></returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.ReleaseDC(System.IntPtr,System.IntPtr)">
+ <summary>
+ Release a Device Context
+ </summary>
+ <param name="hWnd"></param>
+ <param name="hDC"></param>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.GetWindowDC(System.IntPtr)">
+ <summary>
+ Get the DC for the specified window
+ </summary>
+ <param name="hWnd">Native window handle of the window.</param>
+ <returns>Device Context Handle for specified window.</returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.GetDC(System.IntPtr)">
+ <summary>
+ Get the DC for the specified window handle
+ </summary>
+ <param name="hWnd"></param>
+ <returns></returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.Rectangle(System.IntPtr,System.Int32,System.Int32,System.Int32,System.Int32)">
+ <summary>
+ Draw a rectangle in a DC
+ </summary>
+ <param name="hdc"></param>
+ <param name="nLeftRect"></param>
+ <param name="nTopRect"></param>
+ <param name="nRightRect"></param>
+ <param name="nBottomRect"></param>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.GetObject(System.IntPtr,System.Int32,System.Byte[])">
+ <summary>
+ This function obtains information about a specified graphics object.
+ </summary>
+ <param name="hObj">Handle to the graphics object of interest.</param>
+ <param name="cb">Specifies the number of bytes of information to be written to the buffer.</param>
+ <param name="objdata">a buffer that is to receive the information about the specified graphics object.</param>
+ <returns>If the function succeeds, and lpvObject is a valid pointer, the return value is the number of bytes stored into the buffer.</returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.GetObject(System.IntPtr,System.Int32,OpenNETCF.Win32.DibSection)">
+ <summary>
+ This function obtains information about a specified graphics object.
+ </summary>
+ <param name="hObj">Handle to the graphics object of interest.</param>
+ <param name="cb">Specifies the number of bytes of information to be written to the buffer.</param>
+ <param name="objdata">a buffer that is to receive the information about the specified graphics object.</param>
+ <returns>If the function succeeds, and lpvObject is a valid pointer, the return value is the number of bytes stored into the buffer.</returns>
+ </member>
+ <member name="M:OpenNETCF.Win32.GDI.CreateSolidBrush(System.Int32)">
+ <summary>
+ This function creates a logical brush that has the specified solid color.
+ </summary>
+ <param name="crColor">Specifies the color of the brush.</param>
+ <returns>A handle that identifies a logical brush indicates success.</returns>
+ </member>
+ <member name="T:OpenNETCF.Win32.GDI.RegionFlags">
+ <summary>
+ Region type
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.GDI.RegionFlags.ERROR">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.GDI.RegionFlags.NULLREGION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.GDI.RegionFlags.SIMPLEREGION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.GDI.RegionFlags.COMPLEXREGION">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Win32.GDI.BackgroundMode">
+ <summary>
+ Background mode
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.GDI.BackgroundMode.TRANSPARENT">
+ <summary>
+ Background is Transparent.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.GDI.BackgroundMode.OPAQUE">
+ <summary>
+ Background is Opaque.
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Drawing.ColorTranslator">
+ <summary>
+ Translates colors to and from <see cref="T:System.Drawing.Color"/> structures.
+ </summary>
+ <seealso cref="T:System.Drawing.ColorTranslator">System.Drawing.ColorTranslator Class</seealso>
+ </member>
+ <member name="M:OpenNETCF.Drawing.ColorTranslator.ToHtml(System.Drawing.Color)">
+ <summary>
+ Translates the specified <see cref="T:System.Drawing.Color"/> structure to an HTML string color representation.
+ </summary>
+ <param name="c">The <see cref="T:System.Drawing.Color"/> structure to translate.</param>
+ <returns>The string that represents the HTML color.</returns>
+ <remarks>Unlike the desktop version of this function it does not check for named colors but instead always returns the hex notation values - e.g. Color.Red = "#FF0000"</remarks>
+ <seealso cref="M:System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color)">System.Drawing.ColorTranslator.ToHtml Method</seealso>
+ </member>
+ <member name="M:OpenNETCF.Drawing.ColorTranslator.ToWin32(System.Drawing.Color)">
+ <summary>
+ Translates the specified <see cref="T:System.Drawing.Color"/> structure to a Windows color.
+ </summary>
+ <param name="c">The <see cref="T:System.Drawing.Color"/> structure to translate.</param>
+ <returns>The Windows color value.</returns>
+ <seealso cref="M:System.Drawing.ColorTranslator.ToWin32(System.Drawing.Color)">System.Drawing.ColorTranslator.ToWin32 Method</seealso>
+ </member>
+ <member name="M:OpenNETCF.Drawing.ColorTranslator.FromHtml(System.String)">
+ <summary>
+ Translates an HTML color representation to a <see cref="T:System.Drawing.Color"/> structure.
+ </summary>
+ <param name="htmlColor">The string representation of the Html color to translate.</param>
+ <returns>The <see cref="T:System.Drawing.Color"/> structure that represents the translated HTML color.</returns>
+ <seealso cref="M:System.Drawing.ColorTranslator.FromHtml(System.String)">System.Drawing.ColorTranslator.FromHtml Method</seealso>
+ </member>
+ <member name="M:OpenNETCF.Drawing.ColorTranslator.FromWin32(System.Int32)">
+ <summary>
+ Translates a Windows color value to a <see cref="T:System.Drawing.Color"/> structure.
+ </summary>
+ <param name="win32Color">The Windows color to translate.</param>
+ <returns>The <see cref="T:System.Drawing.Color"/> structure that represents the translated Windows color.</returns>
+ <seealso cref="M:System.Drawing.ColorTranslator.FromWin32(System.Int32)">System.Drawing.ColorTranslator.FromWin32 Method</seealso>
+ </member>
+ <member name="M:OpenNETCF.Drawing.ColorTranslator.FromOle(System.Int32)">
+ <summary>
+ Translates an OLE color value to a <see cref="T:System.Drawing.Color"/> structure.
+ </summary>
+ <param name="oleColor">The OLE color to translate.</param>
+ <returns>The <see cref="T:System.Drawing.Color"/> structure that represents the translated OLE color.</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.ColorTranslator.ToOle(System.Drawing.Color)">
+ <summary>
+ Translates the specified <see cref="T:System.Drawing.Color"/> structure to an OLE color.
+ </summary>
+ <param name="c">The <see cref="T:System.Drawing.Color"/> structure to translate.</param>
+ <returns>The OLE color value.</returns>
+ </member>
+ <member name="T:OpenNETCF.Drawing.ContentAlignment2">
+ <summary>
+ Specifies alignment of content on the drawing surface.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.BottomCenter">
+ <summary>
+ Content is vertically aligned at the bottom, and horizontally aligned at the center.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.BottomLeft">
+ <summary>
+ Content is vertically aligned at the bottom, and horizontally aligned on the left.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.BottomRight">
+ <summary>
+ Content is vertically aligned at the bottom, and horizontally aligned on the right.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.MiddleCenter">
+ <summary>
+ Content is vertically aligned in the middle, and horizontally aligned at the center.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.MiddleLeft">
+ <summary>
+ Content is vertically aligned in the middle, and horizontally aligned on the left.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.MiddleRight">
+ <summary>
+ Content is vertically aligned in the middle, and horizontally aligned on the right.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.TopCenter">
+ <summary>
+ Content is vertically aligned at the top, and horizontally aligned at the center.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.TopLeft">
+ <summary>
+ Content is vertically aligned at the top, and horizontally aligned on the left.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.ContentAlignment2.TopRight">
+ <summary>
+ Content is vertically aligned at the top, and horizontally aligned on the right.
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Drawing.RotateFlipType">
+ <summary>
+ Specifies the direction of an image's rotation and the axis used to flip the image.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate180FlipXY">
+ <summary>
+ Specifies a 180-degree rotation followed by a horizontal and vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.RotateNoneFlipNone">
+ <summary>
+ Specifies no rotation and no flipping.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate270FlipXY">
+ <summary>
+ Specifies a 270-degree rotation followed by a horizontal and vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate90FlipNone">
+ <summary>
+ Specifies a 90-degree rotation without flipping.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate180FlipNone">
+ <summary>
+ Specifies a 180-degree rotation without flipping.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.RotateNoneFlipXY">
+ <summary>
+ Specifies no rotation followed by a horizontal and vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate270FlipNone">
+ <summary>
+ Specifies a 270-degree rotation without flipping.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate90FlipXY">
+ <summary>
+ Specifies a 90-degree rotation followed by a horizontal and vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate180FlipY">
+ <summary>
+ Specifies a 180-degree rotation followed by a vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.RotateNoneFlipX">
+ <summary>
+ Specifies no rotation followed by a horizontal flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate90FlipX">
+ <summary>
+ Specifies a 90-degree rotation followed by a horizontal flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate270FlipY">
+ <summary>
+ Specifies a 270-degree rotation followed by a vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.RotateNoneFlipY">
+ <summary>
+ Specifies no rotation followed by a vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate180FlipX">
+ <summary>
+ Specifies a 180-degree rotation followed by a horizontal flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate90FlipY">
+ <summary>
+ Specifies a 90-degree rotation followed by a vertical flip.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Drawing.RotateFlipType.Rotate270FlipX">
+ <summary>
+ Specifies a 270-degree rotation followed by a horizontal flip.
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Win32.BitmapInfoHeader">
+ <summary>
+ Contains information about the dimensions and color format of a device-independent bitmap (DIB).
+ </summary>
+ <remarks>Wrapper for Win32 <b>BITMAPINFOHEADER</b> structure</remarks>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.Size">
+ <summary>
+ Specifies the number of bytes required by the structure.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.Width">
+ <summary>
+ Specifies the width of the bitmap, in pixels.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.Height">
+ <summary>
+ Specifies the height of the bitmap, in pixels.
+ If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner.
+ If biHeight is negative, the bitmap is a top-down DIB and its origin is the upper-left corner.
+ If biHeight is negative, indicating a top-down DIB, biCompression must be either BI_RGB or BI_BITFIELDS.
+ Top-down DIBs cannot be compressed.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.Planes">
+ <summary>
+ Specifies the number of planes for the target device.
+ This value must be set to 1.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.BitCount">
+ <summary>
+ Specifies the number of bits per pixel.
+ The biBitCount member determines the number of bits that define each pixel and the maximum number of colors in the bitmap.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.Compression">
+ <summary>
+ Specifies the type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be compressed).
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.SizeImage">
+ <summary>
+ Specifies the size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.XPelsPerMeter">
+ <summary>
+ Specifies the horizontal resolution, in pixels per meter, of the target device for the bitmap.
+ An application can use this value to select a bitmap from a resource group that best matches the characteristics of the current device.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.YPelsPerMeter">
+ <summary>
+ Specifies the vertical resolution, in pixels per meter, of the target device for the bitmap
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.ClrUsed">
+ <summary>
+ Specifies the number of color indexes in the color table that are actually used by the bitmap.
+ If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression.
+ </summary>
+ </member>
+ <member name="P:OpenNETCF.Win32.BitmapInfoHeader.ClrImportant">
+ <summary>
+ Specifies the number of color indexes required for displaying the bitmap.
+ If this value is zero, all colors are required.
+ </summary>
+ </member>
+ <member name="T:OpenNETCF.Drawing.Imaging.ImageUtils">
+ <summary>
+ High-level image manipulation routines
+ </summary>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.RotateFlip(System.Drawing.Bitmap,OpenNETCF.Drawing.RotateFlipType)">
+ <summary>
+ Rotate and/or flip bitmap
+ </summary>
+ <param name="bitmap">Image</param>
+ <param name="type">Operation</param>
+ <returns>Modified bitmap</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.Rotate(System.Drawing.Bitmap,System.Single)">
+ <summary>
+ Rotates image by specified amount of degrees
+ </summary>
+ <param name="bitmap">Image</param>
+ <param name="angle">Amount of degrees to rotate image by. Must be 90, 180, or 270</param>
+ <returns>Rotated image</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.Flip(System.Drawing.Bitmap,System.Boolean,System.Boolean)">
+ <summary>
+ Flips image around X and/or Y axes
+ </summary>
+ <param name="bitmap">Image</param>
+ <param name="flipX">Whether to flip around X axis</param>
+ <param name="flipY">Whether to flip around Y axis</param>
+ <returns>Flipped image</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.IBitmapImageToBitmap(OpenNETCF.Drawing.Imaging.IBitmapImage)">
+ <summary>
+ Converts Imaging API IBitmapImage object to .NET Bitmap object
+ </summary>
+ <param name="imageBitmap">Source IImageBitmap object</param>
+ <returns>Bitmap object</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.CreateThumbnail(System.IO.Stream,System.Drawing.Size)">
+ <summary>
+ Creates a thumbnail of a specified size out of a (compressed image)
+ </summary>
+ <param name="stream">Stream containing the image</param>
+ <param name="size">requested thumbnail size</param>
+ <returns>Thumbnail image</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.BitmapToIImageBitmap(System.Drawing.Bitmap)">
+ <summary>
+ Converts .NET Bitmap object to Imaging API IBitmapImage object
+ </summary>
+ <param name="bitmap">Source Bitmap object</param>
+ <returns>IImageBitmap object</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.LoadProperty(System.String,OpenNETCF.Drawing.Imaging.ImageTag)">
+ <summary>
+ Loads specified image property from the given image
+ </summary>
+ <param name="imagePath">path to the image file</param>
+ <param name="property">Property tag</param>
+ <returns>Property</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.LoadProperty(OpenNETCF.Drawing.Imaging.IImageDecoder,OpenNETCF.Drawing.Imaging.ImageTag)">
+ <summary>
+ Loads specified image property from an ImageDecoder object
+ </summary>
+ <param name="decoder"><c>IImageDecoder</c> object</param>
+ <param name="property">Property tag</param>
+ <returns>Property</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.LoadProperty(OpenNETCF.Drawing.Imaging.PropertyItem)">
+ <summary>
+ Loads managed <c>ImageProperty</c> object from an unmanaged <c>PropertyItem</c>
+ </summary>
+ <param name="item"><c>PropertyItem</c></param>
+ <returns><c>ImageProperty</c></returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.GetAllTags(OpenNETCF.Drawing.Imaging.IImageDecoder)">
+ <summary>
+ Loads all image tags for the image
+ </summary>
+ <param name="decoder"><c>IImageDecoder</c> object</param>
+ <returns>Array of all tags</returns>
+ </member>
+ <member name="M:OpenNETCF.Drawing.Imaging.ImageUtils.GetAllProperties(OpenNETCF.Drawing.Imaging.IImageDecoder)">
+ <summary>
+ Loads all image properties for the image
+ </summary>
+ <param name="decoder"><c>IImageDecoder</c> object</param>
+ <returns>Array of all properties</returns>
+ </member>
+ <member name="T:OpenNETCF.Win32.DibSection">
+ <summary>
+ Wrapper for WIN32 <b>DIBSECTION</b> structure
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.DibSection.bmType">
+ <summary>
+ Specifies the bitmap type; set to zero.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.DibSection.bmWidth">
+ <summary>
+ Specifies the width, in pixels, of the bitmap.
+ The width must be greater than zero.
+ </summary>
+ </member>
+ <member name="F:OpenNETCF.Win32.DibSection.bmHeight">
+ <summary>
+ Specifies the height, in pixels, of the bitmap.
+ ...
[truncated message content] |
|
From: <jon...@us...> - 2007-09-17 03:33:43
|
Revision: 95
http://roam.svn.sourceforge.net/roam/?rev=95&view=rev
Author: jonfroehlich
Date: 2007-09-16 20:33:41 -0700 (Sun, 16 Sep 2007)
Log Message:
-----------
added storage card utility methods in StorageCardUtils that return details on the size of the storage card and how much free space exists
Modified Paths:
--------------
Trunk/Source/Roam/Utils/StorageCardUtils.cs
Trunk/Source/Roam.Common/Roam.Common.csproj
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam.Common/Utils/MeasurementUtils.cs
Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.Designer.cs
Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.cs
Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.resx
Modified: Trunk/Source/Roam/Utils/StorageCardUtils.cs
===================================================================
--- Trunk/Source/Roam/Utils/StorageCardUtils.cs 2007-09-15 07:41:18 UTC (rev 94)
+++ Trunk/Source/Roam/Utils/StorageCardUtils.cs 2007-09-17 03:33:41 UTC (rev 95)
@@ -114,5 +114,33 @@
return false;
}
}
+
+ public static long GetStorageCardSizeInBytes()
+ {
+ if (!FlashCardExists()) { return 0; }
+
+ string storageCardPath = GetFirstFlashCardPath();
+ ulong byteAvailableToCaller, totalNumOfBytes, totalNumOfFreeBytes;
+ GetDiskFreeSpaceEx(storageCardPath, out byteAvailableToCaller, out totalNumOfBytes, out totalNumOfFreeBytes);
+ return (long)totalNumOfBytes;
+ }
+
+ public static long GetStorageCardFreeSpaceInBytes()
+ {
+ if (!FlashCardExists()) { return 0; }
+
+ string storageCardPath = GetFirstFlashCardPath();
+ ulong byteAvailableToCaller, totalNumOfBytes, totalNumOfFreeBytes;
+ GetDiskFreeSpaceEx(storageCardPath, out byteAvailableToCaller, out totalNumOfBytes, out totalNumOfFreeBytes);
+ return (long)totalNumOfFreeBytes;
+ }
+
+ [DllImport("coredll.dll")]
+ private static extern bool GetDiskFreeSpaceEx(
+ string lpDirectoryName,
+ out ulong lpFreeBytesAvailableToCaller,
+ out ulong lpTotalNumberOfBytes,
+ out ulong lpTotalNumberOfFreeBytes
+ );
}
}
Modified: Trunk/Source/Roam.Common/Roam.Common.csproj
===================================================================
--- Trunk/Source/Roam.Common/Roam.Common.csproj 2007-09-15 07:41:18 UTC (rev 94)
+++ Trunk/Source/Roam.Common/Roam.Common.csproj 2007-09-17 03:33:41 UTC (rev 95)
@@ -79,6 +79,7 @@
<Compile Include="Utils\EnumUtils.cs" />
<Compile Include="Utils\ErrorUtils.cs" />
<Compile Include="Utils\ImagingUtils.cs" />
+ <Compile Include="Utils\MeasurementUtils.cs" />
<Compile Include="Utils\SummaryStatistics.cs" />
<Compile Include="Utils\Vector2.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Added: Trunk/Source/Roam.Common/Utils/MeasurementUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/MeasurementUtils.cs (rev 0)
+++ Trunk/Source/Roam.Common/Utils/MeasurementUtils.cs 2007-09-17 03:33:41 UTC (rev 95)
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Roam.Common.Utils
+{
+ public static class MeasurementUtils
+ {
+ public static readonly long BitsInAByte = 8;
+ public static readonly long BytesInAKilobyte = 1024;
+ public static readonly long BytesInAMegabyte = BytesInAKilobyte * 1024;
+ public static readonly long BytesInAGigabyte = BytesInAMegabyte * 1024;
+
+ public static double ConvertBytesToMegabyte(long bytes)
+ {
+ return bytes / (double)BytesInAMegabyte;
+ }
+
+ public static double ConvertBytesToGigabyte(long bytes)
+ {
+ return bytes / (double)BytesInAGigabyte;
+ }
+ }
+}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-09-15 07:41:18 UTC (rev 94)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-09-17 03:33:41 UTC (rev 95)
@@ -366,6 +366,10 @@
<SubType>Designer</SubType>
<DependentUpon>PowerTestForm.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Utils\StorageCardUtilsTest.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>StorageCardUtilsTest.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Utils\TextBoxForm.resx">
<SubType>Designer</SubType>
<DependentUpon>TextBoxForm.cs</DependentUpon>
@@ -762,6 +766,12 @@
<Compile Include="Utils\PowerTestForm.Designer.cs">
<DependentUpon>PowerTestForm.cs</DependentUpon>
</Compile>
+ <Compile Include="Utils\StorageCardUtilsTest.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Utils\StorageCardUtilsTest.Designer.cs">
+ <DependentUpon>StorageCardUtilsTest.cs</DependentUpon>
+ </Compile>
<Compile Include="Utils\TextBoxForm.cs">
<SubType>Form</SubType>
</Compile>
Added: Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.Designer.cs (rev 0)
+++ Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.Designer.cs 2007-09-17 03:33:41 UTC (rev 95)
@@ -0,0 +1,98 @@
+namespace Roam.Test.Utils
+{
+ partial class StorageCardUtilsTest
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+ private System.Windows.Forms.MainMenu mainMenu1;
+
+ /// <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.mainMenu1 = new System.Windows.Forms.MainMenu();
+ this.menuItem1 = new System.Windows.Forms.MenuItem();
+ this.menuItem2 = new System.Windows.Forms.MenuItem();
+ this._scrollableLabel = new Roam.UI.Controls.ScrollableLabel();
+ this.menuItem3 = new System.Windows.Forms.MenuItem();
+ this.menuItem4 = new System.Windows.Forms.MenuItem();
+ this.SuspendLayout();
+ //
+ // mainMenu1
+ //
+ this.mainMenu1.MenuItems.Add(this.menuItem1);
+ this.mainMenu1.MenuItems.Add(this.menuItem2);
+ //
+ // menuItem1
+ //
+ this.menuItem1.Text = "Exit";
+ this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
+ //
+ // menuItem2
+ //
+ this.menuItem2.MenuItems.Add(this.menuItem3);
+ this.menuItem2.MenuItems.Add(this.menuItem4);
+ this.menuItem2.Text = "Menu";
+ //
+ // _scrollableLabel
+ //
+ this._scrollableLabel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this._scrollableLabel.Font = new System.Drawing.Font("Segoe Condensed", 7F, System.Drawing.FontStyle.Regular);
+ this._scrollableLabel.Location = new System.Drawing.Point(0, 0);
+ this._scrollableLabel.Name = "_scrollableLabel";
+ this._scrollableLabel.Size = new System.Drawing.Size(240, 266);
+ this._scrollableLabel.TabIndex = 5;
+ this._scrollableLabel.Text = "scrollableLabel1";
+ //
+ // menuItem3
+ //
+ this.menuItem3.Text = "Clear";
+ this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
+ //
+ // menuItem4
+ //
+ this.menuItem4.Text = "Refresh";
+ this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
+ //
+ // StorageCardUtilsTest
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(131F, 131F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.AutoScroll = true;
+ this.ClientSize = new System.Drawing.Size(240, 266);
+ this.Controls.Add(this._scrollableLabel);
+ this.Menu = this.mainMenu1;
+ this.Name = "StorageCardUtilsTest";
+ this.Text = "StorageCardUtilsTest";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuItem menuItem1;
+ private System.Windows.Forms.MenuItem menuItem2;
+ private System.Windows.Forms.MenuItem menuItem3;
+ private System.Windows.Forms.MenuItem menuItem4;
+ private Roam.UI.Controls.ScrollableLabel _scrollableLabel;
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.cs (rev 0)
+++ Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.cs 2007-09-17 03:33:41 UTC (rev 95)
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Roam.Utils;
+using Roam.Common.Utils;
+using OpenNETCF.Diagnostics;
+
+namespace Roam.Test.Utils
+{
+ public partial class StorageCardUtilsTest : Form
+ {
+ public StorageCardUtilsTest()
+ {
+ InitializeComponent();
+ _scrollableLabel.Clear();
+ }
+
+ private void menuItem1_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void menuItem3_Click(object sender, EventArgs e)
+ {
+ _scrollableLabel.Clear();
+ }
+
+ private void menuItem4_Click(object sender, EventArgs e)
+ {
+ Stopwatch stopWatch = Stopwatch.StartNew();
+ string storagePath = StorageCardUtils.GetFirstFlashCardPath();
+ bool doesStorageCardExists = StorageCardUtils.FlashCardExists();
+ long storageCardSizeInBytes = StorageCardUtils.GetStorageCardSizeInBytes();
+ long freeSpaceInBytes = StorageCardUtils.GetStorageCardFreeSpaceInBytes();
+ stopWatch.Stop();
+
+ if (doesStorageCardExists)
+ {
+ _scrollableLabel.AddLine("Storage card found");
+ _scrollableLabel.AddLine(@"Storage card path: \{0}\", storagePath);
+ _scrollableLabel.AddLine("Storage card size: {0:0.0} megabytes",
+ MeasurementUtils.ConvertBytesToMegabyte(storageCardSizeInBytes));
+ _scrollableLabel.AddLine("Free space on storage card: {0:0.0} megabytes",
+ MeasurementUtils.ConvertBytesToMegabyte(freeSpaceInBytes));
+ }
+ else
+ {
+ _scrollableLabel.AddLine("No storage card was found");
+ }
+ _scrollableLabel.AddLine("Took {0}", stopWatch.Elapsed);
+ }
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.resx
===================================================================
--- Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.resx (rev 0)
+++ Trunk/Source/Roam.Test/Utils/StorageCardUtilsTest.resx 2007-09-17 03:33:41 UTC (rev 95)
@@ -0,0 +1,129 @@
+<?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>
+ <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
+ <value>Smartphone QVGA</value>
+ </metadata>
+ <metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+</root>
\ No newline at end of file
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-09-15 07:41:20
|
Revision: 94
http://roam.svn.sourceforge.net/roam/?rev=94&view=rev
Author: jonfroehlich
Date: 2007-09-15 00:41:18 -0700 (Sat, 15 Sep 2007)
Log Message:
-----------
added filtering to Hook
updated WindowsMessagingUtils and WindowsConstants to provide more functionality for HotKeys
Modified Paths:
--------------
Trunk/Source/Roam/Utils/WindowsConstants.cs
Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs
Trunk/Source/Roam.Test/Utils/HookTest.cs
Trunk/Source/Roam.UI/Utils/Hook.cs
Trunk/Source/Roam.UI/Utils/WindowsMessagingUtils.cs
Modified: Trunk/Source/Roam/Utils/WindowsConstants.cs
===================================================================
--- Trunk/Source/Roam/Utils/WindowsConstants.cs 2007-09-13 08:31:36 UTC (rev 93)
+++ Trunk/Source/Roam/Utils/WindowsConstants.cs 2007-09-15 07:41:18 UTC (rev 94)
@@ -181,5 +181,6 @@
public static int MOD_SHIFT = 0x0004;
public static int MOD_WIN = 0x0008;
public static int MOD_KEYUP = 0x1000;
+ public static int MOD_KEYDOWN = 0x0000;
}
}
Modified: Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs 2007-09-13 08:31:36 UTC (rev 93)
+++ Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs 2007-09-15 07:41:18 UTC (rev 94)
@@ -30,10 +30,14 @@
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
- this.scrollableLabel1 = new Roam.UI.Controls.ScrollableLabel();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
+ this.menuItem4 = new System.Windows.Forms.MenuItem();
+ this.textBox2 = new Roam.UI.Controls.TextBox();
+ this.textBox1 = new Roam.UI.Controls.TextBox();
+ this.scrollableLabel1 = new Roam.UI.Controls.ScrollableLabel();
+ this._menuItemFilterAllExceptBackKey = new System.Windows.Forms.MenuItem();
this.SuspendLayout();
//
// mainMenu1
@@ -41,16 +45,6 @@
this.mainMenu1.MenuItems.Add(this.menuItem1);
this.mainMenu1.MenuItems.Add(this.menuItem2);
//
- // scrollableLabel1
- //
- this.scrollableLabel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.scrollableLabel1.Font = new System.Drawing.Font("Segoe Condensed", 7F, System.Drawing.FontStyle.Regular);
- this.scrollableLabel1.Location = new System.Drawing.Point(0, 0);
- this.scrollableLabel1.Name = "scrollableLabel1";
- this.scrollableLabel1.Size = new System.Drawing.Size(240, 266);
- this.scrollableLabel1.TabIndex = 1;
- this.scrollableLabel1.Text = "scrollableLabel1";
- //
// menuItem1
//
this.menuItem1.Text = "Exit";
@@ -59,6 +53,8 @@
// menuItem2
//
this.menuItem2.MenuItems.Add(this.menuItem3);
+ this.menuItem2.MenuItems.Add(this.menuItem4);
+ this.menuItem2.MenuItems.Add(this._menuItemFilterAllExceptBackKey);
this.menuItem2.Text = "Menu";
//
// menuItem3
@@ -66,12 +62,49 @@
this.menuItem3.Text = "Clear";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
+ // menuItem4
+ //
+ this.menuItem4.Text = "Capture for 10 Seconds";
+ this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
+ //
+ // textBox2
+ //
+ this.textBox2.Location = new System.Drawing.Point(3, 39);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.Size = new System.Drawing.Size(234, 30);
+ this.textBox2.TabIndex = 6;
+ this.textBox2.Text = "textBox2";
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(3, 3);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(234, 30);
+ this.textBox1.TabIndex = 5;
+ this.textBox1.Text = "textBox1";
+ //
+ // scrollableLabel1
+ //
+ this.scrollableLabel1.Font = new System.Drawing.Font("Segoe Condensed", 7F, System.Drawing.FontStyle.Regular);
+ this.scrollableLabel1.Location = new System.Drawing.Point(0, 122);
+ this.scrollableLabel1.Name = "scrollableLabel1";
+ this.scrollableLabel1.Size = new System.Drawing.Size(240, 144);
+ this.scrollableLabel1.TabIndex = 4;
+ this.scrollableLabel1.Text = "scrollableLabel1";
+ //
+ // _menuItemFilterAllExceptBackKey
+ //
+ this._menuItemFilterAllExceptBackKey.Text = "Filter All Except BackKey";
+ this._menuItemFilterAllExceptBackKey.Click += new System.EventHandler(this.menuItem5_Click);
+ //
// HookTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(131F, 131F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(240, 266);
+ this.Controls.Add(this.textBox2);
+ this.Controls.Add(this.textBox1);
this.Controls.Add(this.scrollableLabel1);
this.Menu = this.mainMenu1;
this.Name = "HookTest";
@@ -86,5 +119,9 @@
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
+ private System.Windows.Forms.MenuItem menuItem4;
+ private Roam.UI.Controls.TextBox textBox1;
+ private Roam.UI.Controls.TextBox textBox2;
+ private System.Windows.Forms.MenuItem _menuItemFilterAllExceptBackKey;
}
}
\ No newline at end of file
Modified: Trunk/Source/Roam.Test/Utils/HookTest.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/HookTest.cs 2007-09-13 08:31:36 UTC (rev 93)
+++ Trunk/Source/Roam.Test/Utils/HookTest.cs 2007-09-15 07:41:18 UTC (rev 94)
@@ -6,12 +6,15 @@
using System.Text;
using System.Windows.Forms;
using Roam.UI.Utils;
+using Microsoft.WindowsCE.Forms;
namespace Roam.Test.Utils
{
public partial class HookTest : Form
{
private Hook _hook = new Hook();
+ private EscapeKeyFilter _escapeKeyFilter = new EscapeKeyFilter();
+
public HookTest()
{
InitializeComponent();
@@ -20,10 +23,26 @@
private void _hook_WndProcEvent(object sender, WndProcEventArgs e)
{
- e.Handled = true;
- scrollableLabel1.AddLine(
- string.Format("AttachedHwnd={0} OldWndProc={1} HWnd={2} Msg={3} WParam={4} LParam={5}",
- e.AttachedHwnd, e.OldWndProc, e.HWnd, e.Msg, e.WParam, e.LParam));
+ e.Handled = _captureAllEvents;
+
+ Message m = e.Message;
+ bool isHotKey = WindowsMessagingUtils.IsHotKeyMessage(m);
+ bool isInput = WindowsMessagingUtils.IsInputMessage(m);
+ bool isHotKeyUp = WindowsMessagingUtils.IsHotKeyUp(m);
+ bool isHotKeyDown = WindowsMessagingUtils.IsHotKeyDown(m);
+ Keys extractedKey = WindowsMessagingUtils.ExtractKey(m);
+
+ if (isHotKey)
+ {
+ scrollableLabel1.AddLine("HotKey message detected. ExtractedKey={0} HWnd={1} Msg={2} WParam={3} LParam={4}",
+ extractedKey, e.HWnd, e.Msg, e.WParam, e.LParam);
+ }
+ else
+ {
+ scrollableLabel1.AddLine(
+ string.Format("AttachedHwnd={0} OldWndProc={1} HWnd={2} Msg={3} WParam={4} LParam={5}",
+ e.AttachedHwnd, e.OldWndProc, e.HWnd, e.Msg, e.WParam, e.LParam));
+ }
}
protected override void OnHandleCreated(EventArgs e)
@@ -41,5 +60,44 @@
{
scrollableLabel1.Clear();
}
+
+ private Timer _timer;
+ private void menuItem4_Click(object sender, EventArgs e)
+ {
+ if (_timer != null)
+ {
+ _timer.Dispose();
+ _timer = null;
+ }
+
+ scrollableLabel1.AddLine("Now capturing WndProc events for next 10 secs");
+ _captureAllEvents = true;
+ _timer = new Timer();
+ _timer.Tick += new EventHandler(_timer_Tick);
+ _timer.Interval = 10000;
+ _timer.Enabled = true;
+ }
+
+ private bool _captureAllEvents = false;
+ void _timer_Tick(object sender, EventArgs e)
+ {
+ _timer.Enabled = false;
+ _captureAllEvents = false;
+ scrollableLabel1.AddLine("Finished capturing WndProc events");
+ }
+
+ private void menuItem5_Click(object sender, EventArgs e)
+ {
+ _menuItemFilterAllExceptBackKey.Checked = !_menuItemFilterAllExceptBackKey.Checked;
+
+ if (_menuItemFilterAllExceptBackKey.Checked)
+ {
+ _hook.MessageFilter = _escapeKeyFilter;
+ }
+ else
+ {
+ _hook.MessageFilter = null;
+ }
+ }
}
}
\ No newline at end of file
Modified: Trunk/Source/Roam.UI/Utils/Hook.cs
===================================================================
--- Trunk/Source/Roam.UI/Utils/Hook.cs 2007-09-13 08:31:36 UTC (rev 93)
+++ Trunk/Source/Roam.UI/Utils/Hook.cs 2007-09-15 07:41:18 UTC (rev 94)
@@ -8,6 +8,8 @@
using System.Windows.Forms;
using System.ComponentModel;
using System.Runtime.InteropServices;
+using Microsoft.WindowsCE.Forms;
+using Roam.Common.Utils;
namespace Roam.UI.Utils
{
@@ -21,9 +23,11 @@
public class Hook
{
#region Fields
+ private const int GWL_WNDPROC = -4;
private IntPtr _oldWndProc;
private IntPtr _hwnd;
private WndProcDelegate _newWndProc;
+ private IFilter<Message> _messageFilter;
public event EventHandler<WndProcEventArgs> WndProcEvent;
#endregion Fields
@@ -32,8 +36,23 @@
{
_newWndProc = new WndProcDelegate(WndProc);
}
+
+ public Hook(IFilter<Message> messageFilter)
+ : this()
+ {
+ _messageFilter = messageFilter;
+ }
+
#endregion Constructors
+ #region Properties
+ public IFilter<Message> MessageFilter
+ {
+ get { return _messageFilter; }
+ set { _messageFilter = value; }
+ }
+ #endregion Properties
+
#region Methods
public void Attach(Control c)
{
@@ -42,6 +61,10 @@
public void Attach(IntPtr hwnd)
{
+ if (_hwnd != IntPtr.Zero)
+ {
+ Detach();
+ }
_hwnd = hwnd;
_oldWndProc = WindowUtils.GetWindowLong(hwnd, GWL_WNDPROC);
if (_oldWndProc == IntPtr.Zero) throw new Win32Exception();
@@ -52,29 +75,55 @@
public void Detach()
{
int r = WindowUtils.SetWindowLong(_hwnd, GWL_WNDPROC, _oldWndProc);
+ _hwnd = IntPtr.Zero;
if (r == 0) throw new Win32Exception();
}
protected virtual int WndProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam)
{
- WndProcEventArgs wndProcEventArgs = new WndProcEventArgs(_hwnd, _oldWndProc, hWnd, msg, wparam, lparam);
- if (WndProcEvent != null)
+ Message message = Message.Create(hWnd, (int)msg, wparam, lparam);
+
+ if(_messageFilter == null || !_messageFilter.Filter(message))
{
- WndProcEvent(this, wndProcEventArgs);
+ WndProcEventArgs wndProcEventArgs = new WndProcEventArgs(_hwnd, _oldWndProc, message);
+ if (WndProcEvent != null)
+ {
+ WndProcEvent(this, wndProcEventArgs);
+ }
+
+ if (wndProcEventArgs.Handled == false)
+ {
+ return WindowUtils.CallWindowProc(_oldWndProc, hWnd, msg, wparam, lparam);
+ }
+ else
+ {
+ return 0;
+ }
}
- if (wndProcEventArgs.Handled == false)
+ return WindowUtils.CallWindowProc(_oldWndProc, hWnd, msg, wparam, lparam);
+ }
+ #endregion Methods
+ }
+
+ public class EscapeKeyFilter : IFilter<Message>
+ {
+ #region IFilter<Message> Members
+ /// <summary>
+ /// Filter the message if it's not a HotKey Keys.Back message
+ /// </summary>
+ /// <param name="message"></param>
+ /// <returns></returns>
+ public bool Filter(Message message)
+ {
+ if (WindowsMessagingUtils.IsHotKeyMessage(message))
{
- return WindowUtils.CallWindowProc(_oldWndProc, hWnd, msg, wparam, lparam);
+ Keys key = WindowsMessagingUtils.ExtractKey(message);
+ return key != Keys.Escape;
}
- else
- {
- return 0;
- }
+ return true;
}
- #endregion Methods
-
- const int GWL_WNDPROC = -4;
+ #endregion
}
public class WndProcEventArgs : EventArgs
@@ -82,29 +131,29 @@
#region Fields
private IntPtr _attachedHWnd;
private IntPtr _oldWndProc;
- private IntPtr _hWnd;
- private uint _msg;
- private IntPtr _wparam;
- private IntPtr _lparam;
+ private Message _message;
private bool _handled = false;
#endregion Fields
- public WndProcEventArgs(IntPtr attachedHwnd, IntPtr oldWndProc, IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
+ public WndProcEventArgs(IntPtr attachedHwnd, IntPtr oldWndProc, Message message)
{
_attachedHWnd = attachedHwnd;
_oldWndProc = oldWndProc;
- _hWnd = hWnd;
- _msg = msg;
- _wparam = wParam;
- _lparam = lParam;
+ _message = message;
}
+ public WndProcEventArgs(IntPtr attachedHwnd, IntPtr oldWndProc, IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
+ : this(attachedHwnd, oldWndProc, Message.Create(hWnd, (int)msg, wParam, lParam))
+ {
+ }
+
public IntPtr AttachedHwnd { get { return _attachedHWnd; } }
public IntPtr OldWndProc { get { return _oldWndProc; } }
- public IntPtr HWnd { get { return _hWnd; } }
- public uint Msg { get { return _msg; } }
- public IntPtr WParam { get { return _wparam; } }
- public IntPtr LParam { get { return _lparam; } }
+ public IntPtr HWnd { get { return _message.HWnd; } }
+ public int Msg { get { return _message.Msg; } }
+ public IntPtr WParam { get { return _message.WParam; } }
+ public IntPtr LParam { get { return _message.LParam; } }
+ public Message Message { get { return _message; } }
public bool Handled { get { return _handled; } set { _handled = value; } }
}
Modified: Trunk/Source/Roam.UI/Utils/WindowsMessagingUtils.cs
===================================================================
--- Trunk/Source/Roam.UI/Utils/WindowsMessagingUtils.cs 2007-09-13 08:31:36 UTC (rev 93)
+++ Trunk/Source/Roam.UI/Utils/WindowsMessagingUtils.cs 2007-09-15 07:41:18 UTC (rev 94)
@@ -17,6 +17,7 @@
using System.Text;
using Microsoft.WindowsCE.Forms;
using Roam.Utils;
+using System.Windows.Forms;
namespace Roam.UI.Utils
{
@@ -38,16 +39,50 @@
m.Msg == WindowsConstants.WM_HOTKEY);
}
+ public static bool IsKeyMessage(Message m)
+ {
+ return (m.Msg == WindowsConstants.WM_KEYDOWN ||
+ m.Msg == WindowsConstants.WM_KEYUP ||
+ m.Msg == WindowsConstants.WM_HOTKEY);
+ }
+
+ public static bool IsHotKeyMessage(Message m)
+ {
+ return m.Msg == WindowsConstants.WM_HOTKEY;
+ }
+
public static bool IsHotKeyUp(Message m)
{
if (m.Msg != WindowsConstants.WM_HOTKEY)
{
- throw new ArgumentException(String.Format("Message m ({0}) must be a WM_HOTKEY message",m.Msg));
+ return false;
}
int lparam = m.LParam.ToInt32();
int mod = lparam & 0x0000FFFF;
return (WindowsConstants.MOD_KEYUP & mod) == WindowsConstants.MOD_KEYUP;
}
+
+ public static bool IsHotKeyDown(Message m)
+ {
+ if (m.Msg != WindowsConstants.WM_HOTKEY)
+ {
+ return false;
+ }
+
+ int lparam = m.LParam.ToInt32();
+ int mod = lparam & 0x0000FFFF;
+ return mod == WindowsConstants.MOD_KEYDOWN;
+ }
+
+ public static Keys ExtractKey(Message m)
+ {
+ if (!IsKeyMessage(m)) { return Keys.None; }
+
+ int lparam = m.LParam.ToInt32();
+ int mod = (int)(lparam & 0xFFFF0000);
+ int key = mod >> 16;
+ return (Keys)key;
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-09-13 08:31:38
|
Revision: 93
http://roam.svn.sourceforge.net/roam/?rev=93&view=rev
Author: jonfroehlich
Date: 2007-09-13 01:31:36 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
1. changed WindowUtils to Roam.UI.Utils
2. Added Hook capabilities and added HookTest capabilities
Modified Paths:
--------------
Trunk/Source/Roam.Common/Roam.Common.csproj
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.Test/Sandbox/EnumWindowsTest.cs
Trunk/Source/Roam.Test/UI/Controls/IImageButtonTest.cs
Trunk/Source/Roam.UI/Roam.UI.csproj
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs
Trunk/Source/Roam.Test/Utils/HookTest.cs
Trunk/Source/Roam.Test/Utils/HookTest.resx
Trunk/Source/Roam.UI/Utils/Hook.cs
Trunk/Source/Roam.UI/Utils/WindowUtils.cs
Removed Paths:
-------------
Trunk/Source/Roam.Common/Utils/WindowUtils.cs
Modified: Trunk/Source/Roam.Common/Roam.Common.csproj
===================================================================
--- Trunk/Source/Roam.Common/Roam.Common.csproj 2007-09-08 11:38:57 UTC (rev 92)
+++ Trunk/Source/Roam.Common/Roam.Common.csproj 2007-09-13 08:31:36 UTC (rev 93)
@@ -100,7 +100,6 @@
<Compile Include="Utils\TimeResolution.cs" />
<Compile Include="Utils\TimeUtils.cs" />
<Compile Include="Utils\TypeUtils.cs" />
- <Compile Include="Utils\WindowUtils.cs" />
<Compile Include="Utils\XmlUtils.cs" />
</ItemGroup>
<Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
Deleted: Trunk/Source/Roam.Common/Utils/WindowUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/WindowUtils.cs 2007-09-08 11:38:57 UTC (rev 92)
+++ Trunk/Source/Roam.Common/Utils/WindowUtils.cs 2007-09-13 08:31:36 UTC (rev 93)
@@ -1,321 +0,0 @@
-#region Copyright & License
-//
-// Copyright (c) 2005 - 2007 The Regents of the University of Washington, Intel
-// Research Seattle, and the Roam project. All rights reserved.
-//
-// This software is open-source under the BSD license. You may obtain a copy
-// of this license at
-//
-// http://roam.sourceforge.net/license.txt
-//
-// Alternatively, please see "license.txt" which should be included in
-// this source code distribution.
-//
-#endregion Copyright & License
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace Roam.Common.Utils
-{
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- public static class WindowUtils
- {
- public delegate int EnumWindowsProc(IntPtr hwnd, IntPtr lParam);
-
- /// <summary>
- /// The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window,
- /// in turn, to an application-defined callback function. EnumWindows continues until the last top-level window
- /// is enumerated or the callback function returns FALSE.
- /// </summary>
- /// <param name="enumWindowsProc">[in] Pointer to an application-defined callback function. For more information, see EnumWindowsProc. </param>
- /// <param name="lParam">[in] Specifies an application-defined value to be passed to the callback function. </param>
- /// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
- /// To get extended error information, call GetLastError. If EnumWindowsProc returns zero, the return value is also zero.
- /// In this case, the callback function should call SetLastError to obtain a meaningful error code to be returned to the
- /// caller of EnumWindows.
- /// </returns>
- /// <remarks>
- /// The EnumWindows function does not enumerate child windows, with the exception of a few top-level windows owned
- /// by the system that have the WS_CHILD style. This function is more reliable than calling the GetWindow function
- /// in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or
- /// referencing a handle to a window that has been destroyed.
- /// </remarks>
- [DllImport("coredll.dll", SetLastError = true)]
- private static extern int EnumWindows(IntPtr lpEnumFunc, uint lParam);
-
- public static int EnumWindows(EnumWindowsProc enumWindowsProc, uint lParam)
- {
- IntPtr callbackDelegatePointer = Marshal.GetFunctionPointerForDelegate(enumWindowsProc);
- return EnumWindows(callbackDelegatePointer, lParam);
- }
-
- public static int EnumWindows(EnumWindowsProc enumWindowsProc)
- {
- return EnumWindows(enumWindowsProc, 0);
- }
-
- /// <summary>
- /// The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates
- /// the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system
- /// assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.
- /// </summary>
- /// <param name="hWnd">[in] Handle to the window that should be activated and brought to the foreground. </param>
- /// <returns>If the window was brought to the foreground, the return value is nonzero. If the window was not brought to the foreground,
- /// the return value is zero.
- /// </returns>
- /// <remarks>
- /// The foreground window is the window at the top of the Z-Order. It is the window that the user is working with. In a preemptive
- /// multitasking environment, you should generally let the user control which window is the foreground window.
- /// </remarks>
- [DllImport("coredll.dll", SetLastError = true)]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
-
- /// <summary>
- /// Returns true if the given control contains the handle
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="control"></param>
- /// <returns></returns>
- public static bool ContainsHandle(IntPtr handle, Control control)
- {
- if (control.Handle == handle) { return true; }
- else { return ContainsHandle(handle, control.Controls); }
- }
-
- /// <summary>
- /// Returns true if the control collection contains the given handle
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="controls"></param>
- /// <returns></returns>
- public static bool ContainsHandle(IntPtr handle, Control.ControlCollection controls)
- {
- foreach (Control control in controls)
- {
- if (control.Handle == handle) { return true; }
- if (ContainsHandle(handle, control.Controls)) { return true; }
- }
-
- return false;
- }
-
- /// <summary>
- /// Returns the Control whose hWnd matches the provided handle and is
- /// within the provided container
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="container"></param>
- /// <returns></returns>
- public static Control FindWindow(IntPtr handle, Control container)
- {
- if (handle == container.Handle) { return container; }
- else { return FindWindow(handle, container.Controls); }
- }
-
- /// <summary>
- /// Returns the Control corresponding to the handle in the provided
- /// control collection
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="controls"></param>
- /// <returns></returns>
- public static Control FindWindow(IntPtr handle, Control.ControlCollection controls)
- {
- foreach (Control control in controls)
- {
- if (control.Handle == handle) { return control; }
-
- Control c = FindWindow(handle, control.Controls);
- if (c != null) { return c; }
- }
-
- return null;
- }
-
- /// <summary>
- /// This function retrieves the handle to the top-level window whose class name and window name match the specified strings.
- /// This function does not search child windows.
- /// </summary>
- /// <param name="lpClassName">Long pointer to a null-terminated string that specifies the class name or is an atom that
- /// identifies the class-name string. If this parameter is an atom, it must be a global atom
- /// created by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be
- /// placed in the low-order word of lpClassName; the high-order word must be zero. </param>
- /// <param name="lpWindowName">Long pointer to a null-terminated string that specifies the window name (the window's title).
- /// If this parameter is NULL, all window names match. </param>
- /// <returns>A handle to the window that has the specified class name and window name indicates success. NULL indicates failure.
- /// To get extended error information, call GetLastError. </returns>
- /// <remarks>
- /// If lpClassName is an atom, it must be an atom returned from RegisterClass.
- /// </remarks>
- [DllImport("coredll.dll", SetLastError = true)]
- public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
-
- /// <summary>
- /// This function retrieves the handle to the top-level window whose window name match the specified strings.
- /// This function does not search child windows.
- /// </summary>
- /// <param name="windowTitle"></param>
- /// <returns></returns>
- public static IntPtr FindWindow(string windowTitle)
- {
- return FindWindow(null, windowTitle);
- }
-
- /// <summary>
- /// This function destroys the specified window. The function sends a WM_DESTROY message to the window to
- /// deactivate it and removes the keyboard focus from it. The function also destroys the window's menu,
- /// destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window
- /// is at the top of the viewer chain).
- ///
- /// If the specified window is a parent or owner window, DestroyWindow automatically destroys the associated
- /// child or owned windows when it destroys the parent or owner window. The function first destroys child or
- /// owned windows, and then it destroys the parent or owner window.
- ///
- /// DestroyWindow also destroys modeless dialog boxes created by the CreateDialog function.
- /// </summary>
- /// <param name="hWnd">[in] Handle to the window to be destroyed. </param>
- /// <returns>true if the window is destroyed, false otherwise</returns>
- public static extern bool DestroyWindow(IntPtr hWnd);
-
- /// <summary>
- /// This function returns a handle to the desktop window. The desktop window covers the entire screen. The desktop window is
- /// the area on top of which all icons and other windows are painted.
- /// </summary>
- /// <returns>The return value is a handle to the desktop window.</returns>
- [DllImport("coredll.dll", SetLastError = true)]
- public static extern IntPtr GetDesktopWindow();
-
- public static void PrintWindowHandles(Control control)
- {
- Debug.WriteLine(String.Format("Name: {0} Type: {1} Handle: {2}", control.Name, control.GetType().FullName, control.Handle));
- PrintWindowHandles(control.Controls);
- }
-
- public static void PrintWindowHandles(Control.ControlCollection controls)
- {
- foreach (Control control in controls)
- {
- Debug.WriteLine(String.Format("Name: {0} Type: {1} Handle: {2}", control.Name, control.GetType().FullName, control.Handle));
- PrintWindowHandles(control.Controls);
- }
- }
-
- public static void FindAndPrintFocusedControl(Control control)
- {
- Control controlFocused = FindFocusedControl(control);
- if (controlFocused == null)
- {
- Debug.WriteLine(
- String.Format("Could not find any focused controls in Name: {0} Type: {1} Handle: {2} or any of its children",
- control.Name, control.GetType().FullName, control.Handle));
- }
- else
- {
- Debug.WriteLine(
- String.Format("Focused control: Name: {0} Type: {1} Handle: {2}",
- controlFocused.Name, controlFocused.GetType().FullName, controlFocused.Handle));
- }
- }
-
- public static Control FindFocusedControl(Control control)
- {
- if (control.Focused) { return control; }
- else { return FindFocusedControl(control.Controls); }
- }
-
- public static Control FindFocusedControl(Control.ControlCollection controls)
- {
- foreach (Control control in controls)
- {
- if (control.Focused) { return control; }
-
- Control c = FindFocusedControl(control.Controls);
- if (c != null) { return c; }
- }
- return null;
- }
-
- /// <summary>
- /// The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working).
- /// The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.
- /// </summary>
- /// <returns>The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances,
- /// such as when a window is losing activation. </returns>
- [DllImport("coredll.dll", SetLastError = true)]
- public static extern IntPtr GetForegroundWindow();
-
- /// <summary>
- /// The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer.
- /// If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve
- /// the text of a control in another application.
- /// </summary>
- /// <param name="hWnd">[in] Handle to the window or control containing the text.</param>
- /// <param name="lpString">[out] Pointer to the buffer that will receive the text. If the string is as long or longer than the buffer,
- /// the string is truncated and terminated with a NULL character. </param>
- /// <param name="nMaxCount">[in] Specifies the maximum number of characters to copy to the buffer, including the NULL character.
- /// If the text exceeds this limit, it is truncated. </param>
- /// <returns>If the function succeeds, the return value is the length, in characters, of the copied string, not including
- /// the terminating NULL character. If the window has no title bar or text, if the title bar is empty, or if the window
- /// or control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
- /// This function cannot retrieve the text of an edit control in another application.
- /// </returns>
- [DllImport("coredll.dll", SetLastError = true)]
- private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
-
- public static string GetWindowText(IntPtr hWnd)
- {
- return GetWindowText(hWnd, 1000);
- }
-
- public static string GetWindowText(IntPtr hWnd, int nMaxCount)
- {
- StringBuilder sb = new StringBuilder(nMaxCount);
- GetWindowText(hWnd, sb, sb.Capacity);
- return sb.ToString();
- }
-
- /// <summary>
- /// The GetWindow function retrieves a handle to a window that has the specified relationship (Z-Order or owner) to the specified window.
- /// </summary>
- /// <param name="hWnd">[in] Handle to a window. The window handle retrieved is relative to this window, based on the value of the uCmd parameter. </param>
- /// <param name="uCmd"></param>
- /// <returns></returns>
- [DllImport("coredll.dll")]
- public static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
-
- public static IntPtr GetChildWindow(IntPtr hWnd)
- {
- return GetWindow(hWnd, GetWindowConstants.GW_CHILD);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- /// <author>Jon Froehlich</author>
- public static class GetWindowConstants
- {
- // Flags for GetWindow() api
- // found in winuser.h
- public static uint GW_HWNDFIRST = 0;
- public static uint GW_HWNDLAST = 1;
- public static uint GW_HWNDNEXT = 2;
- public static uint GW_HWNDPREV = 3;
- public static uint GW_OWNER = 4;
- public static uint GW_CHILD = 5;
- public static uint GW_MAX = 5;
- }
-}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-09-08 11:38:57 UTC (rev 92)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-09-13 08:31:36 UTC (rev 93)
@@ -338,6 +338,10 @@
<SubType>Designer</SubType>
<DependentUpon>WallpaperTest.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Utils\HookTest.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>HookTest.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Utils\IdleTimeForm.resx">
<SubType>Designer</SubType>
<DependentUpon>IdleTimeForm.cs</DependentUpon>
@@ -537,7 +541,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
@@ -675,7 +679,7 @@
<DependentUpon>SystemColorTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\TabControlTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\TabControlTest.Designer.cs">
<DependentUpon>TabControlTest.cs</DependentUpon>
@@ -716,6 +720,12 @@
<Compile Include="UI\Controls\WallpaperTest.Designer.cs">
<DependentUpon>WallpaperTest.cs</DependentUpon>
</Compile>
+ <Compile Include="Utils\HookTest.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Utils\HookTest.Designer.cs">
+ <DependentUpon>HookTest.cs</DependentUpon>
+ </Compile>
<Compile Include="Utils\IdleTimeForm.cs">
<SubType>Form</SubType>
</Compile>
Modified: Trunk/Source/Roam.Test/Sandbox/EnumWindowsTest.cs
===================================================================
--- Trunk/Source/Roam.Test/Sandbox/EnumWindowsTest.cs 2007-09-08 11:38:57 UTC (rev 92)
+++ Trunk/Source/Roam.Test/Sandbox/EnumWindowsTest.cs 2007-09-13 08:31:36 UTC (rev 93)
@@ -7,6 +7,7 @@
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Roam.Common.Utils;
+using Roam.UI.Utils;
namespace Roam.Test.Sandbox
{
Modified: Trunk/Source/Roam.Test/UI/Controls/IImageButtonTest.cs
===================================================================
--- Trunk/Source/Roam.Test/UI/Controls/IImageButtonTest.cs 2007-09-08 11:38:57 UTC (rev 92)
+++ Trunk/Source/Roam.Test/UI/Controls/IImageButtonTest.cs 2007-09-13 08:31:36 UTC (rev 93)
@@ -26,6 +26,7 @@
using OpenNETCF.Drawing.Imaging;
using Roam.UI.Drawing;
using Roam.Common.Utils;
+using Roam.UI.Utils;
namespace MyExperience.Test
{
Added: Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs (rev 0)
+++ Trunk/Source/Roam.Test/Utils/HookTest.Designer.cs 2007-09-13 08:31:36 UTC (rev 93)
@@ -0,0 +1,90 @@
+namespace Roam.Test.Utils
+{
+ partial class HookTest
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+ private System.Windows.Forms.MainMenu mainMenu1;
+
+ /// <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.mainMenu1 = new System.Windows.Forms.MainMenu();
+ this.scrollableLabel1 = new Roam.UI.Controls.ScrollableLabel();
+ this.menuItem1 = new System.Windows.Forms.MenuItem();
+ this.menuItem2 = new System.Windows.Forms.MenuItem();
+ this.menuItem3 = new System.Windows.Forms.MenuItem();
+ this.SuspendLayout();
+ //
+ // mainMenu1
+ //
+ this.mainMenu1.MenuItems.Add(this.menuItem1);
+ this.mainMenu1.MenuItems.Add(this.menuItem2);
+ //
+ // scrollableLabel1
+ //
+ this.scrollableLabel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.scrollableLabel1.Font = new System.Drawing.Font("Segoe Condensed", 7F, System.Drawing.FontStyle.Regular);
+ this.scrollableLabel1.Location = new System.Drawing.Point(0, 0);
+ this.scrollableLabel1.Name = "scrollableLabel1";
+ this.scrollableLabel1.Size = new System.Drawing.Size(240, 266);
+ this.scrollableLabel1.TabIndex = 1;
+ this.scrollableLabel1.Text = "scrollableLabel1";
+ //
+ // menuItem1
+ //
+ this.menuItem1.Text = "Exit";
+ this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
+ //
+ // menuItem2
+ //
+ this.menuItem2.MenuItems.Add(this.menuItem3);
+ this.menuItem2.Text = "Menu";
+ //
+ // menuItem3
+ //
+ this.menuItem3.Text = "Clear";
+ this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
+ //
+ // HookTest
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(131F, 131F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.AutoScroll = true;
+ this.ClientSize = new System.Drawing.Size(240, 266);
+ this.Controls.Add(this.scrollableLabel1);
+ this.Menu = this.mainMenu1;
+ this.Name = "HookTest";
+ this.Text = "HookTest";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Roam.UI.Controls.ScrollableLabel scrollableLabel1;
+ private System.Windows.Forms.MenuItem menuItem1;
+ private System.Windows.Forms.MenuItem menuItem2;
+ private System.Windows.Forms.MenuItem menuItem3;
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Utils/HookTest.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/HookTest.cs (rev 0)
+++ Trunk/Source/Roam.Test/Utils/HookTest.cs 2007-09-13 08:31:36 UTC (rev 93)
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Roam.UI.Utils;
+
+namespace Roam.Test.Utils
+{
+ public partial class HookTest : Form
+ {
+ private Hook _hook = new Hook();
+ public HookTest()
+ {
+ InitializeComponent();
+ _hook.WndProcEvent += new EventHandler<WndProcEventArgs>(_hook_WndProcEvent);
+ }
+
+ private void _hook_WndProcEvent(object sender, WndProcEventArgs e)
+ {
+ e.Handled = true;
+ scrollableLabel1.AddLine(
+ string.Format("AttachedHwnd={0} OldWndProc={1} HWnd={2} Msg={3} WParam={4} LParam={5}",
+ e.AttachedHwnd, e.OldWndProc, e.HWnd, e.Msg, e.WParam, e.LParam));
+ }
+
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ _hook.Attach(this);
+ base.OnHandleCreated(e);
+ }
+
+ private void menuItem1_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void menuItem3_Click(object sender, EventArgs e)
+ {
+ scrollableLabel1.Clear();
+ }
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Utils/HookTest.resx
===================================================================
--- Trunk/Source/Roam.Test/Utils/HookTest.resx (rev 0)
+++ Trunk/Source/Roam.Test/Utils/HookTest.resx 2007-09-13 08:31:36 UTC (rev 93)
@@ -0,0 +1,129 @@
+<?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>
+ <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
+ <value>Smartphone QVGA</value>
+ </metadata>
+ <metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+</root>
\ No newline at end of file
Modified: Trunk/Source/Roam.UI/Roam.UI.csproj
===================================================================
--- Trunk/Source/Roam.UI/Roam.UI.csproj 2007-09-08 11:38:57 UTC (rev 92)
+++ Trunk/Source/Roam.UI/Roam.UI.csproj 2007-09-13 08:31:36 UTC (rev 93)
@@ -234,11 +234,13 @@
<Compile Include="Forms\FormFactory.cs">
<SubType>Form</SubType>
</Compile>
+ <Compile Include="Utils\Hook.cs" />
<Compile Include="Utils\HotKeyManager.cs" />
<Compile Include="Utils\KeySniffer.cs" />
<Compile Include="Utils\PowerNotificationUIThread.cs" />
<Compile Include="Utils\ScreenUtils.cs" />
<Compile Include="Utils\WindowsMessagingUtils.cs" />
+ <Compile Include="Utils\WindowUtils.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Controls\AudioRecorder.resx">
Added: Trunk/Source/Roam.UI/Utils/Hook.cs
===================================================================
--- Trunk/Source/Roam.UI/Utils/Hook.cs (rev 0)
+++ Trunk/Source/Roam.UI/Utils/Hook.cs 2007-09-13 08:31:36 UTC (rev 93)
@@ -0,0 +1,111 @@
+//
+// Author: Sergey Bogdanov <ser...@gm...>
+// Url: http://www.sergeybogdanov.com
+//
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace Roam.UI.Utils
+{
+ public delegate int WndProcDelegate(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
+
+ /// <summary>
+ /// This class is based on the WindowHook from Sergey Bogdanov found at:
+ /// http://www.sergeybogdanov.com/Samples/
+ /// Direct Link: http://www.sergeybogdanov.com/Samples/WindowHook.zip
+ /// </summary>
+ public class Hook
+ {
+ #region Fields
+ private IntPtr _oldWndProc;
+ private IntPtr _hwnd;
+ private WndProcDelegate _newWndProc;
+ public event EventHandler<WndProcEventArgs> WndProcEvent;
+ #endregion Fields
+
+ #region Constructors
+ public Hook()
+ {
+ _newWndProc = new WndProcDelegate(WndProc);
+ }
+ #endregion Constructors
+
+ #region Methods
+ public void Attach(Control c)
+ {
+ Attach(c.Handle);
+ }
+
+ public void Attach(IntPtr hwnd)
+ {
+ _hwnd = hwnd;
+ _oldWndProc = WindowUtils.GetWindowLong(hwnd, GWL_WNDPROC);
+ if (_oldWndProc == IntPtr.Zero) throw new Win32Exception();
+ int r = WindowUtils.SetWindowLong(hwnd, GWL_WNDPROC, _newWndProc);
+ if (r == 0) throw new Win32Exception();
+ }
+
+ public void Detach()
+ {
+ int r = WindowUtils.SetWindowLong(_hwnd, GWL_WNDPROC, _oldWndProc);
+ if (r == 0) throw new Win32Exception();
+ }
+
+ protected virtual int WndProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam)
+ {
+ WndProcEventArgs wndProcEventArgs = new WndProcEventArgs(_hwnd, _oldWndProc, hWnd, msg, wparam, lparam);
+ if (WndProcEvent != null)
+ {
+ WndProcEvent(this, wndProcEventArgs);
+ }
+
+ if (wndProcEventArgs.Handled == false)
+ {
+ return WindowUtils.CallWindowProc(_oldWndProc, hWnd, msg, wparam, lparam);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ #endregion Methods
+
+ const int GWL_WNDPROC = -4;
+ }
+
+ public class WndProcEventArgs : EventArgs
+ {
+ #region Fields
+ private IntPtr _attachedHWnd;
+ private IntPtr _oldWndProc;
+ private IntPtr _hWnd;
+ private uint _msg;
+ private IntPtr _wparam;
+ private IntPtr _lparam;
+ private bool _handled = false;
+ #endregion Fields
+
+ public WndProcEventArgs(IntPtr attachedHwnd, IntPtr oldWndProc, IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
+ {
+ _attachedHWnd = attachedHwnd;
+ _oldWndProc = oldWndProc;
+ _hWnd = hWnd;
+ _msg = msg;
+ _wparam = wParam;
+ _lparam = lParam;
+ }
+
+ public IntPtr AttachedHwnd { get { return _attachedHWnd; } }
+ public IntPtr OldWndProc { get { return _oldWndProc; } }
+ public IntPtr HWnd { get { return _hWnd; } }
+ public uint Msg { get { return _msg; } }
+ public IntPtr WParam { get { return _wparam; } }
+ public IntPtr LParam { get { return _lparam; } }
+
+ public bool Handled { get { return _handled; } set { _handled = value; } }
+ }
+}
Added: Trunk/Source/Roam.UI/Utils/WindowUtils.cs
===================================================================
--- Trunk/Source/Roam.UI/Utils/WindowUtils.cs (rev 0)
+++ Trunk/Source/Roam.UI/Utils/WindowUtils.cs 2007-09-13 08:31:36 UTC (rev 93)
@@ -0,0 +1,335 @@
+#region Copyright & License
+//
+// Copyright (c) 2005 - 2007 The Regents of the University of Washington, Intel
+// Research Seattle, and the Roam project. All rights reserved.
+//
+// This software is open-source under the BSD license. You may obtain a copy
+// of this license at
+//
+// http://roam.sourceforge.net/license.txt
+//
+// Alternatively, please see "license.txt" which should be included in
+// this source code distribution.
+//
+#endregion Copyright & License
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace Roam.UI.Utils
+{
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ public static class WindowUtils
+ {
+ public delegate int EnumWindowsProc(IntPtr hwnd, IntPtr lParam);
+
+ /// <summary>
+ /// The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window,
+ /// in turn, to an application-defined callback function. EnumWindows continues until the last top-level window
+ /// is enumerated or the callback function returns FALSE.
+ /// </summary>
+ /// <param name="enumWindowsProc">[in] Pointer to an application-defined callback function. For more information, see EnumWindowsProc. </param>
+ /// <param name="lParam">[in] Specifies an application-defined value to be passed to the callback function. </param>
+ /// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
+ /// To get extended error information, call GetLastError. If EnumWindowsProc returns zero, the return value is also zero.
+ /// In this case, the callback function should call SetLastError to obtain a meaningful error code to be returned to the
+ /// caller of EnumWindows.
+ /// </returns>
+ /// <remarks>
+ /// The EnumWindows function does not enumerate child windows, with the exception of a few top-level windows owned
+ /// by the system that have the WS_CHILD style. This function is more reliable than calling the GetWindow function
+ /// in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or
+ /// referencing a handle to a window that has been destroyed.
+ /// </remarks>
+ [DllImport("coredll.dll", SetLastError = true)]
+ private static extern int EnumWindows(IntPtr lpEnumFunc, uint lParam);
+
+ public static int EnumWindows(EnumWindowsProc enumWindowsProc, uint lParam)
+ {
+ IntPtr callbackDelegatePointer = Marshal.GetFunctionPointerForDelegate(enumWindowsProc);
+ return EnumWindows(callbackDelegatePointer, lParam);
+ }
+
+ public static int EnumWindows(EnumWindowsProc enumWindowsProc)
+ {
+ return EnumWindows(enumWindowsProc, 0);
+ }
+
+ /// <summary>
+ /// The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates
+ /// the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system
+ /// assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.
+ /// </summary>
+ /// <param name="hWnd">[in] Handle to the window that should be activated and brought to the foreground. </param>
+ /// <returns>If the window was brought to the foreground, the return value is nonzero. If the window was not brought to the foreground,
+ /// the return value is zero.
+ /// </returns>
+ /// <remarks>
+ /// The foreground window is the window at the top of the Z-Order. It is the window that the user is working with. In a preemptive
+ /// multitasking environment, you should generally let the user control which window is the foreground window.
+ /// </remarks>
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
+
+ /// <summary>
+ /// Returns true if the given control contains the handle
+ /// </summary>
+ /// <param name="handle"></param>
+ /// <param name="control"></param>
+ /// <returns></returns>
+ public static bool ContainsHandle(IntPtr handle, Control control)
+ {
+ if (control.Handle == handle) { return true; }
+ else { return ContainsHandle(handle, control.Controls); }
+ }
+
+ /// <summary>
+ /// Returns true if the control collection contains the given handle
+ /// </summary>
+ /// <param name="handle"></param>
+ /// <param name="controls"></param>
+ /// <returns></returns>
+ public static bool ContainsHandle(IntPtr handle, Control.ControlCollection controls)
+ {
+ foreach (Control control in controls)
+ {
+ if (control.Handle == handle) { return true; }
+ if (ContainsHandle(handle, control.Controls)) { return true; }
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Returns the Control whose hWnd matches the provided handle and is
+ /// within the provided container
+ /// </summary>
+ /// <param name="handle"></param>
+ /// <param name="container"></param>
+ /// <returns></returns>
+ public static Control FindWindow(IntPtr handle, Control container)
+ {
+ if (handle == container.Handle) { return container; }
+ else { return FindWindow(handle, container.Controls); }
+ }
+
+ /// <summary>
+ /// Returns the Control corresponding to the handle in the provided
+ /// control collection
+ /// </summary>
+ /// <param name="handle"></param>
+ /// <param name="controls"></param>
+ /// <returns></returns>
+ public static Control FindWindow(IntPtr handle, Control.ControlCollection controls)
+ {
+ foreach (Control control in controls)
+ {
+ if (control.Handle == handle) { return control; }
+
+ Control c = FindWindow(handle, control.Controls);
+ if (c != null) { return c; }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// This function retrieves the handle to the top-level window whose class name and window name match the specified strings.
+ /// This function does not search child windows.
+ /// </summary>
+ /// <param name="lpClassName">Long pointer to a null-terminated string that specifies the class name or is an atom that
+ /// identifies the class-name string. If this parameter is an atom, it must be a global atom
+ /// created by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be
+ /// placed in the low-order word of lpClassName; the high-order word must be zero. </param>
+ /// <param name="lpWindowName">Long pointer to a null-terminated string that specifies the window name (the window's title).
+ /// If this parameter is NULL, all window names match. </param>
+ /// <returns>A handle to the window that has the specified class name and window name indicates success. NULL indicates failure.
+ /// To get extended error information, call GetLastError. </returns>
+ /// <remarks>
+ /// If lpClassName is an atom, it must be an atom returned from RegisterClass.
+ /// </remarks>
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
+
+ /// <summary>
+ /// This function retrieves the handle to the top-level window whose window name match the specified strings.
+ /// This function does not search child windows.
+ /// </summary>
+ /// <param name="windowTitle"></param>
+ /// <returns></returns>
+ public static IntPtr FindWindow(string windowTitle)
+ {
+ return FindWindow(null, windowTitle);
+ }
+
+ /// <summary>
+ /// This function destroys the specified window. The function sends a WM_DESTROY message to the window to
+ /// deactivate it and removes the keyboard focus from it. The function also destroys the window's menu,
+ /// destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window
+ /// is at the top of the viewer chain).
+ ///
+ /// If the specified window is a parent or owner window, DestroyWindow automatically destroys the associated
+ /// child or owned windows when it destroys the parent or owner window. The function first destroys child or
+ /// owned windows, and then it destroys the parent or owner window.
+ ///
+ /// DestroyWindow also destroys modeless dialog boxes created by the CreateDialog function.
+ /// </summary>
+ /// <param name="hWnd">[in] Handle to the window to be destroyed.</param>
+ /// <returns>0 if the window is destroyed, otherwise non-zero</returns>
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern IntPtr DestroyWindow(IntPtr hWnd);
+
+ /// <summary>
+ /// This function returns a handle to the desktop window. The desktop window covers the entire screen. The desktop window is
+ /// the area on top of which all icons and other windows are painted.
+ /// </summary>
+ /// <returns>The return value is a handle to the desktop window.</returns>
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern IntPtr GetDesktopWindow();
+
+ public static void PrintWindowHandles(Control control)
+ {
+ Debug.WriteLine(String.Format("Name: {0} Type: {1} Handle: {2}", control.Name, control.GetType().FullName, control.Handle));
+ PrintWindowHandles(control.Controls);
+ }
+
+ public static void PrintWindowHandles(Control.ControlCollection controls)
+ {
+ foreach (Control control in controls)
+ {
+ Debug.WriteLine(String.Format("Name: {0} Type: {1} Handle: {2}", control.Name, control.GetType().FullName, control.Handle));
+ PrintWindowHandles(control.Controls);
+ }
+ }
+
+ public static void FindAndPrintFocusedControl(Control control)
+ {
+ Control controlFocused = FindFocusedControl(control);
+ if (controlFocused == null)
+ {
+ Debug.WriteLine(
+ String.Format("Could not find any focused controls in Name: {0} Type: {1} Handle: {2} or any of its children",
+ control.Name, control.GetType().FullName, control.Handle));
+ }
+ else
+ {
+ Debug.WriteLine(
+ String.Format("Focused control: Name: {0} Type: {1} Handle: {2}",
+ controlFocused.Name, controlFocused.GetType().FullName, controlFocused.Handle));
+ }
+ }
+
+ public static Control FindFocusedControl(Control control)
+ {
+ if (control.Focused) { return control; }
+ else { return FindFocusedControl(control.Controls); }
+ }
+
+ public static Control FindFocusedControl(Control.ControlCollection controls)
+ {
+ foreach (Control control in controls)
+ {
+ if (control.Focused) { return control; }
+
+ Control c = FindFocusedControl(control.Controls);
+ if (c != null) { return c; }
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working).
+ /// The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.
+ /// </summary>
+ /// <returns>The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances,
+ /// such as when a window is losing activation. </returns>
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern IntPtr GetForegroundWindow();
+
+ /// <summary>
+ /// The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer.
+ /// If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve
+ /// the text of a control in another application.
+ /// </summary>
+ /// <param name="hWnd">[in] Handle to the window or control containing the text.</param>
+ /// <param name="lpString">[out] Pointer to the buffer that will receive the text. If the string is as long or longer than the buffer,
+ /// the string is truncated and terminated with a NULL character. </param>
+ /// <param name="nMaxCount">[in] Specifies the maximum number of characters to copy to the buffer, including the NULL character.
+ /// If the text exceeds this limit, it is truncated. </param>
+ /// <returns>If the function succeeds, the return value is the length, in characters, of the copied string, not including
+ /// the terminating NULL character. If the window has no title bar or text, if the title bar is empty, or if the window
+ /// or control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
+ /// This function cannot retrieve the text of an edit control in another application.
+ /// </returns>
+ [DllImport("coredll.dll", SetLastError = true)]
+ private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
+
+ public static string GetWindowText(IntPtr hWnd)
+ {
+ return GetWindowText(hWnd, 1000);
+ }
+
+ public static string GetWindowText(IntPtr hWnd, int nMaxCount)
+ {
+ StringBuilder sb = new StringBuilder(nMaxCount);
+ GetWindowText(hWnd, sb, sb.Capacity);
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// The GetWindow function retrieves a handle to a window that has the specified relationship (Z-Order or owner) to the specified window.
+ /// </summary>
+ /// <param name="hWnd">[in] Handle to a window. The window handle retrieved is relative to this window, based on the value of the uCmd parameter. </param>
+ /// <param name="uCmd"></param>
+ /// <returns></returns>
+ [DllImport("coredll.dll")]
+ public static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
+
+ public static IntPtr GetChildWindow(IntPtr hWnd)
+ {
+ return GetWindow(hWnd, GetWindowConstants.GW_CHILD);
+ }
+
+
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
+
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern int SetWindowLong(IntPtr hWnd, int nIndex, WndProcDelegate newProc);
+
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr newProc);
+
+ [DllImport("coredll.dll", SetLastError = true)]
+ public static extern int CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ public static class GetWindowConstants
+ {
+ // Flags for GetWindow() api
+ // found in winuser.h
+ public static uint GW_HWNDFIRST = 0;
+ public static uint GW_HWNDLAST = 1;
+ public static uint GW_HWNDNEXT = 2;
+ public static uint GW_HWNDPREV = 3;
+ public static uint GW_OWNER = 4;
+ public static uint GW_CHILD = 5;
+ public static uint GW_MAX = 5;
+ }
+}
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-09-08 11:39:07
|
Revision: 92
http://roam.svn.sourceforge.net/roam/?rev=92&view=rev
Author: jonfroehlich
Date: 2007-09-08 04:38:57 -0700 (Sat, 08 Sep 2007)
Log Message:
-----------
slight modification to the help text displayed in TextBoxFilteredList
Modified Paths:
--------------
Trunk/Source/Roam.Test/UI/Controls/TextBoxFilteredListTest.Designer.cs
Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Test/UI/Controls/TextBoxFilteredListTest.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/UI/Controls/TextBoxFilteredListTest.Designer.cs 2007-09-05 06:00:39 UTC (rev 91)
+++ Trunk/Source/Roam.Test/UI/Controls/TextBoxFilteredListTest.Designer.cs 2007-09-08 11:38:57 UTC (rev 92)
@@ -82,6 +82,7 @@
//
// _menuAddButton
//
+ this._menuAddButton.Checked = true;
this._menuAddButton.Text = "Show Add Button";
this._menuAddButton.Click += new System.EventHandler(this._menuAddButton_Click);
//
@@ -115,7 +116,7 @@
this.autoFilteredTextBox1.Font = new System.Drawing.Font("Segoe Condensed", 9F, System.Drawing.FontStyle.Regular);
this.autoFilteredTextBox1.Location = new System.Drawing.Point(0, 0);
this.autoFilteredTextBox1.Name = "autoFilteredTextBox1";
- this.autoFilteredTextBox1.ShowAddButton = false;
+ this.autoFilteredTextBox1.ShowAddButton = true;
this.autoFilteredTextBox1.Size = new System.Drawing.Size(240, 266);
this.autoFilteredTextBox1.TabIndex = 0;
//
Modified: Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs 2007-09-05 06:00:39 UTC (rev 91)
+++ Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs 2007-09-08 11:38:57 UTC (rev 92)
@@ -425,8 +425,12 @@
if (_enableEnterOnTextBox || ShowAddButton)
{
message += "If you would like to add an item to this list, type it in the TextBox above ";
- if (_enableEnterOnTextBox)
+ if (_enableEnterOnTextBox && ShowAddButton)
{
+ message += "and press enter or select the add button.";
+ }
+ else if (_enableEnterOnListBox)
+ {
message += "and press enter.";
}
else
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-09-05 06:00:41
|
Revision: 91
http://roam.svn.sourceforge.net/roam/?rev=91&view=rev
Author: jonfroehlich
Date: 2007-09-04 23:00:39 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
fixed RoamForm bug in Show and ShowDialog, they were not prefixing their calls to specify the base class
Modified Paths:
--------------
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Forms/RoamForm.Designer.cs
Trunk/Source/Roam.UI/Forms/RoamForm.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-08-27 03:36:45 UTC (rev 90)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-09-05 06:00:39 UTC (rev 91)
@@ -537,7 +537,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Forms/RoamForm.Designer.cs
===================================================================
--- Trunk/Source/Roam.UI/Forms/RoamForm.Designer.cs 2007-08-27 03:36:45 UTC (rev 90)
+++ Trunk/Source/Roam.UI/Forms/RoamForm.Designer.cs 2007-09-05 06:00:39 UTC (rev 91)
@@ -34,6 +34,7 @@
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
+ _isDisposed = true;
if (disposing && (components != null))
{
components.Dispose();
Modified: Trunk/Source/Roam.UI/Forms/RoamForm.cs
===================================================================
--- Trunk/Source/Roam.UI/Forms/RoamForm.cs 2007-08-27 03:36:45 UTC (rev 90)
+++ Trunk/Source/Roam.UI/Forms/RoamForm.cs 2007-09-05 06:00:39 UTC (rev 91)
@@ -33,6 +33,7 @@
{
private bool _isModal = false;
private bool _isClosed = false;
+ private bool _isDisposed = false;
public RoamForm()
{
@@ -80,7 +81,7 @@
public new DialogResult ShowDialog()
{
_isModal = true;
- DialogResult dr = ShowDialog();
+ DialogResult dr = base.ShowDialog();
_isModal = false;
return dr;
}
@@ -88,7 +89,7 @@
public new void Show()
{
_isModal = false;
- Show();
+ base.Show();
}
#endregion Public Methods
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-08-31 14:46:52
|
Revision: 90
http://roam.svn.sourceforge.net/roam/?rev=90&view=rev
Author: jonfroehlich
Date: 2007-08-26 20:36:45 -0700 (Sun, 26 Aug 2007)
Log Message:
-----------
Added SummaryStatistics which is a container class storing stats like mean, median, mode, variance, std dev, etc.
updated math utils to support stats of ICollection<int> in addition to ICollection<long> and ICollection<double>... I wish there was a way to do this in a OO manner through a INumber interface or something.
Modified Paths:
--------------
Trunk/Source/Roam.Common/Roam.Common.csproj
Trunk/Source/Roam.Common/Utils/MathUtils.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs
Trunk/Source/Roam.Test/Utils/KeySnifferTest.Designer.cs
Trunk/Source/Roam.Test/Utils/KeySnifferTest.cs
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam.Common/Utils/SummaryStatistics.cs
Modified: Trunk/Source/Roam.Common/Roam.Common.csproj
===================================================================
--- Trunk/Source/Roam.Common/Roam.Common.csproj 2007-07-31 08:23:27 UTC (rev 89)
+++ Trunk/Source/Roam.Common/Roam.Common.csproj 2007-08-27 03:36:45 UTC (rev 90)
@@ -79,6 +79,7 @@
<Compile Include="Utils\EnumUtils.cs" />
<Compile Include="Utils\ErrorUtils.cs" />
<Compile Include="Utils\ImagingUtils.cs" />
+ <Compile Include="Utils\SummaryStatistics.cs" />
<Compile Include="Utils\Vector2.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceNotFoundException.cs" />
Modified: Trunk/Source/Roam.Common/Utils/MathUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/MathUtils.cs 2007-07-31 08:23:27 UTC (rev 89)
+++ Trunk/Source/Roam.Common/Utils/MathUtils.cs 2007-08-27 03:36:45 UTC (rev 90)
@@ -16,6 +16,7 @@
using System.Collections.Generic;
using System.Text;
using System.Drawing;
+using System.Collections;
namespace Roam.Common.Utils
{
@@ -28,43 +29,51 @@
/// <author>Jon Froehlich</author>
public static class MathUtils
{
- public static double GetEuclideanDistance(Point ptStart, Point ptEnd)
+ public static double Variance(ICollection<double> values)
{
- int xDiff = ptEnd.X - ptStart.X;
- int yDiff = ptEnd.Y - ptStart.Y;
- return Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));
- }
+ if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
+ else if (values.Count == 1) { return 0; }
- /// <summary>
- /// Gets the angle in radians between these two points and the Vector (1,0)
- /// </summary>
- /// <param name="ptStart"></param>
- /// <param name="ptEnd"></param>
- /// <returns></returns>
- public static double GetAngle(Point ptStart, Point ptEnd)
- {
- Vector2 v = new Vector2(1,0);
- Vector2 w = new Vector2(ptEnd.X - ptStart.X, ptEnd.Y - ptStart.Y);
- double angleRad = v.GetAngle(w);
-
- if(w.X < 0 && w.Y > 0 || w.X >=0 && w.Y >= 0){
- angleRad = (System.Math.PI * 2) - angleRad;
- }
+ //see http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
+ int n = 0;
+ double mean = 0;
+ double S = 0;
+ double delta = 0;
- return angleRad;
+ foreach (double x in values)
+ {
+ n = n + 1;
+ delta = x - mean;
+ mean = mean + delta / (double)n;
+ S = S + delta * (x - mean);
+ }
+
+ return S / (n - 1);
}
- public static double DegreesToRadians(double degrees)
+ public static double Variance(ICollection<long> values)
{
- return degrees * System.Math.PI / 180.0;
- }
+ if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
+ else if (values.Count == 1) { return 0; }
- public static double RadiansToDegrees(double radians)
- {
- return radians * 180.0 / System.Math.PI;
+ //see http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
+ int n = 0;
+ double mean = 0;
+ double S = 0;
+ double delta = 0;
+
+ foreach (long x in values)
+ {
+ n = n + 1;
+ delta = x - mean;
+ mean = mean + delta / (double)n;
+ S = S + delta * (x - mean);
+ }
+
+ return S / (n - 1);
}
- public static double Variance(ICollection<double> values)
+ public static double Variance(ICollection<int> values)
{
if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
else if (values.Count == 1) { return 0; }
@@ -75,11 +84,11 @@
double S = 0;
double delta = 0;
- foreach (double x in values)
+ foreach (int x in values)
{
n = n + 1;
delta = x - mean;
- mean = mean + delta / (float)n;
+ mean = mean + delta / (double)n;
S = S + delta * (x - mean);
}
@@ -96,12 +105,41 @@
/// <returns></returns>
public static double StandardDeviation(ICollection<double> values)
{
- double variance = Variance(values);
//the standard deviation is the square root of the variance
//http://en.wikipedia.org/wiki/Standard_deviation
- return Math.Sqrt(variance);
+ return Math.Sqrt(Variance(values));
}
+ /// <summary>
+ /// To understand standard deviation, keep in mind that variance is the average of the squared
+ /// differences between data points and the mean. Variance is tabulated in units squared.
+ /// Standard deviation, being the square root of that quantity, therefore measures the spread
+ /// of data about the mean, measured in the same units as the data.
+ /// </summary>
+ /// <param name="values"></param>
+ /// <returns></returns>
+ public static double StandardDeviation(ICollection<long> values)
+ {
+ //the standard deviation is the square root of the variance
+ //http://en.wikipedia.org/wiki/Standard_deviation
+ return Math.Sqrt(Variance(values));
+ }
+
+ /// <summary>
+ /// To understand standard deviation, keep in mind that variance is the average of the squared
+ /// differences between data points and the mean. Variance is tabulated in units squared.
+ /// Standard deviation, being the square root of that quantity, therefore measures the spread
+ /// of data about the mean, measured in the same units as the data.
+ /// </summary>
+ /// <param name="values"></param>
+ /// <returns></returns>
+ public static double StandardDeviation(ICollection<int> values)
+ {
+ //the standard deviation is the square root of the variance
+ //http://en.wikipedia.org/wiki/Standard_deviation
+ return Math.Sqrt(Variance(values));
+ }
+
public static Pair<double, double> MinMax(ICollection<double> values)
{
double max = double.MinValue;
@@ -114,16 +152,78 @@
return new Pair<double, double>(min, max);
}
+ public static Pair<long, long> MinMax(ICollection<long> values)
+ {
+ long max = long.MinValue;
+ long min = long.MaxValue;
+ foreach (long l in values)
+ {
+ if (l > max) { max = l; }
+ if (l < min) { min = l; }
+ }
+ return new Pair<long, long>(min, max);
+ }
+
+ public static Pair<int, int> MinMax(ICollection<int> values)
+ {
+ int max = int.MinValue;
+ int min = int.MaxValue;
+ foreach (int l in values)
+ {
+ if (l > max) { max = l; }
+ if (l < min) { min = l; }
+ }
+ return new Pair<int, int>(min, max);
+ }
+
+ public static double Range(ICollection<double> values)
+ {
+ Pair<double, double> minMax = MinMax(values);
+ return minMax.Element2 - minMax.Element1;
+ }
+
+ public static double Range(ICollection<long> values)
+ {
+ Pair<long, long> minMax = MinMax(values);
+ return minMax.Element2 - minMax.Element1;
+ }
+
+ public static double Range(ICollection<int> values)
+ {
+ Pair<int, int> minMax = MinMax(values);
+ return minMax.Element2 - minMax.Element1;
+ }
+
+ public static double Minimum(ICollection<double> values)
+ {
+ return MinMax(values).Element1;
+ }
+
public static double Maximum(ICollection<double> values)
{
return MinMax(values).Element2;
}
- public static double Minimum(ICollection<double> values)
+ public static double Minimum(ICollection<long> values)
{
return MinMax(values).Element1;
}
+ public static double Maximum(ICollection<long> values)
+ {
+ return MinMax(values).Element2;
+ }
+
+ public static double Minimum(ICollection<int> values)
+ {
+ return MinMax(values).Element1;
+ }
+
+ public static double Maximum(ICollection<int> values)
+ {
+ return MinMax(values).Element2;
+ }
+
public static double Mode(ICollection<double> values)
{
Dictionary<double, int> dictCount = new Dictionary<double, int>();
@@ -133,13 +233,13 @@
else { dictCount[d] = 1; }
}
- int max = int.MinValue;
+ int maxCount = int.MinValue;
double mode = double.NaN;
foreach (KeyValuePair<double, int> kvp in dictCount)
{
- if (kvp.Value > max)
+ if (kvp.Value > maxCount)
{
- max = kvp.Value;
+ maxCount = kvp.Value;
mode = kvp.Key;
}
}
@@ -147,6 +247,52 @@
return mode;
}
+ public static long Mode(ICollection<long> values)
+ {
+ Dictionary<long, int> dictCount = new Dictionary<long, int>();
+ foreach (long l in values)
+ {
+ if (dictCount.ContainsKey(l)) { dictCount[l] = dictCount[l] + 1; }
+ else { dictCount[l] = 1; }
+ }
+
+ int maxCount = int.MinValue;
+ long mode = long.MinValue;
+ foreach (KeyValuePair<long, int> kvp in dictCount)
+ {
+ if (kvp.Value > maxCount)
+ {
+ maxCount = kvp.Value;
+ mode = kvp.Key;
+ }
+ }
+
+ return mode;
+ }
+
+ public static int Mode(ICollection<int> values)
+ {
+ Dictionary<int, int> dictCount = new Dictionary<int, int>();
+ foreach (int i in values)
+ {
+ if (dictCount.ContainsKey(i)) { dictCount[i] = dictCount[i] + 1; }
+ else { dictCount[i] = 1; }
+ }
+
+ int maxCount = int.MinValue;
+ int mode = int.MinValue;
+ foreach (KeyValuePair<int, int> kvp in dictCount)
+ {
+ if (kvp.Value > maxCount)
+ {
+ maxCount = kvp.Value;
+ mode = kvp.Key;
+ }
+ }
+
+ return mode;
+ }
+
public static double Mean(ICollection<double> values)
{
if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
@@ -161,7 +307,7 @@
public static double Mean(ICollection<int> values)
{
if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
- int total = 0;
+ long total = 0;
foreach (int i in values)
{
total += i;
@@ -169,6 +315,18 @@
return total / (double)values.Count;
}
+ public static double Mean(ICollection<long> values)
+ {
+ if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
+
+ long total = 0;
+ foreach (long l in values)
+ {
+ total = checked(total + l);
+ }
+ return total / (double)values.Count;
+ }
+
public static double Median(ICollection<double> values)
{
if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
@@ -186,5 +344,332 @@
return doubles[(int)System.Math.Floor(doubles.Length / 2f)];
}
}
+
+ public static double Median(ICollection<long> values)
+ {
+ if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
+
+ long[] longs = new long[values.Count];
+ values.CopyTo(longs, 0);
+ Array.Sort(longs);
+ if (longs.Length % 2 == 0)
+ {
+ int i = (int)(longs.Length / 2f);
+ return (longs[i - 1] + longs[i]) / 2f;
+ }
+ else
+ {
+ return longs[(int)System.Math.Floor(longs.Length / 2f)];
+ }
+ }
+
+ public static double Median(ICollection<int> values)
+ {
+ if (values.Count <= 0) { throw new ArgumentException("The values.Length must be greater than 0", "values"); }
+
+ int[] ints = new int[values.Count];
+ values.CopyTo(ints, 0);
+ Array.Sort(ints);
+ if (ints.Length % 2 == 0)
+ {
+ int i = (int)(ints.Length / 2f);
+ return (ints[i - 1] + ints[i]) / 2f;
+ }
+ else
+ {
+ return ints[(int)System.Math.Floor(ints.Length / 2f)];
+ }
+ }
+
+ private static double Sum(ICollection<double> values)
+ {
+ double sum = 0;
+ foreach (double v in values) { checked { sum += v; } }
+ return sum;
+ }
+
+ private static long Sum(ICollection<long> values)
+ {
+ long sum = 0;
+ foreach (long l in values) { checked { sum += l; } }
+ return sum;
+ }
+
+ private static long Sum(ICollection<int> values)
+ {
+ long sum = 0;
+ foreach (long l in values) { checked { sum += l; } }
+ return sum;
+ }
+
+ public static double EuclideanDistance(double x1, double y1, double x2, double y2)
+ {
+ double xDiff = x2 - x1;
+ double yDiff = y2 - y1;
+ return Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));
+ }
+
+ public static double EuclideanDistance(long x1, long y1, long x2, long y2)
+ {
+ long xDiff = x2 - x1;
+ long yDiff = y2 - y1;
+ return Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));
+ }
+
+ public static double EuclideanDistance(int x1, int y1, int x2, int y2)
+ {
+ int xDiff = x2 - x1;
+ int yDiff = y2 - y1;
+ return Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));
+ }
+
+ public static double DegreesToRadians(double degrees)
+ {
+ return Math.PI * degrees / 180.0;
+ }
+
+ public static double RadiansToDegrees(double radians)
+ {
+ //radians = (PI * degrees) / 180
+ //degrees = (180 * radians)/PI
+ return (180 * radians) / Math.PI;
+ }
+
+ public static SummaryStatistics GetSummaryStatistics(ICollection<double> values, SummaryStatisticsFlags flags)
+ {
+ if (values.Count <= 0) { return new SummaryStatistics(); }
+
+ SummaryStatistics summaryStatistics = new SummaryStatistics(values.Count);
+
+ if ((flags & SummaryStatisticsFlags.Mean) == SummaryStatisticsFlags.Mean)
+ {
+ summaryStatistics.Mean = Mean(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Median) == SummaryStatisticsFlags.Median)
+ {
+ summaryStatistics.Median = Median(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Mode) == SummaryStatisticsFlags.Mode)
+ {
+ summaryStatistics.Mode = Mode(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Sum) == SummaryStatisticsFlags.Sum)
+ {
+ summaryStatistics.Sum = Sum(values);
+ }
+
+ Pair<double, double> minMaxPair = null;
+ if ((flags & SummaryStatisticsFlags.Range) == SummaryStatisticsFlags.Range)
+ {
+ minMaxPair = MinMax(values);
+ summaryStatistics.Range = minMaxPair.Element2 - minMaxPair.Element1;
+ }
+
+ if ((flags & SummaryStatisticsFlags.Minimum) == SummaryStatisticsFlags.Minimum)
+ {
+ if (summaryStatistics.IsValid(SummaryStatisticsFlags.Range)) { summaryStatistics.Minimum = minMaxPair.Element1; }
+ else { summaryStatistics.Minimum = Minimum(values); }
+ }
+
+ if ((flags & SummaryStatisticsFlags.Maximum) == SummaryStatisticsFlags.Maximum)
+ {
+ if (summaryStatistics.IsValid(SummaryStatisticsFlags.Range)) { summaryStatistics.Maximum = minMaxPair.Element2; }
+ else { summaryStatistics.Maximum = Maximum(values); }
+ }
+
+ if ((flags & SummaryStatisticsFlags.First) == SummaryStatisticsFlags.First)
+ {
+ double first = double.NaN;
+ if (values is IList<double>) { first = ((IList<double>)values)[0]; }
+ else { foreach (double val in values) { first = val; break; } }
+ summaryStatistics.First = first;
+ }
+
+ if ((flags & SummaryStatisticsFlags.Last) == SummaryStatisticsFlags.Last)
+ {
+ double last = double.NaN;
+ if (values is IList<double>) { last = ((IList<double>)values)[values.Count - 1]; }
+ else { foreach (double val in values) { last = val; } }
+ summaryStatistics.Last = last;
+ }
+
+ if ((flags & SummaryStatisticsFlags.StandardDeviation) == SummaryStatisticsFlags.StandardDeviation)
+ {
+ summaryStatistics.StandardDeviation = StandardDeviation(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Variance) == SummaryStatisticsFlags.Variance)
+ {
+ summaryStatistics.Variance = Variance(values);
+ }
+
+ return summaryStatistics;
+ }
+
+ public static SummaryStatistics GetSummaryStatistics(ICollection<double> values)
+ {
+ return GetSummaryStatistics(values, SummaryStatisticsFlags.All);
+ }
+
+ public static SummaryStatistics GetSummaryStatistics(ICollection<long> values, SummaryStatisticsFlags flags)
+ {
+ if (values.Count <= 0) { return new SummaryStatistics(); }
+
+ SummaryStatistics summaryStatistics = new SummaryStatistics(values.Count);
+
+ if ((flags & SummaryStatisticsFlags.Mean) == SummaryStatisticsFlags.Mean)
+ {
+ summaryStatistics.Mean = Mean(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Median) == SummaryStatisticsFlags.Median)
+ {
+ summaryStatistics.Median = Median(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Mode) == SummaryStatisticsFlags.Mode)
+ {
+ summaryStatistics.Mode = Mode(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Sum) == SummaryStatisticsFlags.Sum)
+ {
+ summaryStatistics.Sum = Sum(values);
+ }
+
+ Pair<long, long> minMaxPair = null;
+ if ((flags & SummaryStatisticsFlags.Range) == SummaryStatisticsFlags.Range)
+ {
+ minMaxPair = MinMax(values);
+ summaryStatistics.Range = minMaxPair.Element2 - minMaxPair.Element1;
+ }
+
+ if ((flags & SummaryStatisticsFlags.Minimum) == SummaryStatisticsFlags.Minimum)
+ {
+ if (summaryStatistics.IsValid(SummaryStatisticsFlags.Range)) { summaryStatistics.Minimum = minMaxPair.Element1; }
+ else { summaryStatistics.Minimum = Minimum(values); }
+ }
+
+ if ((flags & SummaryStatisticsFlags.Maximum) == SummaryStatisticsFlags.Maximum)
+ {
+ if (summaryStatistics.IsValid(SummaryStatisticsFlags.Range)) { summaryStatistics.Maximum = minMaxPair.Element2; }
+ else { summaryStatistics.Maximum = Maximum(values); }
+ }
+
+ if ((flags & SummaryStatisticsFlags.First) == SummaryStatisticsFlags.First)
+ {
+ long first = long.MinValue;
+ if (values is IList<long>) { first = ((IList<long>)values)[0]; }
+ else { foreach (long val in values) { first = val; break; } }
+ summaryStatistics.First = first;
+ }
+
+ if ((flags & SummaryStatisticsFlags.Last) == SummaryStatisticsFlags.Last)
+ {
+ long last = long.MinValue;
+ if (values is IList<long>) { last = ((IList<long>)values)[values.Count - 1]; }
+ else { foreach (long val in values) { last = val; } }
+ summaryStatistics.Last = last;
+ }
+
+ if ((flags & SummaryStatisticsFlags.StandardDeviation) == SummaryStatisticsFlags.StandardDeviation)
+ {
+ summaryStatistics.StandardDeviation = StandardDeviation(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Variance) == SummaryStatisticsFlags.Variance)
+ {
+ summaryStatistics.Variance = Variance(values);
+ }
+
+ return summaryStatistics;
+ }
+
+ public static SummaryStatistics GetSummaryStatistics(ICollection<long> values)
+ {
+ return GetSummaryStatistics(values, SummaryStatisticsFlags.All);
+ }
+
+ public static SummaryStatistics GetSummaryStatistics(ICollection<int> values, SummaryStatisticsFlags flags)
+ {
+ if (values.Count <= 0) { return new SummaryStatistics(); }
+
+ SummaryStatistics summaryStatistics = new SummaryStatistics(values.Count);
+
+ if ((flags & SummaryStatisticsFlags.Mean) == SummaryStatisticsFlags.Mean)
+ {
+ summaryStatistics.Mean = Mean(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Median) == SummaryStatisticsFlags.Median)
+ {
+ summaryStatistics.Median = Median(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Mode) == SummaryStatisticsFlags.Mode)
+ {
+ summaryStatistics.Mode = Mode(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Sum) == SummaryStatisticsFlags.Sum)
+ {
+ summaryStatistics.Sum = Sum(values);
+ }
+
+ Pair<int, int> minMaxPair = null;
+ if ((flags & SummaryStatisticsFlags.Range) == SummaryStatisticsFlags.Range)
+ {
+ minMaxPair = MinMax(values);
+ summaryStatistics.Range = minMaxPair.Element2 - minMaxPair.Element1;
+ }
+
+ if ((flags & SummaryStatisticsFlags.Minimum) == SummaryStatisticsFlags.Minimum)
+ {
+ if (summaryStatistics.IsValid(SummaryStatisticsFlags.Range)) { summaryStatistics.Minimum = minMaxPair.Element1; }
+ else { summaryStatistics.Minimum = Minimum(values); }
+ }
+
+ if ((flags & SummaryStatisticsFlags.Maximum) == SummaryStatisticsFlags.Maximum)
+ {
+ if (summaryStatistics.IsValid(SummaryStatisticsFlags.Range)) { summaryStatistics.Maximum = minMaxPair.Element2; }
+ else { summaryStatistics.Maximum = Maximum(values); }
+ }
+
+ if ((flags & SummaryStatisticsFlags.First) == SummaryStatisticsFlags.First)
+ {
+ int first = int.MinValue;
+ if (values is IList<int>) { first = ((IList<int>)values)[0]; }
+ else { foreach (int val in values) { first = val; break; } }
+ summaryStatistics.First = first;
+ }
+
+ if ((flags & SummaryStatisticsFlags.Last) == SummaryStatisticsFlags.Last)
+ {
+ int last = int.MinValue;
+ if (values is IList<int>) { last = ((IList<int>)values)[values.Count - 1]; }
+ else { foreach (int val in values) { last = val; } }
+ summaryStatistics.Last = last;
+ }
+
+ if ((flags & SummaryStatisticsFlags.StandardDeviation) == SummaryStatisticsFlags.StandardDeviation)
+ {
+ summaryStatistics.StandardDeviation = StandardDeviation(values);
+ }
+
+ if ((flags & SummaryStatisticsFlags.Variance) == SummaryStatisticsFlags.Variance)
+ {
+ summaryStatistics.Variance = Variance(values);
+ }
+
+ return summaryStatistics;
+ }
+
+ public static SummaryStatistics GetSummaryStatistics(ICollection<int> values)
+ {
+ return GetSummaryStatistics(values, SummaryStatisticsFlags.All);
+ }
}
}
Added: Trunk/Source/Roam.Common/Utils/SummaryStatistics.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/SummaryStatistics.cs (rev 0)
+++ Trunk/Source/Roam.Common/Utils/SummaryStatistics.cs 2007-08-27 03:36:45 UTC (rev 90)
@@ -0,0 +1,256 @@
+#region Copyright & License
+//
+// Copyright (c) 2005 - 2007 The Regents of the University of Washington, Intel
+// Research Seattle, and the Roam project. All rights reserved.
+//
+// This software is open-source under the BSD license. You may obtain a copy
+// of this license at
+//
+// http://roam.sourceforge.net/license.txt
+//
+// Alternatively, please see "license.txt" which should be included in
+// this source code distribution.
+//
+#endregion Copyright & License
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Roam.Common.Utils
+{
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ public class SummaryStatistics
+ {
+ #region Fields
+ private SummaryStatisticsFlags _flagsCurrentlySet = SummaryStatisticsFlags.None;
+ //private double _mean;
+ //private double _median;
+ //private double _sum;
+ //private double _minimum;
+ //private double _maximum;
+ //private double _range;
+ //private double _first;
+ //private double _last;
+ //private double _stdDev;
+ //private double _variance;
+ //private double _mode;
+ private Dictionary<SummaryStatisticsFlags, double> _mapStats = new Dictionary<SummaryStatisticsFlags, double>();
+ //private int _count = int.MinValue;
+ #endregion Fields
+
+ #region Constructors
+ public SummaryStatistics() { }
+ public SummaryStatistics(int cases) { Cases = cases; }
+ public SummaryStatistics(IDictionary<SummaryStatisticsFlags, double> mapStats)
+ {
+ Set(mapStats);
+ }
+ #endregion Constructors
+
+ #region Properties
+ public double this[SummaryStatisticsFlags flag]
+ {
+ get
+ {
+ if(_mapStats.ContainsKey(flag))
+ {
+ return _mapStats[flag];
+ }
+ throw new ArgumentException(string.Format("We cannot return a value for the flag={0}", flag));
+ //switch (flag)
+ //{
+ // case SummaryStatisticsFlags.Mean:
+ // return Mean;
+ // case SummaryStatisticsFlags.Median:
+ // return Median;
+ // case SummaryStatisticsFlags.Sum:
+ // return Sum;
+ // case SummaryStatisticsFlags.Minimum:
+ // return Minimum;
+ // case SummaryStatisticsFlags.Maximum:
+ // return Maximum;
+ // case SummaryStatisticsFlags.Range:
+ // return Range;
+ // case SummaryStatisticsFlags.First:
+ // return First;
+ // case SummaryStatisticsFlags.Last:
+ // return Last;
+ // case SummaryStatisticsFlags.StandardDeviation:
+ // return StandardDeviation;
+ // case SummaryStatisticsFlags.Variance:
+ // return Variance;
+ // case SummaryStatisticsFlags.Mode:
+ // return Mode;
+ // case
+ //}
+
+ //throw new ArgumentException(string.Format("We cannot return a value for the flag={0}", flag));
+ }
+ set
+ {
+ switch (flag)
+ {
+ case SummaryStatisticsFlags.Mean:
+ Mean = value;
+ break;
+ case SummaryStatisticsFlags.Median:
+ Median = value;
+ break;
+ case SummaryStatisticsFlags.Sum:
+ Sum = value;
+ break;
+ case SummaryStatisticsFlags.Minimum:
+ Minimum = value;
+ break;
+ case SummaryStatisticsFlags.Maximum:
+ Maximum = value;
+ break;
+ case SummaryStatisticsFlags.Range:
+ Range = value;
+ break;
+ case SummaryStatisticsFlags.First:
+ First = value;
+ break;
+ case SummaryStatisticsFlags.Last:
+ Last = value;
+ break;
+ case SummaryStatisticsFlags.StandardDeviation:
+ StandardDeviation = value;
+ break;
+ case SummaryStatisticsFlags.Variance:
+ Variance = value;
+ break;
+ case SummaryStatisticsFlags.Mode:
+ Mode = value;
+ break;
+ case SummaryStatisticsFlags.Cases:
+ Cases = (int)value;
+ break;
+ default:
+ throw new ArgumentException(string.Format("We cannot set a value for the flag={0}", flag));
+ break;
+ }
+ }
+ }
+
+ public double Mean
+ {
+ get { if(_mapStats.ContainsKey(SummaryStatisticsFlags.Mean)) { return _mapStats[SummaryStatisticsFlags.Mean]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Mean] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Mean; }
+ }
+
+ public double Median
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Median)) { return _mapStats[SummaryStatisticsFlags.Median]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Median] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Median; }
+ }
+
+ public double Sum
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Sum)) { return _mapStats[SummaryStatisticsFlags.Sum]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Sum] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Sum; }
+ }
+
+ public double Minimum
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Minimum)) { return _mapStats[SummaryStatisticsFlags.Minimum]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Minimum] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Minimum; }
+ }
+
+ public double Maximum
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Maximum)) { return _mapStats[SummaryStatisticsFlags.Maximum]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Maximum] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Maximum; }
+ }
+
+ public double Range
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Range)) { return _mapStats[SummaryStatisticsFlags.Range]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Range] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Range; }
+ }
+
+ public double First
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.First)) { return _mapStats[SummaryStatisticsFlags.First]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.First] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.First; }
+ }
+
+ public double Last
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Last)) { return _mapStats[SummaryStatisticsFlags.Last]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Last] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Last; }
+ }
+
+ public double StandardDeviation
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.StandardDeviation)) { return _mapStats[SummaryStatisticsFlags.StandardDeviation]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.StandardDeviation] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.StandardDeviation; }
+ }
+
+ public double Variance
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Variance)) { return _mapStats[SummaryStatisticsFlags.Variance]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Variance] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Variance; }
+ }
+
+ public double Mode
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Mode)) { return _mapStats[SummaryStatisticsFlags.Mode]; } return double.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Mode] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Mode; }
+ }
+
+ public int Cases
+ {
+ get { if (_mapStats.ContainsKey(SummaryStatisticsFlags.Cases)) { return (int)_mapStats[SummaryStatisticsFlags.Cases]; } return int.MinValue; }
+ set { _mapStats[SummaryStatisticsFlags.Cases] = value; _flagsCurrentlySet |= SummaryStatisticsFlags.Cases; }
+ }
+
+ #endregion Properties
+
+ #region Methods
+ public bool IsValid(SummaryStatisticsFlags flags)
+ {
+ return (_flagsCurrentlySet & flags) != 0;
+ }
+
+ public IDictionary<SummaryStatisticsFlags, double> GetStatistics()
+ {
+ Dictionary<SummaryStatisticsFlags, double> d = new Dictionary<SummaryStatisticsFlags, double>(_mapStats);
+ return d;
+ }
+
+ private void Set(IDictionary<SummaryStatisticsFlags, double> mapStats)
+ {
+ foreach (KeyValuePair<SummaryStatisticsFlags, double> kvp in mapStats)
+ {
+ this[kvp.Key] = kvp.Value;
+ }
+ }
+ #endregion Methods
+ }
+
+ [Flags]
+ public enum SummaryStatisticsFlags
+ {
+ None = 0x000,
+ Mean = 0x0001,
+ Median = 0x002,
+ Sum = 0x004,
+ Minimum = 0x008,
+ Maximum = 0x010,
+ Range = 0x020,
+ First = 0x040,
+ Last = 0x080,
+ StandardDeviation = 0x100,
+ Variance = 0x200,
+ Mode = 0x400,
+ Cases = 0x800,
+ All = Mean | Median | Sum | Minimum | Maximum | Range | First | Last | StandardDeviation | Variance | Mode | Cases
+ }
+}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-07-31 08:23:27 UTC (rev 89)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-08-27 03:36:45 UTC (rev 90)
@@ -81,12 +81,6 @@
<DependentUpon>EnumWindowsTest.cs</DependentUpon>
</Compile>
<Compile Include="Sandbox\PhoneButtonManager.cs" />
- <Compile Include="Sandbox\Camera.cs">
- <SubType>Component</SubType>
- </Compile>
- <Compile Include="Sandbox\Camera.Designer.cs">
- <DependentUpon>Camera.cs</DependentUpon>
- </Compile>
<Compile Include="Sandbox\ColorsTest.cs">
<SubType>Form</SubType>
</Compile>
@@ -212,10 +206,6 @@
<SubType>Designer</SubType>
<DependentUpon>AlphaBlendTest.cs</DependentUpon>
</EmbeddedResource>
- <EmbeddedResource Include="UI\Controls\AudioRecorderTest.resx">
- <SubType>Designer</SubType>
- <DependentUpon>AudioRecorderTest.cs</DependentUpon>
- </EmbeddedResource>
<EmbeddedResource Include="UI\Controls\CalendarTest.resx">
<SubType>Designer</SubType>
<DependentUpon>CalendarTest.cs</DependentUpon>
@@ -498,12 +488,6 @@
<Compile Include="UI\Controls\AlphaBlendTest.Designer.cs">
<DependentUpon>AlphaBlendTest.cs</DependentUpon>
</Compile>
- <Compile Include="UI\Controls\AudioRecorderTest.cs">
- <SubType>Form</SubType>
- </Compile>
- <Compile Include="UI\Controls\AudioRecorderTest.Designer.cs">
- <DependentUpon>AudioRecorderTest.cs</DependentUpon>
- </Compile>
<Compile Include="UI\Controls\CalendarTest.cs">
<SubType>Form</SubType>
</Compile>
@@ -553,7 +537,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
@@ -691,7 +675,7 @@
<DependentUpon>SystemColorTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\TabControlTest.cs">
- <SubType>Component</SubType>
+ <SubType>Form</SubType>
</Compile>
<Compile Include="UI\Controls\TabControlTest.Designer.cs">
<DependentUpon>TabControlTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs
===================================================================
--- Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs 2007-07-31 08:23:27 UTC (rev 89)
+++ Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs 2007-08-27 03:36:45 UTC (rev 90)
@@ -7,6 +7,7 @@
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;
using System.Runtime.InteropServices;
+using Roam.Common.Utils;
namespace Roam.Test.Sandbox
{
@@ -63,6 +64,7 @@
{
//register to listen for home key
RegisterHotKey(this.Hwnd, VK_LWIN, 8, VK_LWIN);
+
}
~MessageWin()
Modified: Trunk/Source/Roam.Test/Utils/KeySnifferTest.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/KeySnifferTest.Designer.cs 2007-07-31 08:23:27 UTC (rev 89)
+++ Trunk/Source/Roam.Test/Utils/KeySnifferTest.Designer.cs 2007-08-27 03:36:45 UTC (rev 90)
@@ -33,8 +33,9 @@
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this._menuItemStartStop = new System.Windows.Forms.MenuItem();
+ this._menuItemTrap = new System.Windows.Forms.MenuItem();
this._scrollableLabel = new Roam.UI.Controls.ScrollableLabel();
- this._menuItemTrap = new System.Windows.Forms.MenuItem();
+ this.menuItem3 = new System.Windows.Forms.MenuItem();
this.SuspendLayout();
//
// mainMenu1
@@ -51,6 +52,7 @@
//
this.menuItem2.MenuItems.Add(this._menuItemStartStop);
this.menuItem2.MenuItems.Add(this._menuItemTrap);
+ this.menuItem2.MenuItems.Add(this.menuItem3);
this.menuItem2.Text = "Menu";
//
// _menuItemStartStop
@@ -58,6 +60,11 @@
this._menuItemStartStop.Text = "Start";
this._menuItemStartStop.Click += new System.EventHandler(this._menuItemStartStop_Click);
//
+ // _menuItemTrap
+ //
+ this._menuItemTrap.Text = "Trap";
+ this._menuItemTrap.Click += new System.EventHandler(this._menuItemTrap_Click_1);
+ //
// _scrollableLabel
//
this._scrollableLabel.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -67,9 +74,10 @@
this._scrollableLabel.Size = new System.Drawing.Size(240, 266);
this._scrollableLabel.TabIndex = 3;
//
- // _menuItemTrap
+ // menuItem3
//
- this._menuItemTrap.Text = "Trap";
+ this.menuItem3.Text = "Clear";
+ this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// KeySnifferTest
//
@@ -92,5 +100,6 @@
private System.Windows.Forms.MenuItem _menuItemStartStop;
private Roam.UI.Controls.ScrollableLabel _scrollableLabel;
private System.Windows.Forms.MenuItem _menuItemTrap;
+ private System.Windows.Forms.MenuItem menuItem3;
}
}
\ No newline at end of file
Modified: Trunk/Source/Roam.Test/Utils/KeySnifferTest.cs
===================================================================
--- Trunk/Source/Roam.Test/Utils/KeySnifferTest.cs 2007-07-31 08:23:27 UTC (rev 89)
+++ Trunk/Source/Roam.Test/Utils/KeySnifferTest.cs 2007-08-27 03:36:45 UTC (rev 90)
@@ -61,6 +61,7 @@
private void menuItem1_Click(object sender, EventArgs e)
{
+ _keySniffer.Stop();
this.Close();
}
@@ -78,9 +79,14 @@
}
}
- private void _menuItemTrap_Click(object sender, EventArgs e)
+ private void _menuItemTrap_Click_1(object sender, EventArgs e)
{
_menuItemTrap.Checked = !_menuItemTrap.Checked;
}
+
+ private void menuItem3_Click(object sender, EventArgs e)
+ {
+ _scrollableLabel.Clear();
+ }
}
}
\ No newline at end of file
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jon...@us...> - 2007-07-31 08:23:30
|
Revision: 89
http://roam.svn.sourceforge.net/roam/?rev=89&view=rev
Author: jonfroehlich
Date: 2007-07-31 01:23:27 -0700 (Tue, 31 Jul 2007)
Log Message:
-----------
added register hot key test
Modified Paths:
--------------
Trunk/Source/Roam/Utils/WindowsConstants.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Controls/AudioRecorder.cs
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.Designer.cs
Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs
Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.resx
Modified: Trunk/Source/Roam/Utils/WindowsConstants.cs
===================================================================
--- Trunk/Source/Roam/Utils/WindowsConstants.cs 2007-07-30 00:09:11 UTC (rev 88)
+++ Trunk/Source/Roam/Utils/WindowsConstants.cs 2007-07-31 08:23:27 UTC (rev 89)
@@ -28,7 +28,7 @@
/// <author>Jon Froehlich</author>
public static class WindowsConstants
{
- //these values are found in winuser.h or through experimentation
+ //these values are found in winuser.h/winuserm.h or through experimentation
#region Keys
/// <summary>
@@ -81,12 +81,101 @@
public static int WM_MOUSELAST = 0x0209;
#endregion Mouse
- public static byte VK_BACK = 0x08;
- public static byte VK_ESCAPE = 0x1B;
- public static byte VK_SHIFT = 0x10;
- public static byte VK_CAPITAL = 0x14;
- public static byte VK_NUMLOCK = 0x90;
+ #region VirtualKey
+ //these values are found in resdefce.h
+ public static byte VK_LBUTTON = 0x01;
+ public static byte VK_RBUTTON = 0x02;
+ public static byte VK_CANCEL = 0x03;
+ public static byte VK_MBUTTON = 0x04;
+ public static byte VK_BACK = 0x08;
+ public static byte VK_TAB = 0x09;
+ public static byte VK_CLEAR = 0x0C;
+ public static byte VK_RETURN = 0x0D;
+ public static byte VK_SHIFT = 0x10;
+ public static byte VK_CONTROL = 0x11;
+ public static byte VK_MENU = 0x12;
+ public static byte VK_PAUSE = 0x13;
+ public static byte VK_CAPITAL = 0x14;
+ public static byte VK_ESCAPE = 0x1B;
+ public static byte VK_SPACE = 0x20;
+ public static byte VK_PRIOR = 0x21;
+ public static byte VK_NEXT = 0x22;
+ public static byte VK_END = 0x23;
+ public static byte VK_HOME = 0x24;
+ public static byte VK_LEFT = 0x25;
+ public static byte VK_UP = 0x26;
+ public static byte VK_RIGHT = 0x27;
+ public static byte VK_DOWN = 0x28;
+ public static byte VK_SELECT = 0x29;
+ public static byte VK_PRINT = 0x2A;
+ public static byte VK_EXECUTE = 0x2B;
+ public static byte VK_SNAPSHOT = 0x2C;
+ public static byte VK_INSERT = 0x2D;
+ public static byte VK_DELETE = 0x2E;
+ public static byte VK_HELP = 0x2F;
+ public static byte VK_NUMPAD0 = 0x60;
+ public static byte VK_NUMPAD1 = 0x61;
+ public static byte VK_NUMPAD2 = 0x62;
+ public static byte VK_NUMPAD3 = 0x63;
+ public static byte VK_NUMPAD4 = 0x64;
+ public static byte VK_NUMPAD5 = 0x65;
+ public static byte VK_NUMPAD6 = 0x66;
+ public static byte VK_NUMPAD7 = 0x67;
+ public static byte VK_NUMPAD8 = 0x68;
+ public static byte VK_NUMPAD9 = 0x69;
+ public static byte VK_MULTIPLY = 0x6A;
+ public static byte VK_ADD = 0x6B;
+ public static byte VK_SEPARATOR = 0x6C;
+ public static byte VK_SUBTRACT = 0x6D;
+ public static byte VK_DECIMAL = 0x6E;
+ public static byte VK_DIVIDE = 0x6F;
+ public static byte VK_F1 = 0x70;
+ public static byte VK_F2 = 0x71;
+ public static byte VK_F3 = 0x72;
+ public static byte VK_F4 = 0x73;
+ public static byte VK_F5 = 0x74;
+ public static byte VK_F6 = 0x75;
+ public static byte VK_F7 = 0x76;
+ public static byte VK_F8 = 0x77;
+ public static byte VK_F9 = 0x78;
+ public static byte VK_F10 = 0x79;
+ public static byte VK_F11 = 0x7A;
+ public static byte VK_F12 = 0x7B;
+ public static byte VK_F13 = 0x7C;
+ public static byte VK_F14 = 0x7D;
+ public static byte VK_F15 = 0x7E;
+ public static byte VK_F16 = 0x7F;
+ public static byte VK_F17 = 0x80;
+ public static byte VK_F18 = 0x81;
+ public static byte VK_F19 = 0x82;
+ public static byte VK_F20 = 0x83;
+ public static byte VK_F21 = 0x84;
+ public static byte VK_F22 = 0x85;
+ public static byte VK_F23 = 0x86;
+ public static byte VK_F24 = 0x87;
+ public static byte VK_NUMLOCK = 0x90;
+ public static byte VK_SCROLL = 0x91;
+ public static byte VK_LSHIFT = 0xA0;
+ public static byte VK_RSHIFT = 0xA1;
+ public static byte VK_LCONTROL = 0xA2;
+ public static byte VK_RCONTROL = 0xA3;
+ public static byte VK_LMENU = 0xA4;
+ public static byte VK_RMENU = 0xA5;
+
+ public static byte VK_PROCESSKEY = 0xE5;
+
+ public static byte VK_ATTN = 0xF6;
+ public static byte VK_CRSEL = 0xF7;
+ public static byte VK_EXSEL = 0xF8;
+ public static byte VK_EREOF = 0xF9;
+ public static byte VK_PLAY = 0xFA;
+ public static byte VK_ZOOM = 0xFB;
+ public static byte VK_NONAME = 0xFC;
+ public static byte VK_PA1 = 0xFD;
+ public static byte VK_OEM_CLEAR = 0xFE;
+ #endregion VirtualKey
+
public static int MOD_ALT = 0x0001;
public static int MOD_CONTROL = 0x0002;
public static int MOD_SHIFT = 0x0004;
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-07-30 00:09:11 UTC (rev 88)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-07-31 08:23:27 UTC (rev 89)
@@ -172,6 +172,10 @@
<SubType>Designer</SubType>
<DependentUpon>PingTest.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Sandbox\RegisterHotKeyTest.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>RegisterHotKeyTest.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Sandbox\SignalStrengthTest.resx">
<SubType>Designer</SubType>
<DependentUpon>SignalStrengthTest.cs</DependentUpon>
@@ -208,6 +212,10 @@
<SubType>Designer</SubType>
<DependentUpon>AlphaBlendTest.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="UI\Controls\AudioRecorderTest.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>AudioRecorderTest.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="UI\Controls\CalendarTest.resx">
<SubType>Designer</SubType>
<DependentUpon>CalendarTest.cs</DependentUpon>
@@ -421,6 +429,12 @@
<Compile Include="Sandbox\PingTest.Designer.cs">
<DependentUpon>PingTest.cs</DependentUpon>
</Compile>
+ <Compile Include="Sandbox\RegisterHotKeyTest.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Sandbox\RegisterHotKeyTest.Designer.cs">
+ <DependentUpon>RegisterHotKeyTest.cs</DependentUpon>
+ </Compile>
<Compile Include="Sandbox\SignalStrengthTest.cs">
<SubType>Form</SubType>
</Compile>
@@ -484,6 +498,12 @@
<Compile Include="UI\Controls\AlphaBlendTest.Designer.cs">
<DependentUpon>AlphaBlendTest.cs</DependentUpon>
</Compile>
+ <Compile Include="UI\Controls\AudioRecorderTest.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="UI\Controls\AudioRecorderTest.Designer.cs">
+ <DependentUpon>AudioRecorderTest.cs</DependentUpon>
+ </Compile>
<Compile Include="UI\Controls\CalendarTest.cs">
<SubType>Form</SubType>
</Compile>
Added: Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.Designer.cs
===================================================================
--- Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.Designer.cs (rev 0)
+++ Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.Designer.cs 2007-07-31 08:23:27 UTC (rev 89)
@@ -0,0 +1,89 @@
+namespace Roam.Test.Sandbox
+{
+ partial class RegisterHotKeyTest
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+ private System.Windows.Forms.MainMenu mainMenu1;
+
+ /// <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.mainMenu1 = new System.Windows.Forms.MainMenu();
+ this.menuItem1 = new System.Windows.Forms.MenuItem();
+ this.menuItem2 = new System.Windows.Forms.MenuItem();
+ this._menuItemRegisterHomekey = new System.Windows.Forms.MenuItem();
+ this._scrollableLabel = new Roam.UI.Controls.ScrollableLabel();
+ this.SuspendLayout();
+ //
+ // mainMenu1
+ //
+ this.mainMenu1.MenuItems.Add(this.menuItem1);
+ this.mainMenu1.MenuItems.Add(this.menuItem2);
+ //
+ // menuItem1
+ //
+ this.menuItem1.Text = "Exit";
+ this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
+ //
+ // menuItem2
+ //
+ this.menuItem2.MenuItems.Add(this._menuItemRegisterHomekey);
+ this.menuItem2.Text = "Menu";
+ //
+ // _menuItemRegisterHomekey
+ //
+ this._menuItemRegisterHomekey.Text = "Register Homekey";
+ this._menuItemRegisterHomekey.Click += new System.EventHandler(this._menuItemRegisterHomekey_Click);
+ //
+ // _scrollableLabel
+ //
+ this._scrollableLabel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this._scrollableLabel.Location = new System.Drawing.Point(0, 0);
+ this._scrollableLabel.Name = "_scrollableLabel";
+ this._scrollableLabel.Size = new System.Drawing.Size(240, 266);
+ this._scrollableLabel.TabIndex = 0;
+ this._scrollableLabel.Text = "scrollableLabel1";
+ //
+ // RegisterHotKeyTest
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(131F, 131F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.AutoScroll = true;
+ this.ClientSize = new System.Drawing.Size(240, 266);
+ this.Controls.Add(this._scrollableLabel);
+ this.Menu = this.mainMenu1;
+ this.Name = "RegisterHotKeyTest";
+ this.Text = "RegisterHotKeyTest";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuItem menuItem1;
+ private System.Windows.Forms.MenuItem menuItem2;
+ private System.Windows.Forms.MenuItem _menuItemRegisterHomekey;
+ private Roam.UI.Controls.ScrollableLabel _scrollableLabel;
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs
===================================================================
--- Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs (rev 0)
+++ Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.cs 2007-07-31 08:23:27 UTC (rev 89)
@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Microsoft.WindowsCE.Forms;
+using System.Runtime.InteropServices;
+
+namespace Roam.Test.Sandbox
+{
+ //http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=6f3656ec-b669-4a23-987a-a2455fbd2fc4
+ public partial class RegisterHotKeyTest : Form
+ {
+ private MessageWin _messageWin;
+
+ public RegisterHotKeyTest()
+ {
+ InitializeComponent();
+ _messageWin = new MessageWin();
+ _scrollableLabel.Clear();
+ }
+
+ private void _menuItemRegisterHomekey_Click(object sender, EventArgs e)
+ {
+ _menuItemRegisterHomekey.Checked = !_menuItemRegisterHomekey.Checked;
+ if (_menuItemRegisterHomekey.Checked)
+ {
+ _messageWin.HomeKeyPress += new EventHandler(_messageWin_HomeKeyPress);
+ }
+ else
+ {
+ _messageWin.HomeKeyPress -= new EventHandler(_messageWin_HomeKeyPress);
+ _messageWin.Dispose();
+ _messageWin = null;
+ }
+ }
+
+ void _messageWin_HomeKeyPress(object sender, EventArgs e)
+ {
+ _scrollableLabel.AddLine("HomeKeyPressed @ " + DateTime.Now);
+ }
+
+ private void menuItem1_Click(object sender, EventArgs e)
+ {
+ if (_messageWin != null)
+ {
+ _messageWin.HomeKeyPress -= new EventHandler(_messageWin_HomeKeyPress);
+ _messageWin.Dispose();
+ _messageWin = null;
+ }
+ this.Close();
+ }
+ }
+
+ public class MessageWin : MessageWindow
+ {
+ //event for client
+ public event System.EventHandler HomeKeyPress;
+
+ public MessageWin()
+ {
+ //register to listen for home key
+ RegisterHotKey(this.Hwnd, VK_LWIN, 8, VK_LWIN);
+ }
+
+ ~MessageWin()
+ {
+ UnregisterHotKey(this.Hwnd, VK_LWIN);
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ if (m.Msg == WM_HOTKEY)
+ {
+ if ((int)m.WParam == VK_LWIN)
+ //Raise event
+ if (HomeKeyPress != null)
+ HomeKeyPress(this, null);
+
+ }
+ base.WndProc(ref m);
+ }
+
+
+ #region P/Invokes
+ private const int VK_LWIN = 0x5B;
+ private const int WM_HOTKEY = 0x0312;
+ [DllImport("coredll.dll")]
+ public static extern bool RegisterHotKey(
+ IntPtr hWnd, // handle to window
+ int id, // hot key identifier
+ int Modifiers, // key-modifier options
+ int key //virtual-key code
+ );
+ [DllImport("coredll.dll")]
+ public static extern bool UnregisterHotKey(
+ IntPtr hWnd,
+ int id);
+ #endregion
+ }
+}
\ No newline at end of file
Added: Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.resx
===================================================================
--- Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.resx (rev 0)
+++ Trunk/Source/Roam.Test/Sandbox/RegisterHotKeyTest.resx 2007-07-31 08:23:27 UTC (rev 89)
@@ -0,0 +1,129 @@
+<?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>
+ <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
+ <value>Smartphone QVGA</value>
+ </metadata>
+ <metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+</root>
\ No newline at end of file
Modified: Trunk/Source/Roam.UI/Controls/AudioRecorder.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/AudioRecorder.cs 2007-07-30 00:09:11 UTC (rev 88)
+++ Trunk/Source/Roam.UI/Controls/AudioRecorder.cs 2007-07-31 08:23:27 UTC (rev 89)
@@ -96,14 +96,14 @@
this.imageListBox1.ItemClicked += new EventHandler<VisualItemEventArgs>(OnAudioItemClicked);
//jeffixme these are temp graphics
- bitmap = new Bitmap(@"\Program Files\testphone\MediaRecord48x48.png");
- //imageItem = new ImageItem("Record", bitmap);
+ bitmap = new Bitmap(@"\Storage Card\MediaRecord48x48.png");
+ imageItem = new BitmapItem(bitmap, "Record");
imageItem.TextAlign = RelativeAlignment.Below;
imageListBox1.Items.Add(imageItem);
//jeffixme these are temp graphics
- bitmap = new Bitmap(@"\Program Files\testphone\MediaPlay48x48.png");
- //imageItem = new ImageItem("Play", bitmap);
+ bitmap = new Bitmap(@"\Storage Card\MediaPlay48x48.png");
+ imageItem = new BitmapItem(bitmap, "Play");
imageItem.TextAlign = RelativeAlignment.Below;
imageItem.Enabled = false;
imageListBox1.Items.Add(imageItem);
@@ -297,7 +297,7 @@
//jeffixme these are temp graphics
ImageItem imageItem = (ImageItem)imageListBox1.GetItemWithText("Pause").VisualItem;
- //imageItem.Image = new Bitmap(@"\Program Files\testphone\MediaPlay48x48.png");
+ imageItem.Image = new Bitmap(@"\Storage Card\MediaPlay48x48.png");
imageItem.Item = "Play";
EnableItem(0, true);
imageListBox1.Refresh();
@@ -373,7 +373,7 @@
OnRecordingStarted();
//jeffixme these are temp graphics
- //imageItem.Image = new Bitmap(@"\Program Files\testphone\MediaStop48x48.png");
+ imageItem.Image = new Bitmap(@"\Storage Card\MediaStop48x48.png");
imageItem.Item = "Stop";
imageListBox1.Refresh();
}
@@ -382,7 +382,7 @@
_recorder.Stop();
//jeffixme these are temp graphics
- //imageItem.Image = new Bitmap(@"\Program Files\testphone\MediaRecord48x48.png");
+ imageItem.Image = new Bitmap(@"\Storage Card\MediaRecord48x48.png");
imageItem.Item = "Record";
EnableItem("Play", true);
@@ -406,7 +406,7 @@
EnableItem("Record", false);
//jeffixme these are temp graphics
- //imageItem.Image = new Bitmap(@"\Program Files\testphone\MediaPause48x48.png");
+ imageItem.Image = new Bitmap(@"\Storage Card\MediaPause48x48.png");
imageItem.Item = "Pause";
imageListBox1.Refresh();
@@ -419,7 +419,7 @@
EnableItem("Record", true);
//jeffixme these are temp graphics
- //imageItem.Image = new Bitmap(@"\Program Files\testphone\MediaPlay48x48.png");
+ imageItem.Image = new Bitmap(@"\Storage Card\MediaPlay48x48.png");
imageItem.Item = "Play";
imageListBox1.Refresh();
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|