/// <summary> /// The method starts a NetSparkle background loop /// If NetSparkle is configured to check for updates on startup, proceeds to perform /// the check. You should only call this function when your app is initialized and /// shows its main window. /// </summary> /// <param name="doInitialCheck"></param> /// <param name="forceInitialCheck"></param> /// <param name="checkFrequency"></param> public void StartLoop(Boolean doInitialCheck, Boolean forceInitialCheck, TimeSpan checkFrequency) { // if service // check that we run in unattended mode otherwise throw not supported exception if ((EnableServiceMode) & (!EnableSilentMode)) { throw new NotSupportedException(); } // first set the event handle _loopingHandle.Set(); // Start the helper thread as a background worker to // get well ui interaction // show if needed ShowDiagnosticWindowIfNeeded(); // store infos _DoInitialCheck = doInitialCheck; _ForceInitialCheck = forceInitialCheck; _CheckFrequency = checkFrequency; // create and configure the worker _DiagnosticWindow.Report("Starting background worker"); // start the work _worker.RunWorkerAsync(); }
/// <summary> /// Reports a message /// </summary> /// <param name="message">the message</param> public void Report(string message) { if (_isDiagnosticWindowShown && _diagnosticWindow != null) { _diagnosticWindow.Report(message); } logger.Info(message); }
/// <summary> /// ctor which needs the appcast url and a referenceassembly /// </summary> public Sparkle(String appcastUrl, String referenceAssembly, Boolean ShowDiagnostic) { // preconfige ssl trust TrustEverySSLConnection = false; // configure ssl cert link ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidation; // enable visual style to ensure that we have XP style or higher // also in WPF applications System.Windows.Forms.Application.EnableVisualStyles(); // reset vars ApplicationIcon = null; _AppReferenceAssembly = null; // set var ShowDiagnosticWindow = ShowDiagnostic; // create the diagnotic window _DiagnosticWindow = new NetSparkleMainWindows(); // set the reference assembly if (referenceAssembly != null) { _AppReferenceAssembly = referenceAssembly; _DiagnosticWindow.Report("Checking the following file: " + _AppReferenceAssembly); } // show if needed ShowDiagnosticWindowIfNeeded(); // adjust the delegates _worker.WorkerReportsProgress = true; _worker.DoWork += new DoWorkEventHandler(_worker_DoWork); _worker.ProgressChanged += new ProgressChangedEventHandler(_worker_ProgressChanged); // build the wait handle _exitHandle = new EventWaitHandle(false, EventResetMode.AutoReset); _loopingHandle = new EventWaitHandle(false, EventResetMode.ManualReset); // set the url _AppCastUrl = appcastUrl; _DiagnosticWindow.Report("Using the following url: " + _AppCastUrl); }
/// <summary> /// The method starts a NetSparkle background loop /// If NetSparkle is configured to check for updates on startup, proceeds to perform /// the check. You should only call this function when your app is initialized and /// shows its main window. /// </summary> /// <param name="doInitialCheck"></param> /// <param name="forceInitialCheck"></param> /// <param name="checkFrequency"></param> public void StartLoop(Boolean doInitialCheck, Boolean forceInitialCheck, TimeSpan checkFrequency) { // Start the helper thread as a background worker to // get well ui interaction // show if needed ShowDiagnosticWindowIfNeeded(); // store infos _DoInitialCheck = doInitialCheck; _ForceInitialCheck = forceInitialCheck; _CheckFrequency = checkFrequency; // create and configure the worker _DiagnosticWindow.Report("Starting background worker"); // start the work _worker.RunWorkerAsync(); }
/// <summary> /// ctor which needs the appcast url and a referenceassembly /// </summary> public Sparkle(String appcastUrl, String referenceAssembly, Boolean ShowDiagnostic) { // enable visual style to ensure that we have XP style or higher // also in WPF applications Application.EnableVisualStyles(); // reset vars ApplicationIcon = null; _AppReferenceAssembly = null; // set var ShowDiagnosticWindow = ShowDiagnostic; // create the diagnotic window _DiagnosticWindow = new NetSparkleMainWindows(); // show if needed ShowDiagnosticWindowIfNeeded(); // adjust the delegates _worker.WorkerReportsProgress = true; _worker.DoWork += _worker_DoWork; _worker.ProgressChanged += _worker_ProgressChanged; // build the wait handle _exitHandle = new EventWaitHandle(false, EventResetMode.AutoReset); // set the url _AppCastUrl = appcastUrl; _DiagnosticWindow.Report("Using the following url: " + _AppCastUrl); // set the reference assembly if (referenceAssembly != null) { _AppReferenceAssembly = referenceAssembly; _DiagnosticWindow.Report("Checking the following file: " + _AppReferenceAssembly); } }
/// <summary> /// ctor which needs the appcast url and a referenceassembly /// </summary> public Sparkle(String appcastUrl, String referenceAssembly, Boolean ShowDiagnostic) { // preconfige ssl trust TrustEverySSLConnection = false; // configure ssl cert link ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidation; // enable visual style to ensure that we have XP style or higher // also in WPF applications System.Windows.Forms.Application.EnableVisualStyles(); // reset vars ApplicationIcon = null; _AppReferenceAssembly = null; // set var ShowDiagnosticWindow = ShowDiagnostic; // create the diagnotic window _DiagnosticWindow = new NetSparkleMainWindows(); // set the reference assembly if (referenceAssembly != null) { _AppReferenceAssembly = referenceAssembly; _DiagnosticWindow.Report("Checking the following file: " + _AppReferenceAssembly); } // show if needed ShowDiagnosticWindowIfNeeded(); // adjust the delegates _worker.WorkerReportsProgress = true; _worker.DoWork += new DoWorkEventHandler(_worker_DoWork); _worker.ProgressChanged += new ProgressChangedEventHandler(_worker_ProgressChanged); // build the wait handle _exitHandle = new EventWaitHandle(false, EventResetMode.AutoReset); _loopingHandle = new EventWaitHandle(false, EventResetMode.ManualReset); // set the url _AppCastUrl = appcastUrl; _DiagnosticWindow.Report("Using the following url: " + _AppCastUrl); }
/// <summary> /// ctor which needs the appcast url and a referenceassembly /// </summary> public Sparkle(String appcastUrl, String referenceAssembly, Boolean ShowDiagnostic) { // enable visual style to ensure that we have XP style or higher // also in WPF applications Application.EnableVisualStyles(); // reset vars ApplicationIcon = null; _AppReferenceAssembly = null; // set var ShowDiagnosticWindow = ShowDiagnostic; // create the diagnotic window _DiagnosticWindow = new NetSparkleMainWindows(); // show if needed ShowDiagnosticWindowIfNeeded(); // adjust the delegates _worker.WorkerReportsProgress = true; _worker.DoWork += _worker_DoWork; _worker.ProgressChanged += _worker_ProgressChanged; // build the wait handle _exitHandle = new EventWaitHandle(false, EventResetMode.AutoReset); // set the url _AppCastUrl = appcastUrl; _DiagnosticWindow.Report("Using the following url: " + _AppCastUrl); // set the reference assembly if (referenceAssembly != null) { _AppReferenceAssembly = referenceAssembly; _DiagnosticWindow.Report("Checking the following file: " + _AppReferenceAssembly); } }