public async void RenewAll(bool autoRenewalsOnly) { //FIXME: currently user can run renew all again while renewals are still in progress Dictionary <string, Progress <RequestProgressState> > itemTrackers = new Dictionary <string, Progress <RequestProgressState> >(); foreach (var s in ManagedSites) { if ((autoRenewalsOnly && s.IncludeInAutoRenew) || !autoRenewalsOnly) { var progressState = new RequestProgressState { ManagedItem = s }; if (!itemTrackers.ContainsKey(s.Id)) { itemTrackers.Add(s.Id, new Progress <RequestProgressState>(progressState.ProgressReport)); //begin monitoring progress BeginTrackingProgress(progressState); } } } var results = await certifyManager.PerformRenewalAllManagedSites(autoRenewalsOnly, itemTrackers); //TODO: store results in log //return results; }
public async Task <List <StatusMessage> > TestChallengeResponse(ManagedCertificate managedCertificate) { DebugLog(); var progressState = new RequestProgressState(RequestState.Running, "Starting Tests..", managedCertificate); var progressIndicator = new Progress <RequestProgressState>(progressState.ProgressReport); //begin monitoring progress _certifyManager.BeginTrackingProgress(progressState); // perform challenge response test, log to string list and return in result var logList = new List <string>(); using (var log = new LoggerConfiguration() .WriteTo.Sink(new ProgressLogSink(progressIndicator, managedCertificate, _certifyManager)) .CreateLogger()) { var theLog = new Loggy(log); var results = await _certifyManager.TestChallenge(theLog, managedCertificate, isPreviewMode : true, progress : progressIndicator); return(results); } }
public async void RenewAll(bool autoRenewalsOnly) { //FIXME: currently user can run renew all again while renewals are still in progress Dictionary <string, Progress <RequestProgressState> > itemTrackers = new Dictionary <string, Progress <RequestProgressState> >(); foreach (var s in ManagedCertificates) { if ((autoRenewalsOnly && s.IncludeInAutoRenew) || !autoRenewalsOnly) { var progressState = new RequestProgressState(RequestState.Running, "Starting..", s); if (!itemTrackers.ContainsKey(s.Id)) { itemTrackers.Add(s.Id, new Progress <RequestProgressState>(progressState.ProgressReport)); //begin monitoring progress UpdateRequestTrackingProgress(progressState); } } } await CertifyClient.BeginAutoRenewal(); // now continue to poll status of current request. should this just be a query for all // current requests? }
public void ProgressReport(RequestProgressState state) { CurrentState = state.CurrentState; Message = state.Message; Result = state.Result; #if DEBUG System.Diagnostics.Debug.WriteLine(ManagedCertificate.Name + ": " + CurrentState.ToString() + (Message != null ? ", " + Message : "")); #endif }
public void BeginTrackingProgress(RequestProgressState state) { var existing = _progressResults.FirstOrDefault(p => p.ManagedCertificate.Id == state.ManagedCertificate.Id); if (existing != null) { _progressResults.Remove(existing); } _progressResults.Add(state); }
public void TrackProgress(ManagedCertificate managedCertificate) { //add request to observable list of progress state RequestProgressState progressState = new RequestProgressState(RequestState.Running, "Starting..", managedCertificate); //begin monitoring progress UpdateRequestTrackingProgress(progressState); //var progressIndicator = new Progress<RequestProgressState>(progressState.ProgressReport); }
private void BeginTrackingProgress(RequestProgressState state) { var existing = ProgressResults.FirstOrDefault(p => p.ManagedItem.Id == state.ManagedItem.Id); if (existing != null) { ProgressResults.Remove(existing); } ProgressResults.Add(state); RaisePropertyChanged(nameof(HasRequestsInProgress)); }
private void ReportProgress(IProgress <RequestProgressState> progress, RequestProgressState state, string logManagedSiteId = null) { if (progress != null) { progress.Report(state); } if (logManagedSiteId != null) { LogMessage(logManagedSiteId, state.Message, LogItemType.GeneralWarning); } }
public void ReportProgress(IProgress <RequestProgressState> progress, RequestProgressState state, bool logThisEvent = true) { if (progress != null) { progress.Report(state); } // report request state to staus hub clients OnRequestProgressStateUpdated?.Invoke(state); if (state.ManagedCertificate != null && logThisEvent) { LogMessage(state.ManagedCertificate.Id, state.Message, LogItemType.GeneralInfo); } }
public async Task <CertificateRequestResult> ReapplyCertificateBindings(string managedSiteId) { DebugLog(); var managedSite = await _certifyManager.GetManagedSite(managedSiteId); RequestProgressState progressState = new RequestProgressState(RequestState.Running, "Starting..", managedSite); //begin monitoring progress _certifyManager.BeginTrackingProgress(progressState); var result = await _certifyManager.ReapplyCertificateBindings(managedSite); return(result); }
public async Task <bool> BeginCertificateRequest(string managedSiteId) { DebugLog(); var managedSite = await _certifyManager.GetManagedSite(managedSiteId); RequestProgressState progressState = new RequestProgressState(RequestState.Running, "Starting..", managedSite); var progressIndicator = new Progress <RequestProgressState>(progressState.ProgressReport); //begin monitoring progress _certifyManager.BeginTrackingProgress(progressState); //begin request await _certifyManager.PerformCertificateRequest(managedSite, progressIndicator); return(true); }
private void UpdateRequestTrackingProgress(RequestProgressState state) { App.Current.Dispatcher.Invoke((Action) delegate { var existing = ProgressResults.FirstOrDefault(p => p.ManagedCertificate.Id == state.ManagedCertificate.Id); if (existing != null) { //replace state of progress request var index = ProgressResults.IndexOf(existing); ProgressResults[index] = state; } else { ProgressResults.Add(state); } RaisePropertyChangedEvent(nameof(HasRequestsInProgress)); RaisePropertyChangedEvent(nameof(ProgressResults)); }); }
public async void BeginCertificateRequest(string managedItemId) { //begin request process var managedSite = ManagedSites.FirstOrDefault(s => s.Id == managedItemId); if (managedSite != null) { MainUITabIndex = (int)MainWindow.PrimaryUITabs.CurrentProgress; //add request to observable list of progress state RequestProgressState progressState = new RequestProgressState(); progressState.ManagedItem = managedSite; //begin monitoring progress BeginTrackingProgress(progressState); var progressIndicator = new Progress <RequestProgressState>(progressState.ProgressReport); var result = await certifyManager.PerformCertificateRequest(null, managedSite, progressIndicator); if (progressIndicator != null) { var progress = (IProgress <RequestProgressState>)progressIndicator; if (result.IsSuccess) { progress.Report(new RequestProgressState { CurrentState = RequestState.Success, Message = result.Message }); } else { progress.Report(new RequestProgressState { CurrentState = RequestState.Error, Message = result.Message }); } } } }
public async Task <CertificateRequestResult> BeginCertificateRequest(string managedItemId, bool resumePaused) { DebugLog(); var managedCertificate = await _certifyManager.GetManagedCertificate(managedItemId); var progressState = new RequestProgressState(RequestState.Running, "Starting..", managedCertificate); var progressIndicator = new Progress <RequestProgressState>(progressState.ProgressReport); //begin monitoring progress _certifyManager.BeginTrackingProgress(progressState); //begin request var result = await _certifyManager.PerformCertificateRequest( null, managedCertificate, progressIndicator, resumePaused ); return(result); }
public async Task ReportRequestProgress(RequestProgressState state) { System.Diagnostics.Debug.WriteLine($"Sending progress update message to UI: {state.Message}"); await _hubContext.Clients.All.SendAsync(StatusHubMessages.SendProgressStateMsg, state); }
public static void SendRequestProgressState(RequestProgressState state) { Debug.WriteLine("StatusHub: Sending progress state to UI.."); HubContext.Clients.All.RequestProgressStateUpdated(state); }
public static void SendProgressState(RequestProgressState state) { Debug.WriteLine("StatusHub: Broadcasting progress state to UI/clients.."); HubContext.Clients.All.SendProgressState(state); }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public async Task ReportRequestProgress(RequestProgressState state) { System.Diagnostics.Debug.WriteLine($"Sending progress update message to UI: {state.Message}"); StatusHub.SendProgressState(state); }