diff --git a/Common/Adobe_CreatePDF_icon.png b/Common/Adobe_CreatePDF_icon.png index 65fd3e5..bb310db 100644 Binary files a/Common/Adobe_CreatePDF_icon.png and b/Common/Adobe_CreatePDF_icon.png differ diff --git a/PdfScribe/ActivityNotification.xaml b/PdfScribe/ActivityNotification.xaml index 7494478..1774b61 100644 --- a/PdfScribe/ActivityNotification.xaml +++ b/PdfScribe/ActivityNotification.xaml @@ -8,6 +8,7 @@ WindowStartupLocation="CenterScreen" Topmost="True"> - + + diff --git a/PdfScribe/ActivityNotificationPresenter.cs b/PdfScribe/ActivityNotificationPresenter.cs index 3cf72f1..fc7a067 100644 --- a/PdfScribe/ActivityNotificationPresenter.cs +++ b/PdfScribe/ActivityNotificationPresenter.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; +using SysTimers = System.Timers; using System.Windows; @@ -12,11 +13,18 @@ namespace PdfScribe { public ActivityNotificationPresenter() { - + progressTimer = new SysTimers.Timer(); + progressTimer.Enabled = false; + progressTimer.Interval = 250; // Quarter second is default + progressTimer.Elapsed += new SysTimers.ElapsedEventHandler(progressTimer_Elapsed); } + - private Application activityWindow = null; + private Application activityWindowApp = null; + private ActivityNotification activityWindow; + private SysTimers.Timer progressTimer; + readonly String progressString = "CAPTURING"; /// /// Displays the floating frameless @@ -25,18 +33,19 @@ namespace PdfScribe /// public void ShowActivityNotificationWindow() { - if (activityWindow == null) + if (this.activityWindowApp == null) { - this.activityWindow = new Application(); var activityWindowThread = new Thread(new ThreadStart(() => { - activityWindow = new Application(); - activityWindow.ShutdownMode = ShutdownMode.OnExplicitShutdown; - activityWindow.Run(new ActivityNotification()); + activityWindowApp = new Application(); + activityWindow = new ActivityNotification(); + activityWindowApp.ShutdownMode = ShutdownMode.OnExplicitShutdown; + activityWindowApp.Run(activityWindow); } )); activityWindowThread.SetApartmentState(ApartmentState.STA); activityWindowThread.Start(); + this.progressTimer.Enabled = true; } } @@ -46,8 +55,40 @@ namespace PdfScribe /// public void CloseActivityNotificationWindow() { - if (activityWindow != null) - activityWindow.Dispatcher.InvokeShutdown(); + if (activityWindowApp != null) + { + this.progressTimer.Stop(); + // Close windows rather than + // just bashing the WPF application + activityWindowApp.Dispatcher.Invoke((Action)delegate() + { + foreach (Window appWindow in activityWindowApp.Windows) + { + appWindow.Close(); + } + } + ); + activityWindowApp.Dispatcher.InvokeShutdown(); + activityWindowApp = null; + this.progressTimer.Dispose(); + this.progressTimer = null; + } + } + + + private int progressCounter = 0; + private void progressTimer_Elapsed(object sender, SysTimers.ElapsedEventArgs e) + { + ((SysTimers.Timer)sender).Enabled = false; + activityWindowApp.Dispatcher.Invoke((Action)delegate() + { + if (this.progressCounter >= progressString.Length) + this.progressCounter = 0; + activityWindow.labelProgress.Content = progressString.Substring(0, progressCounter + 1); + progressCounter++; + } + ); + ((SysTimers.Timer)sender).Enabled = true; } } diff --git a/PdfScribe/App.config b/PdfScribe/App.config index 49cc43e..e2b607f 100644 --- a/PdfScribe/App.config +++ b/PdfScribe/App.config @@ -1,3 +1,3 @@ - + - \ No newline at end of file + diff --git a/PdfScribe/ErrorDialogPresenter.cs b/PdfScribe/ErrorDialogPresenter.cs index 5be54dd..7af74a2 100644 --- a/PdfScribe/ErrorDialogPresenter.cs +++ b/PdfScribe/ErrorDialogPresenter.cs @@ -25,8 +25,8 @@ namespace PdfScribe /// Instructional text (Appears next to the icon) /// Smaller message detail text at bottom public ErrorDialogPresenter(String captionText, - String instructionText, - String messageText) + String instructionText, + String messageText) { ShowSimple(captionText, instructionText, messageText); } diff --git a/PdfScribe/PdfScribe.csproj b/PdfScribe/PdfScribe.csproj index 60f61e6..0a5ce65 100644 --- a/PdfScribe/PdfScribe.csproj +++ b/PdfScribe/PdfScribe.csproj @@ -11,7 +11,8 @@ PdfScribe PdfScribe v4.0 - Client + + 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -70,6 +71,9 @@ AnyCPU prompt + + app.manifest + ..\Lib\Microsoft.WindowsAPICodePack.dll @@ -118,6 +122,7 @@ Resources.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/PdfScribe/Program.cs b/PdfScribe/Program.cs index 5169566..10be8e1 100644 --- a/PdfScribe/Program.cs +++ b/PdfScribe/Program.cs @@ -127,7 +127,8 @@ namespace PdfScribe } /// - /// All unhandled exceptions will bubble their way up here + /// All unhandled exceptions will bubble their way up here - + /// a final error dialog will be displayed before the crash and burn /// /// /// diff --git a/PdfScribe/Properties/Resources.Designer.cs b/PdfScribe/Properties/Resources.Designer.cs index 2d262fa..ddeac24 100644 --- a/PdfScribe/Properties/Resources.Designer.cs +++ b/PdfScribe/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace PdfScribe.Properties -{ - - +namespace PdfScribe.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -22,48 +22,40 @@ namespace PdfScribe.Properties [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 - { - + 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() - { + 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 ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PdfScribe.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 - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/PdfScribe/Properties/Settings.Designer.cs b/PdfScribe/Properties/Settings.Designer.cs index 520420a..fd52c63 100644 --- a/PdfScribe/Properties/Settings.Designer.cs +++ b/PdfScribe/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace PdfScribe.Properties -{ - - +namespace PdfScribe.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + 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 - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/PdfScribe/app.manifest b/PdfScribe/app.manifest new file mode 100644 index 0000000..50724ed --- /dev/null +++ b/PdfScribe/app.manifest @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PdfScribeCore/PdfScribeCore.csproj b/PdfScribeCore/PdfScribeCore.csproj index 60e0037..1252ffa 100644 --- a/PdfScribeCore/PdfScribeCore.csproj +++ b/PdfScribeCore/PdfScribeCore.csproj @@ -11,7 +11,8 @@ PdfScribeCore PdfScribeCore v4.0 - Client + + 512 diff --git a/PdfScribeCore/PdfScribeInstaller.cs b/PdfScribeCore/PdfScribeInstaller.cs index 5e04a4b..324bd4c 100644 --- a/PdfScribeCore/PdfScribeInstaller.cs +++ b/PdfScribeCore/PdfScribeInstaller.cs @@ -243,7 +243,9 @@ namespace PdfScribeCore /// /// Disables WOW64 system directory file redirection /// if the current process is both - /// 32-bit, and running on a 64-bit OS + /// 32-bit, and running on a 64-bit OS - + /// Compiling for 64-bit OS, and setting the install dir to "ProgramFiles64" + /// should ensure this code never runs in production /// /// A Handle, which should be retained to reenable redirection private IntPtr DisableWow64Redirection() @@ -258,7 +260,9 @@ namespace PdfScribeCore /// /// Reenables WOW64 system directory file redirection /// if the current process is both - /// 32-bit, and running on a 64-bit OS + /// 32-bit, and running on a 64-bit OS - + /// Compiling for 64-bit OS, and setting the install dir to "ProgramFiles64" + /// should ensure this code never runs in production /// /// A Handle value - should be retained from call to private void RevertWow64Redirection(IntPtr oldValue) diff --git a/PdfScribeUnitTests/App.config b/PdfScribeUnitTests/App.config index b245d6f..204a449 100644 --- a/PdfScribeUnitTests/App.config +++ b/PdfScribeUnitTests/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/PdfScribeUnitTests/PdfScribeUnitTests.csproj b/PdfScribeUnitTests/PdfScribeUnitTests.csproj index 24ac2cf..426590f 100644 --- a/PdfScribeUnitTests/PdfScribeUnitTests.csproj +++ b/PdfScribeUnitTests/PdfScribeUnitTests.csproj @@ -11,7 +11,8 @@ PdfScribeUnitTests PdfScribeUnitTests v4.0 - Client + + 512 false publish\ diff --git a/PdfScribeUnitTests/UnitTests.cs b/PdfScribeUnitTests/UnitTests.cs index c5256eb..f32b5ad 100644 --- a/PdfScribeUnitTests/UnitTests.cs +++ b/PdfScribeUnitTests/UnitTests.cs @@ -56,13 +56,16 @@ namespace PdfScribeUnitTests #endregion - //[Test] + [Test] public void Test_ShowActivityWindows() { - + var activityWindowTester = new PdfScribe.ActivityNotificationPresenter(); + activityWindowTester.ShowActivityNotificationWindow(); + Thread.Sleep(20000); + activityWindowTester.CloseActivityNotificationWindow(); } - [Test] + //[Test] public void Test_ShowSimpleError() { var errorDialog = new PdfScribe.ErrorDialogPresenter("Error Caption", "Error Instructions", "Message text");