From a4bda48c6c4534c4820eac9b774e3e1dda932e8f Mon Sep 17 00:00:00 2001 From: Philipp Sumi Date: Mon, 21 Sep 2009 19:20:41 +0000 Subject: [PATCH] WPF NotifyIcon -------------- FIX If a popup is opened, its window handle is now being set as the foreground. This fixes an issue with certain controls being disabled on popups. (thanks Andrew Smith for pointing me in the right direction!). FIX Changed dispatcher access in order to work in WinForms scenarios, too. ADD Added WinForms sample. git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@118 9f600761-6f11-4665-b6dc-0185e9171623 --- Source/Changelog.txt | 11 ++ Source/NotifyIconWpf.sln | 6 + .../Interop/NotifyIconVersion.cs | 7 +- Source/NotifyIconWpf/NotifyIconWpf.csproj | 11 -- .../NotifyIconWpf/Properties/AssemblyInfo.cs | 4 +- .../Properties/Settings.Designer.cs | 26 ---- .../Properties/Settings.settings | 7 - Source/NotifyIconWpf/TaskbarIcon.cs | 36 +++-- Source/NotifyIconWpf/Util.cs | 51 +++---- Source/Sample Project/Main.xaml | 2 +- .../03 - Popups/InlinePopupWindow.xaml | 69 ++++++---- Source/WindowsFormsSample/FancyPopup.xaml | 115 ++++++++++++++++ Source/WindowsFormsSample/FancyPopup.xaml.cs | 46 +++++++ Source/WindowsFormsSample/Form1.Designer.cs | 62 +++++++++ Source/WindowsFormsSample/Form1.cs | 33 +++++ Source/WindowsFormsSample/Form1.resx | 120 +++++++++++++++++ Source/WindowsFormsSample/Icon/Led.ico | Bin 0 -> 1150 bytes .../WindowsFormsSample/Images/Preferences.png | Bin 0 -> 7825 bytes Source/WindowsFormsSample/Program.cs | 21 +++ .../Properties/AssemblyInfo.cs | 36 +++++ .../Properties/Resources.Designer.cs | 70 ++++++++++ .../Properties/Resources.resx | 124 ++++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ .../Properties/Settings.settings | 7 + .../WindowsFormsSample.csproj | 124 ++++++++++++++++++ 25 files changed, 906 insertions(+), 112 deletions(-) delete mode 100644 Source/NotifyIconWpf/Properties/Settings.Designer.cs delete mode 100644 Source/NotifyIconWpf/Properties/Settings.settings create mode 100644 Source/WindowsFormsSample/FancyPopup.xaml create mode 100644 Source/WindowsFormsSample/FancyPopup.xaml.cs create mode 100644 Source/WindowsFormsSample/Form1.Designer.cs create mode 100644 Source/WindowsFormsSample/Form1.cs create mode 100644 Source/WindowsFormsSample/Form1.resx create mode 100644 Source/WindowsFormsSample/Icon/Led.ico create mode 100644 Source/WindowsFormsSample/Images/Preferences.png create mode 100644 Source/WindowsFormsSample/Program.cs create mode 100644 Source/WindowsFormsSample/Properties/AssemblyInfo.cs create mode 100644 Source/WindowsFormsSample/Properties/Resources.Designer.cs create mode 100644 Source/WindowsFormsSample/Properties/Resources.resx create mode 100644 Source/WindowsFormsSample/Properties/Settings.Designer.cs create mode 100644 Source/WindowsFormsSample/Properties/Settings.settings create mode 100644 Source/WindowsFormsSample/WindowsFormsSample.csproj diff --git a/Source/Changelog.txt b/Source/Changelog.txt index 20d54e2..e6c2c8e 100644 --- a/Source/Changelog.txt +++ b/Source/Changelog.txt @@ -3,6 +3,17 @@ Copyright (c) 2009 Philipp Sumi Contact and Information: http://www.hardcodet.net +---------------------------------------------------------------------------- + +1.0.4 (2009.09.21) +***** + +FIX If a popup is opened, its window handle is now being set as the foreground. + This fixes an issue with certain controls being disabled on popups. + (thanks Andrew Smith for pointing me in the right direction!). +FIX Changed dispatcher access in order to work in WinForms scenarios, too. + + ---------------------------------------------------------------------------- 1.0.3 (2009.07.02) diff --git a/Source/NotifyIconWpf.sln b/Source/NotifyIconWpf.sln index 84d90fa..51e22bb 100644 --- a/Source/NotifyIconWpf.sln +++ b/Source/NotifyIconWpf.sln @@ -10,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Changelog.txt = Changelog.txt EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsSample", "WindowsFormsSample\WindowsFormsSample.csproj", "{F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -24,6 +26,10 @@ Global {71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Debug|Any CPU.Build.0 = Debug|Any CPU {71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Release|Any CPU.ActiveCfg = Release|Any CPU {71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Release|Any CPU.Build.0 = Release|Any CPU + {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs b/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs index daf2d60..5947c59 100644 --- a/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs +++ b/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Hardcodet.Wpf.TaskbarNotification.Interop +namespace Hardcodet.Wpf.TaskbarNotification.Interop { /// /// The notify icon version that is used. The higher diff --git a/Source/NotifyIconWpf/NotifyIconWpf.csproj b/Source/NotifyIconWpf/NotifyIconWpf.csproj index e7b3757..19ac8f1 100644 --- a/Source/NotifyIconWpf/NotifyIconWpf.csproj +++ b/Source/NotifyIconWpf/NotifyIconWpf.csproj @@ -40,9 +40,7 @@ 3.5 - - @@ -73,11 +71,6 @@ True Resources.resx - - True - Settings.settings - True - @@ -86,10 +79,6 @@ Resources.Designer.cs - - SettingsSingleFileGenerator - Settings.Designer.cs - diff --git a/Source/NotifyIconWpf/Properties/AssemblyInfo.cs b/Source/NotifyIconWpf/Properties/AssemblyInfo.cs index 6cb610e..9dcc92f 100644 --- a/Source/NotifyIconWpf/Properties/AssemblyInfo.cs +++ b/Source/NotifyIconWpf/Properties/AssemblyInfo.cs @@ -53,5 +53,5 @@ using System.Windows.Markup; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.3.0")] -[assembly: AssemblyFileVersion("1.0.3.0")] +[assembly: AssemblyVersion("1.0.4.0")] +[assembly: AssemblyFileVersion("1.0.4.0")] diff --git a/Source/NotifyIconWpf/Properties/Settings.Designer.cs b/Source/NotifyIconWpf/Properties/Settings.Designer.cs deleted file mode 100644 index b9cf0e1..0000000 --- a/Source/NotifyIconWpf/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3053 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Hardcodet.Wpf.TaskbarNotification.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Source/NotifyIconWpf/Properties/Settings.settings b/Source/NotifyIconWpf/Properties/Settings.settings deleted file mode 100644 index 8f2fd95..0000000 --- a/Source/NotifyIconWpf/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Source/NotifyIconWpf/TaskbarIcon.cs b/Source/NotifyIconWpf/TaskbarIcon.cs index b04a336..866dbfb 100644 --- a/Source/NotifyIconWpf/TaskbarIcon.cs +++ b/Source/NotifyIconWpf/TaskbarIcon.cs @@ -30,7 +30,7 @@ using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; -using System.Windows.Data; +using System.Windows.Interop; using System.Windows.Threading; using Hardcodet.Wpf.TaskbarNotification.Interop; using Point=Hardcodet.Wpf.TaskbarNotification.Interop.Point; @@ -162,10 +162,11 @@ namespace Hardcodet.Wpf.TaskbarNotification /// is a null reference. public void ShowCustomBalloon(UIElement balloon, PopupAnimation animation, int? timeout) { - if (!Application.Current.Dispatcher.CheckAccess()) + Dispatcher dispatcher = this.GetDispatcher(); + if (!dispatcher.CheckAccess()) { var action = new Action(() => ShowCustomBalloon(balloon, animation, timeout)); - Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, action); + dispatcher.Invoke(DispatcherPriority.Normal, action); return; } @@ -229,8 +230,6 @@ namespace Hardcodet.Wpf.TaskbarNotification //register timer to close the popup balloonCloseTimer.Change(timeout.Value, Timeout.Infinite); } - - return; } @@ -261,10 +260,11 @@ namespace Hardcodet.Wpf.TaskbarNotification { if (IsDisposed) return; - if (!Application.Current.Dispatcher.CheckAccess()) + Dispatcher dispatcher = this.GetDispatcher(); + if (!dispatcher.CheckAccess()) { Action action = CloseBalloon; - Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, action); + dispatcher.Invoke(DispatcherPriority.Normal, action); return; } @@ -310,7 +310,7 @@ namespace Hardcodet.Wpf.TaskbarNotification //switch to UI thread Action action = CloseBalloon; - Application.Current.Dispatcher.Invoke(action); + this.GetDispatcher().Invoke(action); } #endregion @@ -637,9 +637,21 @@ namespace Hardcodet.Wpf.TaskbarNotification //open popup TrayPopupResolved.IsOpen = true; - //activate the message window to track deactivation - otherwise, the context menu - //does not close if the user clicks somewhere else - WinApi.SetForegroundWindow(messageSink.MessageWindowHandle); + + IntPtr handle = IntPtr.Zero; + if (TrayPopupResolved.Child != null) + { + //try to get a handle on the popup itself (via its child) + HwndSource source = (HwndSource)PresentationSource.FromVisual(TrayPopupResolved.Child); + if (source != null) handle = source.Handle; + } + + //if we don't have a handle for the popup, fall back to the message sink + if (handle == IntPtr.Zero) handle = messageSink.MessageWindowHandle; + + //activate either popup or message sink to track deactivation. + //otherwise, the popup does not close if the user clicks somewhere else + WinApi.SetForegroundWindow(handle); //raise attached event - item should never be null unless developers //changed the CustomPopup directly... @@ -797,7 +809,7 @@ namespace Hardcodet.Wpf.TaskbarNotification delayedTimerAction = null; //switch to UI thread - Application.Current.Dispatcher.Invoke(action); + this.GetDispatcher().Invoke(action); } } diff --git a/Source/NotifyIconWpf/Util.cs b/Source/NotifyIconWpf/Util.cs index 771287d..75b46b0 100644 --- a/Source/NotifyIconWpf/Util.cs +++ b/Source/NotifyIconWpf/Util.cs @@ -22,7 +22,6 @@ // THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE - using System; using System.ComponentModel; using System.Drawing; @@ -30,6 +29,7 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Windows.Resources; +using System.Windows.Threading; using Hardcodet.Wpf.TaskbarNotification.Interop; namespace Hardcodet.Wpf.TaskbarNotification @@ -41,7 +41,6 @@ namespace Hardcodet.Wpf.TaskbarNotification { public static readonly object SyncRoot = new object(); - #region IsDesignMode private static readonly bool isDesignMode; @@ -56,19 +55,18 @@ namespace Hardcodet.Wpf.TaskbarNotification #endregion - #region construction static Util() { isDesignMode = - (bool)DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)) - .Metadata.DefaultValue; + (bool) + DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof (FrameworkElement)) + .Metadata.DefaultValue; } #endregion - #region CreateHelperWindow /// @@ -80,19 +78,18 @@ namespace Hardcodet.Wpf.TaskbarNotification public static Window CreateHelperWindow() { return new Window - { - Width = 0, - Height = 0, - ShowInTaskbar = false, - WindowStyle = WindowStyle.None, - AllowsTransparency = true, - Opacity = 0 - }; + { + Width = 0, + Height = 0, + ShowInTaskbar = false, + WindowStyle = WindowStyle.None, + AllowsTransparency = true, + Opacity = 0 + }; } #endregion - #region WriteIconData /// @@ -133,7 +130,6 @@ namespace Hardcodet.Wpf.TaskbarNotification #endregion - #region GetBalloonFlag /// @@ -159,7 +155,6 @@ namespace Hardcodet.Wpf.TaskbarNotification #endregion - #region ImageSource to Icon /// @@ -188,7 +183,6 @@ namespace Hardcodet.Wpf.TaskbarNotification #endregion - #region evaluate listings /// @@ -219,7 +213,6 @@ namespace Hardcodet.Wpf.TaskbarNotification #endregion - #region match MouseEvent to PopupActivation /// @@ -252,7 +245,6 @@ namespace Hardcodet.Wpf.TaskbarNotification #endregion - #region execute command /// @@ -281,6 +273,22 @@ namespace Hardcodet.Wpf.TaskbarNotification #endregion + /// + /// Returns a dispatcher for multi-threaded scenarios + /// + /// + internal static Dispatcher GetDispatcher(this DispatcherObject source) + { + //use the application's dispatcher by default + if (Application.Current != null) return Application.Current.Dispatcher; + + //fallback for WinForms environments + if (source.Dispatcher != null) return source.Dispatcher; + + //ultimatively use the thread's dispatcher + return Dispatcher.CurrentDispatcher; + } + /// /// Checks whether the @@ -296,6 +304,5 @@ namespace Hardcodet.Wpf.TaskbarNotification if (element == null) throw new ArgumentNullException("element"); return element.GetBindingExpression(FrameworkElement.DataContextProperty) != null; } - } -} +} \ No newline at end of file diff --git a/Source/Sample Project/Main.xaml b/Source/Sample Project/Main.xaml index 1a3ca52..0d17808 100644 --- a/Source/Sample Project/Main.xaml +++ b/Source/Sample Project/Main.xaml @@ -31,7 +31,7 @@ FontStyle="Italic" FontWeight="Bold" TextWrapping="Wrap"> + Text="WPF NotifyIcon 1.0.4 - Samples" /> + + + + + + + + diff --git a/Source/WindowsFormsSample/FancyPopup.xaml.cs b/Source/WindowsFormsSample/FancyPopup.xaml.cs new file mode 100644 index 0000000..c50f34f --- /dev/null +++ b/Source/WindowsFormsSample/FancyPopup.xaml.cs @@ -0,0 +1,46 @@ +using System.Windows; +using System.Windows.Controls; + +namespace Samples +{ + /// + /// Interaction logic for FancyPopup.xaml + /// + public partial class FancyPopup : UserControl + { + #region ClickCount dependency property + + /// + /// The number of clicks on the popup button. + /// + public static readonly DependencyProperty ClickCountProperty = + DependencyProperty.Register("ClickCount", + typeof (int), + typeof (FancyPopup), + new FrameworkPropertyMetadata(0)); + + /// + /// A property wrapper for the + /// dependency property:
+ /// The number of clicks on the popup button. + ///
+ public int ClickCount + { + get { return (int) GetValue(ClickCountProperty); } + set { SetValue(ClickCountProperty, value); } + } + + #endregion + + public FancyPopup() + { + InitializeComponent(); + } + + private void OnButtonClick(object sender, RoutedEventArgs e) + { + //just increment a counter - will be displayed on screen + ClickCount++; + } + } +} \ No newline at end of file diff --git a/Source/WindowsFormsSample/Form1.Designer.cs b/Source/WindowsFormsSample/Form1.Designer.cs new file mode 100644 index 0000000..eaab61d --- /dev/null +++ b/Source/WindowsFormsSample/Form1.Designer.cs @@ -0,0 +1,62 @@ +namespace WindowsFormsSample +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(32, 25); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(408, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Click on the red LED icon in the taskbar to display an interactive WPF Popup cont" + + "rol."; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(488, 264); + this.Controls.Add(this.label1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} + diff --git a/Source/WindowsFormsSample/Form1.cs b/Source/WindowsFormsSample/Form1.cs new file mode 100644 index 0000000..0689ff2 --- /dev/null +++ b/Source/WindowsFormsSample/Form1.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Forms; +using Hardcodet.Wpf.TaskbarNotification; +using Samples; +using WindowsFormsSample.Properties; + +namespace WindowsFormsSample +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + TaskbarIcon tb = new TaskbarIcon(); + tb.Icon = Resources.Led; + tb.Visibility = Visibility.Visible; + + tb.TrayPopup = new FancyPopup(); + } + } +} diff --git a/Source/WindowsFormsSample/Form1.resx b/Source/WindowsFormsSample/Form1.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/Source/WindowsFormsSample/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Source/WindowsFormsSample/Icon/Led.ico b/Source/WindowsFormsSample/Icon/Led.ico new file mode 100644 index 0000000000000000000000000000000000000000..8a8bbafa87909fb28ea0375bf2347fa3d3768d26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x(1Rh;r%_|4QAlL zgqU$*@3&N_t|;X`UN=f2l~^_TI1bdgJ~A;e>D+D6fY`*dbEWk5UhI`9p2?(Yya%IP z#_PsLMn-^4cQv8lXfBn3_BiF*y}I$bb!8O|Cp$ZVRv_bfu9-%0L(VBptLSHmUamqF z;3q>iH#QV>Ay<`gi4kiq9}fALQ!j%66Z&(m0}1&k0Y@ zcRGt6zD@q(n2|VMC;G{}exuk!y2VR@s3Rq>pfKfsythK>kts@ir`_}Qd5r^Ll$WG+ z^GQyb#rymFmgnSxl)vv~U#wc=XahjW?@ETOE!ai>mfEjU=!ZBuSzB9sSzCVy!ACPn zO?viTGcPMETLa8{F96m+AdA6!*k)Hv$bX&NK9mk^X+y{uFfB~fI!ar>XghM{14g)* zVpP}H*AL7v-2juRCtthwvZbJ49tzi|@!r)b*eZE}OJFODa2b%>%3EerWVAj7vJ^bf z|FVJT>7-|M)yeVV{479!v``e(r>m{41{&B{6SCqR;^$2Ix!h3gF|daKZNJe|usI7> zjJsdZQ}wJ@)^(iw3lw#GAmguk7-e8pZg1ZE1-D@xij2>$0f*!t1(ra3T<5B1TWn(y zQ-H6=RdT$Io@@6{ zgI|y5NzBArKtp?9+Qnde9639wUh4>4e)hv*&zmSg@Zv(!#8)Dn>BCw>|faMnd;5(D%Rh>e;PmKG1b=f(Rfg)VN;WD>q1T ztW^{~>hs1tu7l#v%;ZOt_S5KdPKg9AiwYT#c&Hc1xUpUQ`Mq*UxLYi~pZhzFPyNqK e_Z%*j3ugJkm?&CG8KkMMtA + /// The main entry point for the application. + ///
+ [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Source/WindowsFormsSample/Properties/AssemblyInfo.cs b/Source/WindowsFormsSample/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b32abd5 --- /dev/null +++ b/Source/WindowsFormsSample/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("WindowsFormsSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("WindowsFormsSample")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] +[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("072bbfa0-9b8b-48df-bf88-3e4806b3e3e8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/WindowsFormsSample/Properties/Resources.Designer.cs b/Source/WindowsFormsSample/Properties/Resources.Designer.cs new file mode 100644 index 0000000..47cb61f --- /dev/null +++ b/Source/WindowsFormsSample/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3074 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsSample.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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("WindowsFormsSample.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Icon Led { + get { + object obj = ResourceManager.GetObject("Led", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + } +} diff --git a/Source/WindowsFormsSample/Properties/Resources.resx b/Source/WindowsFormsSample/Properties/Resources.resx new file mode 100644 index 0000000..4c8eec3 --- /dev/null +++ b/Source/WindowsFormsSample/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\icon\led.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Source/WindowsFormsSample/Properties/Settings.Designer.cs b/Source/WindowsFormsSample/Properties/Settings.Designer.cs new file mode 100644 index 0000000..12508d3 --- /dev/null +++ b/Source/WindowsFormsSample/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3074 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsSample.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Source/WindowsFormsSample/Properties/Settings.settings b/Source/WindowsFormsSample/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/Source/WindowsFormsSample/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Source/WindowsFormsSample/WindowsFormsSample.csproj b/Source/WindowsFormsSample/WindowsFormsSample.csproj new file mode 100644 index 0000000..6e5677f --- /dev/null +++ b/Source/WindowsFormsSample/WindowsFormsSample.csproj @@ -0,0 +1,124 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8} + WinExe + Properties + WindowsFormsSample + WindowsFormsSample + v3.5 + 512 + WindowsFormsSample.Program + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + 3.0 + + + 3.0 + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + 3.0 + + + 3.0 + + + + + FancyPopup.xaml + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + MSBuild:Compile + Designer + + + + + + + + {7AC63864-7638-41C4-969C-D3197EF2BED9} + NotifyIconWpf + + + + + + + + \ No newline at end of file