Skip to content

Commit

Permalink
jesus PR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusongit committed Nov 29, 2023
1 parent 066e83c commit 8c5d317
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,15 @@ public void OnRequestStaticSplashScreen()
}

/// <summary>
/// Constructor
/// Stores the value that indicates if the SignIn Button will be enabled(default) or not
/// </summary>
public SplashScreen()
bool enableSignInButton;

/// <summary>
/// Splash Screen Constructor.
/// <paramref name="enableSignInButton"/> Indicates if the SignIn Button will be enabled(default) or not.
/// </summary>
public SplashScreen(bool enableSignInButton = true)
{
InitializeComponent();

Expand All @@ -150,6 +156,7 @@ public SplashScreen()
RequestImportSettings = ImportSettings;
RequestSignIn = SignIn;
RequestSignOut = SignOut;
this.enableSignInButton = enableSignInButton;
}

private void DynamoModel_LanguageDetected()
Expand Down Expand Up @@ -352,6 +359,7 @@ internal async void SetLoadingDone()
{
await webView.CoreWebView2.ExecuteScriptAsync($"window.setLoadingDone()");
await webView.CoreWebView2.ExecuteScriptAsync($"window.setTotalLoadingTime(\"{Wpf.Properties.Resources.SplashScreenTotalLoadingTimeLabel} {totalLoadingTime}ms\")");
SetSignInEnable(enableSignInButton);
}
}

Expand Down Expand Up @@ -410,6 +418,17 @@ internal async void HandleSignInStatusChange(bool status)
}
}

/// <summary>
/// Enable or disable the SignIn button on splash screen.
/// </summary>
/// <param name="enabled"></param>
internal async void SetSignInEnable(bool enabled)
{
if (webView?.CoreWebView2 != null)
{
await webView.CoreWebView2.ExecuteScriptAsync(@$"window.setEnableSignInButton({{""enable"": ""{enabled}""}})");
}
}
/// <summary>
/// Setup the values for all labels on splash screen using resources
/// </summary>
Expand Down

0 comments on commit 8c5d317

Please sign in to comment.