예제 #1
0
        public void SetTitle(string caller, string?name)
        {
            if (name == null && (!_lastCaller?.Equals(caller) ?? false))
            {
                return;
            }

            _lastCaller = caller;
            OnTitleChange?.Invoke(name);
        }
예제 #2
0
        private void browser_TitleChanged(object sender, TitleChangedEventArgs args)
        {
            mainTabPage.InvokeOnUiThreadIfRequired(() =>
            {
                try
                {
                    //Sets a string for the title
                    string p_title = args.Title;

                    //Activating the History title
                    AddHistoryEntry(args.Title, HistoryValueType.Title);

                    //Change the string to a list of Chars
                    List <Char> p_List = p_title.ToCharArray().ToList();

                    //Initialize the final string and the max length.
                    string finalString  = string.Empty;
                    int maxStringLength = 18;

                    //Finally initialize the end string
                    string endString = "...";

                    //For loop for each int in maxStringLength
                    for (int i = 0; i < maxStringLength; i++)
                    {
                        //Initialize a string for the tmpChar
                        string tmpChar;

                        //Tries to set the Char in the List to a String
                        try { tmpChar = p_List[i].ToString(); } catch { break; }
                        if (tmpChar == null)
                        {
                            break;
                        }

                        //Adds to the final string
                        finalString = finalString + tmpChar;

                        //If the string is equal to max length, adds the end string.
                        if (i == maxStringLength - 1)
                        {
                            finalString = finalString + endString; break;
                        }
                    }

                    //Returns the event
                    OnTitleChange?.Invoke(browser, new DocumentTitleChange {
                        DocumentTitle = finalString
                    });
                }
                catch { }
            });
        }
예제 #3
0
 public void ChangeTitle(string Title)
 {
     OnTitleChange?.Invoke(browser, new DocumentTitleChange {
         DocumentTitle = Title
     });
 }