Removed ActivityNotification.xaml, updated app.config to allow tracing

This commit is contained in:
S T Chan 2014-01-11 19:14:56 -05:00
parent a97181b839
commit f8f990d84e
10 changed files with 32 additions and 216 deletions

View File

@ -1,15 +0,0 @@
<Window x:Class="PdfScribe.ActivityNotification"
x:ClassModifier="internal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PDF Scribe" Height="300" Width="300"
AllowsTransparency="True"
WindowStyle="None"
Background="Transparent"
WindowStartupLocation="CenterScreen"
Topmost="True" ShowInTaskbar="False" IsTabStop="False">
<Grid>
<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" />
</Grid>
</Window>

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace PdfScribe
{
/// <summary>
/// Interaction logic for ActivityNotification.xaml
/// </summary>
internal partial class ActivityNotification : Window
{
internal ActivityNotification()
{
InitializeComponent();
}
}
}

View File

@ -1,168 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using SysTimers = System.Timers;
using System.Windows;
namespace PdfScribe
{
public class ActivityNotificationPresenter
{
public ActivityNotificationPresenter()
{
this.progressTimer = new SysTimers.Timer();
this.progressTimer.Enabled = false;
this.progressTimer.Interval = 250; // Quarter second is default
this.progressTimer.Elapsed += new SysTimers.ElapsedEventHandler(progressTimer_Elapsed);
this.activityWindow = new ActivityNotification();
}
private ActivityNotification activityWindow = null;
private SysTimers.Timer progressTimer;
private readonly String progressString = "CAPTURING";
/// <summary>
/// Displays the floating frameless
/// activity notification window on
/// a separate thread
/// </summary>
public void ShowActivityNotificationWindow()
{
if (this.activityWindow != null)
{
this.activityWindow.Show();
this.progressTimer.Start();
}
/*
if (this.activityWindow == null)
{
if (this.activityWindow.Dispatcher.CheckAccess())
{
this.activityWindow = new ActivityNotification();
this.activityWindow.Show();
this.progressTimer.Start();
}
else
{
this.activityWindow.Dispatcher.Invoke((Action)delegate()
{
this.activityWindow = new ActivityNotification();
this.activityWindow.Show();
this.progressTimer.Start();
}
);
}
}
*/
}
/*
public void ShowActivityNotificationWindow()
{
if (this.activityWindowApp == null)
{
activityWindowApp = new Application();
var activityWindowThread = new Thread(new ThreadStart(() =>
{
activityWindow = new ActivityNotification();
activityWindowApp.ShutdownMode = ShutdownMode.OnExplicitShutdown;
activityWindowApp.Run(activityWindow);
}
));
activityWindowThread.SetApartmentState(ApartmentState.STA);
activityWindowThread.Start();
this.progressTimer.Enabled = true;
}
}
*/
/// <summary>
/// Shuts down the WPF Application showing
/// the ActivityNotification window
/// </summary>
public void CloseActivityNotificationWindow()
{
//this.progressTimer.Elapsed -= new SysTimers.ElapsedEventHandler(progressTimer_Elapsed);
this.progressTimer.Stop();
if (this.activityWindow != null)
{
/*
if (this.activityWindow.Dispatcher.CheckAccess())
{
this.activityWindow.Close();
}
else
{
this.activityWindow.Dispatcher.Invoke((Action)delegate()
{
this.activityWindow.Close();
}
);
}*/
this.activityWindow.Close();
this.activityWindow = null;
}
/*
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;
static Object timerElapsedLock = new Object();
private void progressTimer_Elapsed(object sender, SysTimers.ElapsedEventArgs e)
{
((SysTimers.Timer)sender).Stop();
if (activityWindow != null)
{
if (this.progressCounter >= progressString.Length)
this.progressCounter = 0;
this.activityWindow.labelProgress.Content = this.progressString.Substring(0, progressCounter + 1);
/*
if (activityWindow.labelProgress.Dispatcher.CheckAccess())
{
//EventLog.WriteEntry("PdfScribe", "Timer_No_Invoke");
this.activityWindow.labelProgress.Content = this.progressString.Substring(0, progressCounter + 1);
}
else
{
//EventLog.WriteEntry("PdfScribe", "Timer_Invoke");
this.activityWindow.labelProgress.Dispatcher.Invoke((Action)delegate()
{
this.activityWindow.labelProgress.Content = this.progressString.Substring(0, progressCounter + 1);
}
);
//EventLog.WriteEntry("PdfScribe", "Timer_Invoked");
}
*/
progressCounter++;
}
((SysTimers.Timer)sender).Start();
}
}
}

View File

@ -1,3 +1,25 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="PdfScribe"
switchName="PdfScribeAll" >
<listeners>
<add name="textwriterListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="PdfScribe_trace.log"
traceOutputOptions="DateTime" />
<remove name="Default" />
<clear /> <!-- Remove the <clear /> element to turn on tracing output -->
</listeners>
</source>
</sources>
<switches>
<add name="PdfScribeAll" value="Verbose"/>
</switches>
</system.diagnostics>
</configuration>

View File

@ -115,7 +115,9 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

View File

@ -123,6 +123,7 @@ namespace PdfScribe
(int)TraceEventType.Warning,
String.Format(warnFileNotDeleted, standardInputFilename));
}
logEventSource.Flush();
}
}

View File

@ -32,7 +32,7 @@
</compatibility>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<dependency>
<!--<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
@ -43,6 +43,6 @@
language="*"
/>
</dependentAssembly>
</dependency>
</dependency> -->
</asmv1:assembly>

View File

@ -101,8 +101,6 @@
<Compile Include="..\Common\PdfScribeSharedAssemblyInfo.cs">
<Link>PdfScribeSharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ErrorDialogPresenter.cs" />
<Compile Include="TaskDialogPresenter.cs" />
<Compile Include="PdfScribeInstaller.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NativeMethods.cs" />

View File

@ -624,7 +624,6 @@ namespace PdfScribeCore
public bool UninstallPdfScribePrinter()
{
bool printerUninstalledCleanly = true;
ErrorDialogPresenter test = new ErrorDialogPresenter();
if (!DeletePdfScribePrinter())
printerUninstalledCleanly = false;

View File

@ -9,6 +9,9 @@
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Icon Id="AdobeIcon.ico" SourceFile="..\Common\AdobeIcon.ico"/>
<Property Id="ARPPRODUCTICON" Value="AdobeIcon.ico" />
<Feature Id="ProductFeature" Title="PdfScribe" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>