diff --git a/Skedaddler/Main.cs b/Skedaddler/Main.cs index cd611e0..e04734e 100644 --- a/Skedaddler/Main.cs +++ b/Skedaddler/Main.cs @@ -11,17 +11,39 @@ using System.Windows.Forms; using System.IO; using System.Text.RegularExpressions; +using System.Drawing.Text; namespace Skedaddler { public partial class Skedaddler : Form { + [System.Runtime.InteropServices.DllImport("gdi32.dll")] + private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, + IntPtr pdv, [System.Runtime.InteropServices.In] ref uint pcFonts); + + private PrivateFontCollection fonts = new PrivateFontCollection(); + + SoundPlayer soundPlayer; + public Skedaddler() { InitializeComponent(); - } - SoundPlayer soundPlayer; + byte[] fontData = Properties.Resources.OpenSans; + IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData.Length); + System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length); + uint dummy = 0; + fonts.AddMemoryFont(fontPtr, Properties.Resources.OpenSans.Length); + AddFontMemResourceEx(fontPtr, (uint)Properties.Resources.OpenSans.Length, IntPtr.Zero, ref dummy); + System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr); + + this.label4.Font = new Font(fonts.Families[0], 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.leaveTimeLabel.Font = new Font(fonts.Families[0], 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.timeUntilLabel.Font = new Font(fonts.Families[0], 23.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.label5.Font = new Font(fonts.Families[0], 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.alarmLabel.Font = new Font(fonts.Families[0], 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.Font = new Font(fonts.Families[0], 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + } private void Skedaddler_Load(object sender, EventArgs e) { @@ -93,8 +115,17 @@ private void saveCurrentValues() private bool reloadValues() { - if (!Properties.Settings.Default.LastStateUpdate.Equals(DateTime.Today)) + + try + { + if (!Properties.Settings.Default.LastStateUpdate.Equals(DateTime.Today)) + return false; + } + catch + { + // Any exception would tell things are wrong or uninitialized return false; + } System.Console.WriteLine("Loading data:"); System.Console.WriteLine(" LastArrivalTime " + Properties.Settings.Default.LastArrivalTime); diff --git a/Skedaddler/Properties/Resources.Designer.cs b/Skedaddler/Properties/Resources.Designer.cs index 2ee8325..3cc78ab 100644 --- a/Skedaddler/Properties/Resources.Designer.cs +++ b/Skedaddler/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Skedaddler.Properties { // 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -69,6 +69,16 @@ internal static System.IO.UnmanagedMemoryStream alarm { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] OpenSans { + get { + object obj = ResourceManager.GetObject("OpenSans", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// diff --git a/Skedaddler/Properties/Resources.resx b/Skedaddler/Properties/Resources.resx index b07346c..ac2a043 100644 --- a/Skedaddler/Properties/Resources.resx +++ b/Skedaddler/Properties/Resources.resx @@ -121,6 +121,9 @@ ..\Resources\alarm.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\OpenSans-Regular.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\skedaddler.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Skedaddler/Resources/OpenSans-Regular.ttf b/Skedaddler/Resources/OpenSans-Regular.ttf new file mode 100644 index 0000000..db43334 Binary files /dev/null and b/Skedaddler/Resources/OpenSans-Regular.ttf differ diff --git a/Skedaddler/Skedaddler.csproj b/Skedaddler/Skedaddler.csproj index 203ade5..a20d2e1 100644 --- a/Skedaddler/Skedaddler.csproj +++ b/Skedaddler/Skedaddler.csproj @@ -12,6 +12,24 @@ v4.5.2 512 true + false + D:\skedaddler\ + true + Disk + false + Foreground + 7 + Days + false + false + true + publish.htm + true + 2 + 1.0.0.%2a + false + true + true AnyCPU @@ -35,6 +53,18 @@ Resources\skedaddler.ico + + 3AD42D9F2A12AB3F10CF8EE505B5698EFE26D086 + + + Skedaddler_TemporaryKey.pfx + + + true + + + true + @@ -79,6 +109,8 @@ Settings.settings True + + @@ -89,6 +121,18 @@ + + + False + Microsoft .NET Framework 4.5.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + +