periodic commit - still busted

This commit is contained in:
S T Chan 2014-01-10 09:59:01 -05:00
parent e130b5f07f
commit ebfbee526e
4 changed files with 54 additions and 22 deletions

View File

@ -7,7 +7,7 @@
WindowStyle="None" WindowStyle="None"
Background="Transparent" Background="Transparent"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
Topmost="True" ShowInTaskbar="False"> Topmost="True" ShowInTaskbar="True">
<Grid> <Grid>
<Image Name="QuillPenBackground" Source="Adobe_CreatePDF_icon.PNG" HorizontalAlignment="Center" VerticalAlignment="Top" Height="200" Width="200" ></Image> <Image Name="QuillPenBackground" Source="Adobe_CreatePDF_icon.PNG" HorizontalAlignment="Center" VerticalAlignment="Top" Height="200" Width="200" ></Image>
<Label Height="29" HorizontalAlignment="Left" Margin="12,203,0,0" Name="labelProgress" VerticalAlignment="Top" Width="254" Foreground="Red" FontFamily="Arial Rounded MT" FontSize="16" HorizontalContentAlignment="Center" FontWeight="Bold" VerticalContentAlignment="Top" Content="CAPTURING" /> <Label Height="29" HorizontalAlignment="Left" Margin="12,203,0,0" Name="labelProgress" VerticalAlignment="Top" Width="254" Foreground="Red" FontFamily="Arial Rounded MT" FontSize="16" HorizontalContentAlignment="Center" FontWeight="Bold" VerticalContentAlignment="Top" Content="CAPTURING" />

View File

@ -19,11 +19,10 @@ namespace PdfScribe
this.progressTimer.Enabled = false; this.progressTimer.Enabled = false;
this.progressTimer.Interval = 250; // Quarter second is default this.progressTimer.Interval = 250; // Quarter second is default
this.progressTimer.Elapsed += new SysTimers.ElapsedEventHandler(progressTimer_Elapsed); this.progressTimer.Elapsed += new SysTimers.ElapsedEventHandler(progressTimer_Elapsed);
//this.activityWindow = new ActivityNotification(); this.activityWindow = new ActivityNotification();
} }
private Application activityWindowApp;
private ActivityNotification activityWindow = null; private ActivityNotification activityWindow = null;
private SysTimers.Timer progressTimer; private SysTimers.Timer progressTimer;
private readonly String progressString = "CAPTURING"; private readonly String progressString = "CAPTURING";
@ -35,6 +34,12 @@ namespace PdfScribe
/// </summary> /// </summary>
public void ShowActivityNotificationWindow() public void ShowActivityNotificationWindow()
{ {
if (this.activityWindow != null)
{
this.activityWindow.Show();
this.progressTimer.Start();
}
/*
if (this.activityWindow == null) if (this.activityWindow == null)
{ {
@ -55,6 +60,7 @@ namespace PdfScribe
); );
} }
} }
*/
} }
/* /*
@ -87,6 +93,7 @@ namespace PdfScribe
this.progressTimer.Stop(); this.progressTimer.Stop();
if (this.activityWindow != null) if (this.activityWindow != null)
{ {
/*
if (this.activityWindow.Dispatcher.CheckAccess()) if (this.activityWindow.Dispatcher.CheckAccess())
{ {
this.activityWindow.Close(); this.activityWindow.Close();
@ -98,7 +105,8 @@ namespace PdfScribe
this.activityWindow.Close(); this.activityWindow.Close();
} }
); );
} }*/
this.activityWindow.Close();
this.activityWindow = null; this.activityWindow = null;
} }
/* /*
@ -133,7 +141,8 @@ namespace PdfScribe
{ {
if (this.progressCounter >= progressString.Length) if (this.progressCounter >= progressString.Length)
this.progressCounter = 0; this.progressCounter = 0;
this.activityWindow.labelProgress.Content = this.progressString.Substring(0, progressCounter + 1);
/*
if (activityWindow.labelProgress.Dispatcher.CheckAccess()) if (activityWindow.labelProgress.Dispatcher.CheckAccess())
{ {
//EventLog.WriteEntry("PdfScribe", "Timer_No_Invoke"); //EventLog.WriteEntry("PdfScribe", "Timer_No_Invoke");
@ -149,6 +158,7 @@ namespace PdfScribe
); );
//EventLog.WriteEntry("PdfScribe", "Timer_Invoked"); //EventLog.WriteEntry("PdfScribe", "Timer_Invoked");
} }
*/
progressCounter++; progressCounter++;
} }
((SysTimers.Timer)sender).Start(); ((SysTimers.Timer)sender).Start();

View File

@ -40,7 +40,8 @@ namespace PdfScribe
#endregion #endregion
static Application guiApplication = null; static Application guiApplication = null;
static ActivityNotificationPresenter userDisplay; static Dispatcher guiDispatcher = null;
static ActivityNotificationPresenter activityNotification = null;
static TraceSource logEventSource = new TraceSource(traceSourceName); static TraceSource logEventSource = new TraceSource(traceSourceName);
[STAThread] [STAThread]
@ -90,13 +91,14 @@ namespace PdfScribe
errorDialogInstructionCouldNotWrite, errorDialogInstructionCouldNotWrite,
String.Format("{0} is in use.", outputFilename));*/ String.Format("{0} is in use.", outputFilename));*/
DispatchToGUIApp((Action)delegate() DispatchToGUIApp(
{ (Action)delegate()
ErrorDialogPresenter errorDialog = new ErrorDialogPresenter(errorDialogCaption, {
errorDialogInstructionCouldNotWrite, ErrorDialogPresenter errorDialog = new ErrorDialogPresenter(errorDialogCaption,
String.Format("{0} is in use.", outputFilename)); errorDialogInstructionCouldNotWrite,
} String.Format("{0} is in use.", outputFilename));
); }
);
} }
catch (UnauthorizedAccessException unauthorizedEx) catch (UnauthorizedAccessException unauthorizedEx)
{ {
@ -138,7 +140,7 @@ namespace PdfScribe
(int)TraceEventType.Warning, (int)TraceEventType.Warning,
String.Format(warnFileNotDeleted, standardInputFilename)); String.Format(warnFileNotDeleted, standardInputFilename));
} }
ShutdownApplication(); //ShutdownApplication();
} }
} }
@ -165,12 +167,11 @@ namespace PdfScribe
{ {
if (guiApplication != null) if (guiApplication != null)
{ {
guiApplication.Dispatcher.Invoke((Action)delegate() DispatchToGUIApp((Action)delegate()
{ {
//ActivityNotificationPresenter notificationPresenter = new ActivityNotificationPresenter(); ActivityNotificationPresenter notificationPresenter = new ActivityNotificationPresenter();
//notificationPresenter.ShowActivityNotificationWindow(); notificationPresenter.ShowActivityNotificationWindow();
ActivityNotification testWindow = new ActivityNotification(); System.Windows.Threading.Dispatcher.Run();
testWindow.Show();
} }
); );
} }
@ -185,6 +186,8 @@ namespace PdfScribe
{ {
guiApplication = new Application(); guiApplication = new Application();
guiApplication.ShutdownMode = ShutdownMode.OnExplicitShutdown; guiApplication.ShutdownMode = ShutdownMode.OnExplicitShutdown;
activityNotification = new ActivityNotificationPresenter();
activityNotification.ShowActivityNotificationWindow();
guiApplication.Run(); guiApplication.Run();
} }
)); ));
@ -198,7 +201,14 @@ namespace PdfScribe
{ {
if (guiApplication != null) if (guiApplication != null)
{ {
guiApplication.Dispatcher.Invoke(guiAction); if (guiApplication.Dispatcher.Thread != System.Windows.Threading.Dispatcher.CurrentDispatcher.Thread)
{
guiApplication.Dispatcher.Invoke(guiAction);
}
else
{
guiAction.Invoke();
}
} }
} }
@ -206,6 +216,16 @@ namespace PdfScribe
{ {
if (guiApplication != null) if (guiApplication != null)
{ {
if (guiApplication.Windows != null && guiApplication.Windows.Count > 0)
{
foreach (Window appWindow in guiApplication.Windows)
{
appWindow.Close();
}
}
guiApplication.Shutdown();
guiApplication = null;
/*
guiApplication.Dispatcher.Invoke((Action)delegate() guiApplication.Dispatcher.Invoke((Action)delegate()
{ {
if (guiApplication.Windows != null && guiApplication.Windows.Count > 0) if (guiApplication.Windows != null && guiApplication.Windows.Count > 0)
@ -220,7 +240,7 @@ namespace PdfScribe
} }
); );
*/
//guiApplication.Dispatcher.BeginInvokeShutdown(System.Windows.Threading.DispatcherPriority.Send); //guiApplication.Dispatcher.BeginInvokeShutdown(System.Windows.Threading.DispatcherPriority.Send);
//guiApplication.Shutdown(); //guiApplication.Shutdown();
//guiApplication = null; //guiApplication = null;

View File

@ -53,6 +53,7 @@ namespace PdfScribeCore
simpleTaskDialog.Opened += new EventHandler(simpleTaskDialog_Opened); simpleTaskDialog.Opened += new EventHandler(simpleTaskDialog_Opened);
simpleTaskDialog.StartupLocation = APICodePack.TaskDialogStartupLocation.CenterScreen; simpleTaskDialog.StartupLocation = APICodePack.TaskDialogStartupLocation.CenterScreen;
simpleTaskDialog.Show(); simpleTaskDialog.Show();
//System.Windows.Threading.Dispatcher.Run();
} }
} }
@ -67,6 +68,7 @@ namespace PdfScribeCore
// someone else fixes first - also why isn't the API Code pack on codeplex // someone else fixes first - also why isn't the API Code pack on codeplex
// or github so people can push patches), but until then... // or github so people can push patches), but until then...
((APICodePack.TaskDialog)sender).Icon = this.DefaultTaskIcon; ((APICodePack.TaskDialog)sender).Icon = this.DefaultTaskIcon;
} }
} }