From d5ee47001871c5887f7dfb1f92948b6aedcc105c Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Fri, 2 May 2014 17:24:53 -0400 Subject: [PATCH] Add implementation --- .gitattributes | 63 +++++++++++ .gitignore | 155 +++++++++++++++++++++++++++ App.config | 30 ++++++ App.xaml | 7 ++ App.xaml.cs | 23 ++++ Properties/AssemblyInfo.cs | 55 ++++++++++ Properties/Resources.Designer.cs | 136 +++++++++++++++++++++++ Properties/Resources.resx | 145 +++++++++++++++++++++++++ Properties/Settings.Designer.cs | 86 +++++++++++++++ Properties/Settings.settings | 21 ++++ Resources/ApplicationIcon.ico | Bin 0 -> 67646 bytes SystemTemperatureStatusWindow.csproj | 106 ++++++++++++++++++ SystemTemperatureStatusWindow.sln | 28 +++++ WindowSource.cs | 146 +++++++++++++++++++++++++ 14 files changed, 1001 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 App.config create mode 100644 App.xaml create mode 100644 App.xaml.cs create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Properties/Resources.Designer.cs create mode 100644 Properties/Resources.resx create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings create mode 100644 Resources/ApplicationIcon.ico create mode 100644 SystemTemperatureStatusWindow.csproj create mode 100644 SystemTemperatureStatusWindow.sln create mode 100644 WindowSource.cs diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..abd2844 --- /dev/null +++ b/.gitignore @@ -0,0 +1,155 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets +!packages/*/build/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# NuGet Packages Directory +packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store diff --git a/App.config b/App.config new file mode 100644 index 0000000..fa7cfbf --- /dev/null +++ b/App.config @@ -0,0 +1,30 @@ + + + + +
+ + + + + + + + + + + + 5000 + + + True + + + 60 + + + 80 + + + + \ No newline at end of file diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..4314d94 --- /dev/null +++ b/App.xaml @@ -0,0 +1,7 @@ + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..1186400 --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,23 @@ +using System.Windows; + +namespace SystemTemperatureStatusWindow +{ + public partial class App + { + private WindowSource _windowSource; + + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + + _windowSource = new WindowSource(); + } + + protected override void OnExit(ExitEventArgs e) + { + _windowSource.Dispose(); + + base.OnExit(e); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3678f36 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("SystemTemperatureStatusWindow")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SystemTemperatureStatusWindow")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..47c1d7d --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,136 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34014 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SystemTemperatureStatusWindow.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", "4.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("SystemTemperatureStatusWindow.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; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon ApplicationIcon { + get { + object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized string similar to CPU. + /// + internal static string CPU { + get { + return ResourceManager.GetString("CPU", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}: <font color='{2}'>{1:f1}{3}</font>. + /// + internal static string DisplayLineTemplate { + get { + return ResourceManager.GetString("DisplayLineTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to GPU. + /// + internal static string GPU { + get { + return ResourceManager.GetString("GPU", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HD{0}. + /// + internal static string HD { + get { + return ResourceManager.GetString("HD", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Loading.... + /// + internal static string Loading { + get { + return ResourceManager.GetString("Loading", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to °C. + /// + internal static string SuffixC { + get { + return ResourceManager.GetString("SuffixC", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to °F. + /// + internal static string SuffixF { + get { + return ResourceManager.GetString("SuffixF", resourceCulture); + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..3776afa --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\ApplicationIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + CPU + + + {0}: <font color='{2}'>{1:f1}{3}</font> + + + GPU + + + HD{0} + + + Loading... + + + °C + + + °F + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c9d4cbe --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34014 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SystemTemperatureStatusWindow.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.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; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string WindowSettings { + get { + return ((string)(this["WindowSettings"])); + } + set { + this["WindowSettings"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("5000")] + public int UpdateInterval { + get { + return ((int)(this["UpdateInterval"])); + } + set { + this["UpdateInterval"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool DisplayF { + get { + return ((bool)(this["DisplayF"])); + } + set { + this["DisplayF"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("60")] + public int WarningLevel { + get { + return ((int)(this["WarningLevel"])); + } + set { + this["WarningLevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("80")] + public int AlertLevel { + get { + return ((int)(this["AlertLevel"])); + } + set { + this["AlertLevel"] = value; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..58ac33a --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,21 @@ + + + + + + + + + 5000 + + + True + + + 60 + + + 80 + + + \ No newline at end of file diff --git a/Resources/ApplicationIcon.ico b/Resources/ApplicationIcon.ico new file mode 100644 index 0000000000000000000000000000000000000000..b7d7601dd14bd8b5b5878823be84b50d709905b1 GIT binary patch literal 67646 zcmeI52Yi*)`NuB=0R;sW7h-X=iVFv_ss*)5MJw)wtB&HRqyF6!s&&;>tX5R&w#8~y zaMw{47Z6B762gW+2qR&msEFtP`=0wg$;oSO2858njh~lf1Zc_Ao(Eu|MVG1pMmrlNS}f98AzXj^chH> zf%F+jpMmrlSmQHr$RUR$x_0fF_~kEu*<5NT?bx$t&kj9$^w?3_rhE79n@S0k{@HNO zz`+L}oRFGGJ4ok>`_s~Bv7aT)7W-LJwz$94ty{Nir7r3xo2pG5bkIQ?&WYFv{}OCo zYAKyA_FqWfioFweFL8HB?45X{)nY$S+=odgb?MTjozz6y2+v;Q{*xp2t=0ZX+?PnM z8um`?ow$36`3h;|fd?M=#{&*HU^l6m)VNQ|M)K`p|Epj9Dnsq{;{MGVuy*tv7(swsO8+#RGZ3+FsrH3BWbee?OYEJPuaN$?&p!KHw)ft9?;>SL4d*0m#NQ<1e}LLK zwH)tL*?pWn{GHgN@5OzBbk|;c?bT(^J@;%WZNz7P{r~A=&K!S$w5p0YKOXC?3415* zUSj{FxED*$b?VgVm_7E`W6Rxl-#wvr{hyGH=o`RZ^Evq6x3=u@_xO4fHXqo1$li&& zm)JXLnYe!_{ufI>`}xm*-t-s0_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zucS3O?+xYOMEtK0*#DqhEc#wK-4&6RDz{rIl_;+}Un)}G4o#BAAm#Kvl7=JwZO^M6 zqJKL?^UA*{r#nzN-P=?@aE0zGGe9}r-|xBSo+l}%+fVn7KBjBeu04A8?AcX0-2;`= z?Wmk?2j%+PE2rB|*BEZ6obHy&>9$r*xAlo9p4jq~Q%=bcd(>2FD5tVfeh+a^NQX+d zOSg*qCDKLGdE$4x)KA>|NZq8aV!yAnlbCmqwwKz8HEJuhLOKyG^xh2RlQXpT!=9o> zd2Z5QI(-JxXCQqB(q|xj2GVCBeFoBJAbkeXXCQqB(q|xj1~!y4;MV!ik~S4TVo*lK z<3wU$_{5KiM91*>2PG3?$BFRxTaoA;Ji&4Ji5xeHy&itz5=eF|e}g{`zM?-4J~4UR zyX+q%kITPe^0@pHlgH(s7#){=;!Hk2ktqAbnf_2!lF^SH_l_OgC)(@wiFRzCSauwp zl(OUK6U&aHPy9GxKOOximLDfSvHUpsiRH&h48gJg#NgO}VsPxgVtC9ahR1y3phWN! zKkglSU7uLt{rbcT$NI#I#~owGEn>$Rv14Dj7<{36KbCofKN+<=ZV`Kbb;oUD@BhiM z%rpGySj*$yvG-SZJTUhDpB!WE!H=umag*5lYkQm#`}Y|xGWX~!#gALWUa#)BP3-;E z9d~pygOh=utNOTi?Dgu72gcrC-El?p#>stL;rqpo7e0AN@Zyt)-O! literal 0 HcmV?d00001 diff --git a/SystemTemperatureStatusWindow.csproj b/SystemTemperatureStatusWindow.csproj new file mode 100644 index 0000000..2d22e35 --- /dev/null +++ b/SystemTemperatureStatusWindow.csproj @@ -0,0 +1,106 @@ + + + + + Debug + AnyCPU + {E45425FD-4302-4555-8F24-18F2373DE1CE} + WinExe + Properties + SystemTemperatureStatusWindow + SystemTemperatureStatusWindow + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary\bin\Debug\FloatingStatusWindowLibrary.dll + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + {b0397530-545a-471d-bb74-027ae456df1a} + OpenHardwareMonitorLib + + + + + \ No newline at end of file diff --git a/SystemTemperatureStatusWindow.sln b/SystemTemperatureStatusWindow.sln new file mode 100644 index 0000000..48fef20 --- /dev/null +++ b/SystemTemperatureStatusWindow.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30324.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemTemperatureStatusWindow", "SystemTemperatureStatusWindow.csproj", "{E45425FD-4302-4555-8F24-18F2373DE1CE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHardwareMonitorLib", "..\..\Public\OpenHardwareMonitor\OpenHardwareMonitorLib.csproj", "{B0397530-545A-471D-BB74-027AE456DF1A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|Any CPU.Build.0 = Release|Any CPU + {B0397530-545A-471D-BB74-027AE456DF1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0397530-545A-471D-BB74-027AE456DF1A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0397530-545A-471D-BB74-027AE456DF1A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0397530-545A-471D-BB74-027AE456DF1A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WindowSource.cs b/WindowSource.cs new file mode 100644 index 0000000..1012978 --- /dev/null +++ b/WindowSource.cs @@ -0,0 +1,146 @@ +using FloatingStatusWindowLibrary; +using OpenHardwareMonitor.Hardware; +using System; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading; +using SystemTemperatureStatusWindow.Properties; + +namespace SystemTemperatureStatusWindow +{ + public class WindowSource : IWindowSource, IDisposable + { + private readonly FloatingStatusWindow _floatingStatusWindow; + private readonly BackgroundWorker _backgroundWorker; + + internal WindowSource() + { + _floatingStatusWindow = new FloatingStatusWindow(this); + _floatingStatusWindow.SetText(Resources.Loading); + + _backgroundWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; + _backgroundWorker.ProgressChanged += HandleBackgroundWorkerProgressChanged; + _backgroundWorker.DoWork += HandleBackgroundWorkerDoWork; + _backgroundWorker.RunWorkerCompleted += HandleBackgroundWorkerRunWorkerCompleted; + _backgroundWorker.RunWorkerAsync(); + } + + public void Dispose() + { + _backgroundWorker.CancelAsync(); + + _floatingStatusWindow.Save(); + _floatingStatusWindow.Dispose(); + } + + public string Name + { + get { return "System Temperature"; } + } + + public System.Drawing.Icon Icon + { + get { return Resources.ApplicationIcon; } + } + + public string WindowSettings + { + get + { + return Settings.Default.WindowSettings; + } + set + { + Settings.Default.WindowSettings = value; + Settings.Default.Save(); + } + } + + void HandleBackgroundWorkerDoWork(object sender, DoWorkEventArgs e) + { + var backgroundWorker = (BackgroundWorker) sender; + + var computer = new Computer { HDDEnabled = true, FanControllerEnabled = false, GPUEnabled = true, MainboardEnabled = true, CPUEnabled = true }; + computer.Open(); + + while (!backgroundWorker.CancellationPending) + { + var builder = new StringBuilder(); + + foreach (var hardware in computer.Hardware) + { + hardware.Update(); + + var averageValue = hardware.Sensors.Where(sensor => sensor.SensorType == SensorType.Temperature).Average(sensor => sensor.Value); + + if (averageValue.HasValue) + { + string hardwareTag = string.Empty; + + switch (hardware.HardwareType) + { + case HardwareType.CPU: + hardwareTag = Resources.CPU; + break; + + case HardwareType.GpuAti: + case HardwareType.GpuNvidia: + hardwareTag = Resources.GPU; + break; + + case HardwareType.HDD: + string id = hardware.Identifier.ToString(); + hardwareTag = string.Format(Resources.HD, id.Substring(id.LastIndexOf("/", StringComparison.Ordinal) + 1)); + break; + } + + if (!string.IsNullOrWhiteSpace(hardwareTag)) + { + string color = "green"; + + if (averageValue > Settings.Default.AlertLevel) + color = "red"; + else if (averageValue.Value > Settings.Default.WarningLevel) + color = "yellow"; + + double averageDisplay; + string suffix; + + if (Settings.Default.DisplayF) + { + averageDisplay = ((9.0 / 5.0) * averageValue.Value) + 32; + suffix = Resources.SuffixF; + } + else + { + averageDisplay = averageValue.Value; + suffix = Resources.SuffixC; + } + + if (builder.Length > 0) + builder.AppendLine(); + + builder.AppendFormat(Resources.DisplayLineTemplate, hardwareTag, averageDisplay, color, suffix); + } + } + } + + backgroundWorker.ReportProgress(0, builder.ToString()); + + Thread.Sleep(Settings.Default.UpdateInterval); + } + + computer.Close(); + } + + void HandleBackgroundWorkerProgressChanged(object sender, ProgressChangedEventArgs e) + { + _floatingStatusWindow.SetText((string) e.UserState); + } + + void HandleBackgroundWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + } + } +}