public void Present(BrowserProcessCreation browserProcessCreation) { StatusIcon.StatusEnum browserProcessStatusEnum; var browserProcessStatusText = browserProcessCreation.StatusText(out browserProcessStatusEnum); BrowserProcessCurrentStatusTextView.Text = browserProcessStatusText; BrowserProcessCurrentStatusIconView.Status = browserProcessStatusEnum; }
BrowserProcessCreation BrowserProcessCreate(string reason) { var creation = new BrowserProcessCreation(AppInterface, Dispatcher.Invoke(BrowserProcessConfigCreate), BrowserStartUrl) { Reason = reason, }; BrowserProcessCreationLast = new PropertyGenTimespanInt64 <BrowserProcessCreation>(creation, Bib3.Glob.StopwatchZaitMiliSictInt()); LogEntryWrite(new LogEntry { BrowserProcessCreated = creation, }); return(creation); }
static public string StatusText( this BrowserProcessCreation browserProcessCreation, out StatusIcon.StatusEnum statusEnum) { statusEnum = Bib3.FCL.UI.StatusIcon.StatusEnum.Reject; try { if (null == browserProcessCreation) { return(null); } var exception = browserProcessCreation.Exception; var textLine = new List <string>(); textLine.Add("created at " + browserProcessCreation.StartTimeCal.ToLongTimeString() + " (PID: " + browserProcessCreation?.ProcessIdFromOS() + ", reason: " + browserProcessCreation?.Reason + ")"); var browserConnection = browserProcessCreation.BrowserConnection; var documentLocationHrefMeasurementLast = browserProcessCreation?.DocumentLocationHrefMeasurementLast; var documentLocationHref = documentLocationHrefMeasurementLast?.Value; if (null != browserConnection) { if (0 < documentLocationHref?.Length) { statusEnum = Bib3.FCL.UI.StatusIcon.StatusEnum.Accept; textLine.Add("connected to browser."); textLine.Add("location (" + documentLocationHrefMeasurementLast?.Duration() + "ms): " + documentLocationHref); } else { textLine.Add("connection to browser lost."); } } textLine.AddRange( new[] { browserProcessCreation?.BrowserProcessErrorMessage, browserProcessCreation?.BrowserConnectionErrorMessage, }.WhereNotDefault() .Select(errorMessage => "error: " + errorMessage)); if (null != exception) { textLine.Add("Exception: " + Bib3.Glob.SictString(exception)); } return(string.Join(Environment.NewLine, textLine)); } catch (Exception e) { return(e.SictString()); } }
static public string WindowTitle(this BrowserProcessCreation browserProcessCreation) { var location = browserProcessCreation?.DocumentLocationHrefMeasurementLast?.Value; return(browserProcessCreation?.BrowserAddressTcp?.ToString() + " - " + (location?.TW2WorldIdFromUrl() ?? location)); }
static public StatusIcon.StatusEnum StatusIcon(this BrowserProcessCreation browserProcessCreation) => null == browserProcessCreation?.BrowserConnection ? Bib3.FCL.UI.StatusIcon.StatusEnum.Reject : Bib3.FCL.UI.StatusIcon.StatusEnum.Accept;