/// <summary> /// Handle title changes, check for JIRA /// </summary> /// <param name="eventArgs"></param> private void MonitorTitleChangeEvent(TitleChangeEventArgs eventArgs) { string windowTitle = eventArgs.Title; if (string.IsNullOrEmpty(windowTitle)) { return; } var jiraKeyMatch = _jiraKeyPattern.Match(windowTitle); if (!jiraKeyMatch.Success) { return; } // Found a possible JIRA title var jiraKey = jiraKeyMatch.Value; var jiraKeyParts = jiraKey.Split('-'); var projectKey = jiraKeyParts[0]; var jiraId = jiraKeyParts[1]; IJiraClient jiraClient; // Check if we have a JIRA instance with a project for this key if (_projectJiraClientMap.TryGetValue(projectKey, out jiraClient)) { // We have found a project for this _jira key, so it must be a valid & known JIRA JiraDetails currentJiraDetails; if (_recentJiras.TryGetValue(jiraKey, out currentJiraDetails)) { // update currentJiraDetails.SeenAt = DateTimeOffset.Now; // Notify the order change JiraEvent?.Invoke(this, new JiraEventArgs { Details = currentJiraDetails, EventType = JiraEventTypes.OrderChanged }); // Nothing else to do return; } // We detected an unknown JIRA, so add it to our list currentJiraDetails = new JiraDetails { Id = jiraId, ProjectKey = projectKey }; _recentJiras.Add(currentJiraDetails.JiraKey, currentJiraDetails); // Make sure we don't collect _jira's until the memory is full if (_recentJiras.Count > _maxEntries) { // Add it to the list of recent Jiras _recentJiras = (from jiraDetails in _recentJiras.Values.ToList() orderby jiraDetails.SeenAt descending select jiraDetails).Take(_maxEntries).ToDictionary(jd => jd.JiraKey, jd => jd); } // Now we can get the title from JIRA itself // ReSharper disable once UnusedVariable var updateTitleTask = DetectedNewJiraIssueAsync(currentJiraDetails); } else { Log.Info().WriteLine("Couldn't match possible JIRA key {0} to projects in a configured JIRA instance, ignoring", projectKey); } }
protected virtual void Browser_TitleChange(object sender, TitleChangeEventArgs e) { }
void WpfWebBrowserHelper_DownloadComplete( object sender, WpfWebBrowserExtender.DownloadCompleteEventArgs e ) { StopButton.Visibility = Visibility.Hidden; RefreshButton.Visibility = Visibility.Visible; BackButton.IsEnabled = IE.CanGoBack; ForwardButton.IsEnabled = IE.CanGoForward; StatusText.Visibility = Visibility.Hidden; if( !String.IsNullOrEmpty( e.PageTitle ) ) { const int maxTitleLength = 20; String pageTitle = e.PageTitle; if( pageTitle.Length > maxTitleLength ) { pageTitle = pageTitle.Substring( 0, maxTitleLength - 3 ) + "..."; } var evetArgs = new TitleChangeEventArgs(); evetArgs.Title = pageTitle; TitleChange( this, evetArgs ); } }
private void m_WebView_OnTitleChange(object sender, TitleChangeEventArgs e) { this.Text = e.Title; }
void OnWebViewTitleChange(object sender, TitleChangeEventArgs e) { this.Text = e.Title; }