mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-07 09:15:50 +02:00
Ensure only one guide window is open and fix webkit element outline
This commit is contained in:
parent
b2f3b245b7
commit
94920fd459
@ -391,7 +391,7 @@ public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
|
||||
}
|
||||
|
||||
if (showGuide){
|
||||
ShowChildForm(new FormGuide());
|
||||
FormGuide.Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ private void FormAbout_HelpButtonClicked(object sender, CancelEventArgs e){
|
||||
}
|
||||
|
||||
private void ShowGuide(){
|
||||
new FormGuide().Show();
|
||||
FormGuide.Show();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
@ -34,23 +34,37 @@ public static bool CheckGuideUrl(string url, out string hash){
|
||||
}
|
||||
}
|
||||
|
||||
public static void Show(string hash = null){
|
||||
string url = GuideUrl+(hash ?? string.Empty);
|
||||
FormGuide guide = FormManager.TryFind<FormGuide>();
|
||||
|
||||
if (guide == null){
|
||||
FormBrowser owner = FormManager.TryFind<FormBrowser>();
|
||||
|
||||
if (owner != null){
|
||||
owner.TriggerAnalyticsEvent(AnalyticsFile.Event.OpenGuide);
|
||||
new FormGuide(url, owner).Show(owner);
|
||||
}
|
||||
}
|
||||
else{
|
||||
guide.Reload(url);
|
||||
guide.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ChromiumWebBrowser browser;
|
||||
|
||||
public FormGuide(string hash = null){
|
||||
private FormGuide(string url, Form owner){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Guide";
|
||||
|
||||
FormBrowser owner = FormManager.TryFind<FormBrowser>();
|
||||
|
||||
if (owner != null){
|
||||
Size = new Size(owner.Size.Width*3/4, owner.Size.Height*3/4);
|
||||
VisibleChanged += (sender, args) => this.MoveToCenter(owner);
|
||||
|
||||
owner.TriggerAnalyticsEvent(AnalyticsFile.Event.OpenGuide);
|
||||
}
|
||||
|
||||
this.browser = new ChromiumWebBrowser(GuideUrl+(hash ?? string.Empty)){
|
||||
this.browser = new ChromiumWebBrowser(url){
|
||||
MenuHandler = new ContextMenuGuide(),
|
||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
@ -73,8 +87,16 @@ public FormGuide(string hash = null){
|
||||
Program.UserConfig.ZoomLevelChanged += Config_ZoomLevelChanged;
|
||||
}
|
||||
|
||||
private void Reload(string url){
|
||||
browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||
browser.Dock = DockStyle.None;
|
||||
browser.Location = ControlExtensions.InvisibleLocation;
|
||||
browser.Load("about:blank");
|
||||
browser.Load(url);
|
||||
}
|
||||
|
||||
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||
if (!e.IsLoading){
|
||||
if (!e.IsLoading && browser.Address != "about:blank"){
|
||||
this.InvokeAsyncSafe(() => {
|
||||
browser.Location = Point.Empty;
|
||||
browser.Dock = DockStyle.Fill;
|
||||
|
@ -71,7 +71,7 @@ public static void OpenExternalBrowser(string url){
|
||||
switch(CheckUrl(url)){
|
||||
case UrlCheckResult.Fine:
|
||||
if (FormGuide.CheckGuideUrl(url, out string hash)){
|
||||
new FormGuide(hash).Show();
|
||||
FormGuide.Show(hash);
|
||||
}
|
||||
else{
|
||||
WindowsUtils.OpenAssociatedProgram(url);
|
||||
|
@ -71,6 +71,7 @@ var init = function(){
|
||||
|
||||
if (element && element.tagName === "SUMMARY"){
|
||||
element.click();
|
||||
element.blur();
|
||||
element.scrollIntoView(true);
|
||||
|
||||
if (window.innerWidth === 0){
|
||||
|
Loading…
Reference in New Issue
Block a user