[Roam-commit] SF.net SVN: roam: [114] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2008-02-11 18:30:07
|
Revision: 114
http://roam.svn.sourceforge.net/roam/?rev=114&view=rev
Author: jonfroehlich
Date: 2008-02-11 10:29:59 -0800 (Mon, 11 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
Trunk/Source/Roam.Test/MainForm.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.Test/UI/Controls/WallpaperTest.cs
Trunk/Source/Roam.UI/Utils/DesktopUtils.cs
Trunk/Source/Roam.UI/Utils/ScreenUtils.cs
Modified: Trunk/Source/Roam.Test/MainForm.cs
===================================================================
--- Trunk/Source/Roam.Test/MainForm.cs 2008-02-09 11:59:17 UTC (rev 113)
+++ Trunk/Source/Roam.Test/MainForm.cs 2008-02-11 18:29:59 UTC (rev 114)
@@ -115,13 +115,16 @@
{
Cursor.Current = Cursors.WaitCursor;
ListItem listItem = (ListItem)_keyFilteredListBox.SelectedItem;
- ComboBoxTypeItem selectedCti = (ComboBoxTypeItem)listItem.Item;
- _currentForm = (Form)Activator.CreateInstance(selectedCti.Type);
- Cursor.Current = Cursors.Default;
- _currentForm.ShowDialog();
- _currentForm = null;
- this.Activate();
- e.Handled = true;
+ if (listItem != null)
+ {
+ ComboBoxTypeItem selectedCti = (ComboBoxTypeItem)listItem.Item;
+ _currentForm = (Form)Activator.CreateInstance(selectedCti.Type);
+ Cursor.Current = Cursors.Default;
+ _currentForm.ShowDialog();
+ _currentForm = null;
+ this.Activate();
+ e.Handled = true;
+ }
}
}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2008-02-09 11:59:17 UTC (rev 113)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2008-02-11 18:29:59 UTC (rev 114)
@@ -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.Test/UI/Controls/WallpaperTest.cs
===================================================================
--- Trunk/Source/Roam.Test/UI/Controls/WallpaperTest.cs 2008-02-09 11:59:17 UTC (rev 113)
+++ Trunk/Source/Roam.Test/UI/Controls/WallpaperTest.cs 2008-02-11 18:29:59 UTC (rev 114)
@@ -23,6 +23,7 @@
using Roam.Utils;
using Microsoft.Win32;
using Roam.UI.Utils;
+using OpenNETCF.WindowsCE;
namespace Roam.Test.UI.Controls
{
@@ -40,9 +41,19 @@
public WallpaperTest()
{
InitializeComponent();
- string [] files = Directory.GetFiles(@"\Windows\", "*.bmp");
- foreach (string filename in files)
+
+ if (Directory.Exists(@"\My Documents\My Pictures"))
{
+ string[] files = Directory.GetFiles(@"\My Documents\My Pictures", "*.jpg");
+ foreach (string filename in files)
+ {
+ comboBox1.Items.Add(filename);
+ }
+ }
+
+ string [] files2 = Directory.GetFiles(@"\Windows\", "*.bmp");
+ foreach (string filename in files2)
+ {
comboBox1.Items.Add(filename);
}
comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged);
@@ -72,9 +83,19 @@
private void menuItem4_Click(object sender, EventArgs e)
{
- string imgPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\ControlPanel\Home", "CurBgImageName", null);
- if (imgPath != null)
+ string imgPath = string.Empty;
+
+ if (DeviceManagement.PlatformName.IndexOf("SmartPhone") != -1)
{
+ imgPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\ControlPanel\Home", "BgImage", null);
+ }
+ else
+ {
+ imgPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Today", "Wall", null);
+ }
+
+ if (!string.IsNullOrEmpty(imgPath))
+ {
pictureBox2.Image = new Bitmap(imgPath);
}
}
Modified: Trunk/Source/Roam.UI/Utils/DesktopUtils.cs
===================================================================
--- Trunk/Source/Roam.UI/Utils/DesktopUtils.cs 2008-02-09 11:59:17 UTC (rev 113)
+++ Trunk/Source/Roam.UI/Utils/DesktopUtils.cs 2008-02-11 18:29:59 UTC (rev 114)
@@ -66,6 +66,8 @@
/// </summary>
public static readonly int SPI_SETDESKWALLPAPER = 20;
+ public static readonly int SPI_SETDESKWALLPAPER_POCKETPC = 0x00F2;
+
public static void SetWallpaper(Image image, string tempFilePath)
{
if (File.Exists(tempFilePath)) { File.Delete(tempFilePath); }
@@ -89,10 +91,15 @@
}
else
{
- //TODO fix this so that it works on Pocket PC and Pocket PC Phone
+ //these are special hidden system file names for the background
File.Copy(imageFile, @"\Windows\stwater_240_320.jpg", true);
File.Copy(imageFile, @"\Windows\stwater_320_240.jpg", true);
- Win32Window.SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
+
+ // Update registry
+ Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Today", "Wall", imageFile);//@"\Windows\stwater_240_320.jpg");
+
+ Win32Window.SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, SPI_SETDESKWALLPAPER_POCKETPC, 0);
+ //Win32Window.SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, SPI_SETDESKWALLPAPER, 0);
}
}
@@ -116,10 +123,15 @@
}
else
{
- //TODO fix this so that it works on Pocket PC and Pocket PC Phone
+ //these are special hidden system file names for the background
File.Copy(imageFile240x320, @"\Windows\stwater_240_320.jpg", true);
File.Copy(imageFile320x240, @"\Windows\stwater_320_240.jpg", true);
- Win32Window.SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
+
+ // Update registry
+ Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Today", "Wall", @"\Windows\stwater_240_320.jpg");
+
+ Win32Window.SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, SPI_SETDESKWALLPAPER_POCKETPC, 0);
+ //Win32Window.SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, SPI_SETDESKWALLPAPER, 0);
}
}
Modified: Trunk/Source/Roam.UI/Utils/ScreenUtils.cs
===================================================================
--- Trunk/Source/Roam.UI/Utils/ScreenUtils.cs 2008-02-09 11:59:17 UTC (rev 113)
+++ Trunk/Source/Roam.UI/Utils/ScreenUtils.cs 2008-02-11 18:29:59 UTC (rev 114)
@@ -16,6 +16,7 @@
using System.Collections.Generic;
using System.Text;
using System.Drawing;
+using System.Windows.Forms;
namespace Roam.UI.Utils
{
@@ -28,6 +29,12 @@
/// <author>Jon Froehlich</author>
public static class ScreenUtils
{
+ public static ScreenOrientation GetScreenOrientation()
+ {
+ return Screen.PrimaryScreen.Bounds.Width > Screen.PrimaryScreen.Bounds.Height ?
+ ScreenOrientation.Landscape : ScreenOrientation.Portrait;
+ }
+
public static Size GetScreenSize()
{
int width = DrawingUtils.GetSystemMetrics(ScreenMetrics.SM_CXSCREEN);
@@ -53,4 +60,10 @@
return bitmap;
}
}
+
+ public enum ScreenOrientation
+ {
+ Portrait,
+ Landscape
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|