/// <summary> /// Add the Main Form thread to the thread list and start it /// </summary> public void StartMainWindowThread() { if (_mainFormThread != null) { return; } _logger.Debug("Starting main form thread"); var t = new SynchronizedThread(() => { try { MainWindow.ShowDialogTopMost(); _mainFormThread = null; } catch (Exception ex) { _logger.Error(ex); } }); _mainFormThread = t; _mainFormThread.Name = "MainFormThread"; _mainFormThread.SetApartmentState(ApartmentState.STA); StartSynchronizedThread(t); }
/// <summary> /// Initialize with NextUpdate and UpdateInterval from Settings /// </summary> /// <summary> /// Launch UpdateProcedure in separate Thread. /// UpdateManager must be initialized! /// Downloads update-info.txt and compares the recent (online) version to the current version /// and launches assigned events. /// Specific Events must be set in advance. /// Can only be launched once at the time, reported in UpdateProcedureIsRunning flag. /// Resets the UpdateManager afterwards. /// </summary> /// <param name="checkNecessity"></param> public void UpdateProcedure(bool checkNecessity) { var thread = new SynchronizedThread(() => UpdateThread(checkNecessity)); thread.Name = "UpdateThread"; thread.SetApartmentState(ApartmentState.STA); _threadManager.StartSynchronizedThread(thread); }
/// <summary> /// Show something to the user (if desired) while the conversion is going on /// </summary> protected virtual void ShowConversionProgress() { var progressWindowThread = new SynchronizedThread(ShowConversionProgressDialog); progressWindowThread.SetApartmentState(ApartmentState.STA); progressWindowThread.Name = "ProgressForm"; ThreadManager.Instance.StartSynchronizedThread(progressWindowThread); }
/// <summary> /// Initialize with NextUpdate and UpdateInterval from Settings /// </summary> /// <param name="settings">Current PdfCreatorSettings</param> /// <param name="gpoSettings">Current GpoSettings</param> //public void Initialize(PdfCreatorSettings settings, GpoSettings gpoSettings) //{ // Initialize(settings.ApplicationSettings, settings.ApplicationProperties, gpoSettings); //} /// <summary> /// Launch UpdateProcedure in separate Thread. /// UpdateManager must be initialized! /// Downloads update-info.txt and compares the recent (online) version to the current version /// and launches assigned events. /// Specific Events must be set in advance. /// Can only be launched once at the time, reported in UpdateProcedureIsRunning flag. /// Resets the UpdateManager afterwards. /// </summary> /// <param name="checkNecessity"></param> public void UpdateProcedure(bool checkNecessity) { _checkNecessity = checkNecessity; var thread = new SynchronizedThread(UpdateThread); thread.Name = "UpdateThread"; thread.SetApartmentState(ApartmentState.STA); ThreadManager.Instance.StartSynchronizedThread(thread); }
/// <summary> /// Initialize with NextUpdate and UpdateInterval from Settings /// </summary> /// <summary> /// Launch UpdateProcedure in separate Thread. /// UpdateManager must be initialized! /// Downloads update-info.txt and compares the recent (online) version to the current version /// and launches assigned events. /// Specific Events must be set in advance. /// Can only be launched once at the time, reported in UpdateProcedureIsRunning flag. /// Resets the UpdateManager afterwards. /// </summary> /// <param name="checkNecessity"></param> /// <param name="onlyNotifyOnNewUpdate">When true, a message is only displayed to the user, if an update is available. Otherwise, a message will be displayed that no update is available</param> public void UpdateProcedure(bool checkNecessity, bool onlyNotifyOnNewUpdate) { _checkNecessity = checkNecessity; var thread = new SynchronizedThread(() => UpdateThread(onlyNotifyOnNewUpdate)); thread.Name = "UpdateThread"; thread.SetApartmentState(ApartmentState.STA); _threadManager.StartSynchronizedThread(thread); }
public void SendUsageStatistics(TimeSpan duration, Job job, string status) { if (IsEnabled) { var usageMetric = CreateJobUsageStatisticsMetric(job, duration, status); var senderThread = new SynchronizedThread(() => _sender.Send(usageMetric)); _threadManager.StartSynchronizedThread(senderThread); } }
protected override bool StartApplication() { _logger.Debug("Starting main window"); _mainWindowThreadLauncher.LaunchMainWindow(); var pdfArchitectCheckThread = new SynchronizedThread(() => { _pdfArchitectCheck.IsInstalled(); }); _threadManager.StartSynchronizedThread(pdfArchitectCheckThread); return(true); }
public static void ShowTopMost(int currentCount) { CurrentCount = currentCount; var thread = new SynchronizedThread(ShowPlusHintWindow) { Name = "PlusHintThread" }; thread.SetApartmentState(ApartmentState.STA); ThreadManager.Instance.StartSynchronizedThread(thread); }
/// <summary> /// Starts a new asynchronous thread /// </summary> private void CreateThread(string filename) { Logger.Trace("COM: Removing jobinfo from queue."); _jobInfoQueue.Remove(Job.JobInfo); Logger.Trace("COM: Creating new asynchronous thread."); var thread = new SynchronizedThread(() => DoConversion(Job, filename)); thread.Name = "ConversionThread"; Logger.Trace("COM: Adding the new thread to the thread pool."); _threadPool.AddThread(thread); }
public void Show(Job job) { if (!job.Profile.ShowProgress) { return; } var progressWindowThread = new SynchronizedThread(() => ShowConversionProgressDialog(job)); progressWindowThread.SetApartmentState(ApartmentState.STA); progressWindowThread.Name = "ProgressForm"; _threadManager.StartSynchronizedThread(progressWindowThread); }
/// <summary> /// Add the clean up thread to the thread list and start it. /// The thread will look for outdated temporary files and will delete them /// </summary> public void StartCleanUpThread() { if (_cleanUpThread != null) { return; } _logger.Debug("Starting cleanup"); var t = new SynchronizedThread(() => { JobInfoQueue.Instance.CleanTempFiles(); _cleanUpThread = null; }); _cleanUpThread = t; _cleanUpThread.Name = "CleanUpThread"; StartSynchronizedThread(t); }
/// <summary> /// Starts a new asynchronous thread /// </summary> private void CreateThread() { Logger.Trace("COM: Removing jobinfo from queue."); _comJobInfoQueue.Remove(JobInfo); Logger.Trace("COM: Creating new asynchronous thread."); var aThread = new SynchronizedThread(DoConversion); aThread.OnThreadFinished += (sender, args) => { if (OnJobFinished != null) { OnJobFinished(aThread, args); } }; aThread.Name = "ConversionThread"; Logger.Trace("COM: Adding the new thread to the thread pool."); _threadPool.AddThread(aThread); }