Skip to content

Commit

Permalink
Rename FastSplashScreen to SimpleSplashScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
dotMorten committed Nov 19, 2024
1 parent 0faf8a9 commit 4595776
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions docs/concepts/Splashscreen.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## Splash Screen

WinUIEx provides two kinds of splash screens:
- `FastSplashScreen`: A simple splash screen that shows just an image and can be launched before any UI loads.
- `SimpleSplashScreen`: A simple splash screen that shows just an image and can be launched before any UI loads.
- `SplashScreen`: A more advanced splash screen that can show any XAML including a progress bar and status text.


### FastSplashScreen
### SimpleSplashScreen

`FastSplashScreen` will show an image while the app is loading. To use it, create a new `FastSplashScreen` in App.xaml.cs:
`SimpleSplashScreen` will show an image while the app is loading. To use it, create a new `SimpleSplashScreen` in App.xaml.cs:

```cs
private FastSplashScreen vss { get; set; }
private SimpleSplashScreen vss { get; set; }

public App()
{
fss = FastSplashScreen.ShowDefaultSplashScreen(); // Shows the splash screen you already defined in your app manifest. For unpackaged apps use .ShowSplashScreenImage(imagepath):
// fss = FastSplashScreen.ShowSplashScreenImage(full_path_to_image_); // Shows a custom splash screen image. Must be a full-path (no relative paths)
fss = SimpleSplashScreen.ShowDefaultSplashScreen(); // Shows the splash screen you already defined in your app manifest. For unpackaged apps use .ShowSplashScreenImage(imagepath):
// fss = SimpleSplashScreen.ShowSplashScreenImage(full_path_to_image_); // Shows a custom splash screen image. Must be a full-path (no relative paths)
this.InitializeComponent();
}
```
Expand Down Expand Up @@ -52,7 +52,7 @@ and instead defining your own start method. You'll then be able to display the s
// If you're using the WebAuthenticator, make sure you call this method first before the splashscreen shows
if (WebAuthenticator.CheckOAuthRedirectionActivation(true))
return;
var fss = FastSplashScreen.ShowDefaultSplashScreen();
var fss = SimpleSplashScreen.ShowDefaultSplashScreen();
WinRT.ComWrappersSupport.InitializeComWrappers();
Microsoft.UI.Xaml.Application.Start((p) => {
var context = new Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext(Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace WinUIEx
/// Once your application window has launched/loaded, The splashscreen should be removed by either disposing this instance or calling <see cref="Hide(TimeSpan)"/>.
/// </remarks>
/// <seealso cref="SplashScreen"/>
public sealed class FastSplashScreen : IDisposable
public sealed class SimpleSplashScreen : IDisposable
{
private const nint COLOR_BACKGROUND = 1;

Expand All @@ -41,7 +41,7 @@ public sealed class FastSplashScreen : IDisposable
/// </summary>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public static FastSplashScreen ShowDefaultSplashScreen()
public static SimpleSplashScreen ShowDefaultSplashScreen()
{
var image = GetManifestSplashScreen();
if (image is null)
Expand All @@ -55,7 +55,7 @@ public static FastSplashScreen ShowDefaultSplashScreen()
var splashScreenImageResource = manager.MainResourceMap.TryGetValue("Files/" + image.Replace('\\','/'), context);
if (splashScreenImageResource is not null && splashScreenImageResource.Kind == Microsoft.Windows.ApplicationModel.Resources.ResourceCandidateKind.FilePath)
{
return FastSplashScreen.ShowSplashScreenImage(splashScreenImageResource.ValueAsString);
return SimpleSplashScreen.ShowSplashScreenImage(splashScreenImageResource.ValueAsString);
}
throw new InvalidOperationException("Splash screen image not found in resources");
}
Expand All @@ -82,18 +82,18 @@ public static FastSplashScreen ShowDefaultSplashScreen()
/// </summary>
/// <param name="image"></param>
/// <returns></returns>
public static FastSplashScreen ShowSplashScreenImage(string image)
public static SimpleSplashScreen ShowSplashScreenImage(string image)
{
var s = new FastSplashScreen();
var s = new SimpleSplashScreen();
s.Initialize();
var hBitmap = s.GetBitmap(image);
s.DisplaySplash(Windows.Win32.Foundation.HWND.Null, hBitmap, null);
return s;
}
#if MEDIAPLAYER
public static FastSplashScreen ShowSplashScreenVideo(string video)
public static SimpleSplashScreen ShowSplashScreenVideo(string video)
{
var s = new FastSplashScreen();
var s = new SimpleSplashScreen();
s.Initialize();
s.DisplaySplash(Windows.Win32.Foundation.HWND.Null, Windows.Win32.Graphics.Gdi.HBITMAP.Null, video);
return s;
Expand Down Expand Up @@ -145,7 +145,7 @@ private void CleanUp()
/// <summary>
/// Finalizer
/// </summary>
~FastSplashScreen() => Dispose(false);
~SimpleSplashScreen() => Dispose(false);

private unsafe void DisplaySplash(Windows.Win32.Foundation.HWND hWnd, Windows.Win32.Graphics.Gdi.HBITMAP bitmap, string? sVideo)
{
Expand Down Expand Up @@ -212,11 +212,11 @@ private struct BITMAP
#if MEDIAPLAYER
private class MFPlayer : IMFPMediaPlayerCallback, IDisposable
{
private readonly FastSplashScreen m_ss;
private readonly SimpleSplashScreen m_ss;
private readonly Windows.Win32.Foundation.HWND m_hWndParent;
private readonly IMFPMediaPlayer m_pMediaPlayer;

internal unsafe MFPlayer(FastSplashScreen ss, Windows.Win32.Foundation.HWND hWnd, string sVideo)
internal unsafe MFPlayer(SimpleSplashScreen ss, Windows.Win32.Foundation.HWND hWnd, string sVideo)
{
GlobalStructures.HRESULT hr = MFPlayTools.MFPCreateMediaPlayer(sVideo, false, MFPlay.MFPlayTools.MFP_CREATION_OPTIONS.MFP_OPTION_NONE, this, hWnd, out m_pMediaPlayer);
m_hWndParent = hWnd;
Expand Down
2 changes: 1 addition & 1 deletion src/WinUIEx/SplashScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace WinUIEx
/// A splash screen window for rendering XAML that shows with no chrome, and once <see cref="SplashScreen.OnLoading"/> has completed,
/// opens a new window.
/// </summary>
/// <seealso cref="FastSplashScreen"/>
/// <seealso cref="SimpleSplashScreen"/>
public class SplashScreen : Window
{
private Window? _window;
Expand Down
6 changes: 3 additions & 3 deletions src/WinUIExSample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public App()
#if !DISABLE_XAML_GENERATED_MAIN // With custom main, we'd rather want to do this code in main
if (WebAuthenticator.CheckOAuthRedirectionActivation())
return;
fss = FastSplashScreen.ShowDefaultSplashScreen();
fss = SimpleSplashScreen.ShowDefaultSplashScreen();
#endif
this.InitializeComponent();
int length = 0;
Expand All @@ -39,7 +39,7 @@ public App()
}

}
internal FastSplashScreen fss { get; set; }
internal SimpleSplashScreen fss { get; set; }
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
Expand Down Expand Up @@ -156,7 +156,7 @@ static void Main(string[] args)
{
if (WebAuthenticator.CheckOAuthRedirectionActivation(true))
return;
var fss = FastSplashScreen.ShowDefaultSplashScreen();
var fss = SimpleSplashScreen.ShowDefaultSplashScreen();
global::WinRT.ComWrappersSupport.InitializeComWrappers();
global::Microsoft.UI.Xaml.Application.Start((p) => {
var context = new global::Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext(global::Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread());
Expand Down

0 comments on commit 4595776

Please sign in to comment.