Files
ShrlAlgoToolkit/Sai.RvKits Setup/Dialogs/WelcomeDialog.xaml.cs
2024-09-22 11:05:41 +08:00

64 lines
2.0 KiB
C#

using System.Windows.Media.Imaging;
using Caliburn.Micro;
using WixSharp;
using WixSharp.UI.Forms;
using WixSharp.UI.WPF;
namespace Sai.RvKits_Setup
{
/// <summary>
/// The standard WelcomeDialog.
/// <para>Follows the design of the canonical Caliburn.Micro View (MVVM).</para>
/// <para>See https://caliburnmicro.com/documentation/cheat-sheet</para>
/// </summary>
/// <seealso cref="WixSharp.UI.WPF.WpfDialog" />
/// <seealso cref="WixSharp.IWpfDialog" />
/// <seealso cref="System.Windows.Markup.IComponentConnector" />
public partial class WelcomeDialog : WpfDialog, IWpfDialog
{
/// <summary>
/// Initializes a new instance of the <see cref="WelcomeDialog" /> class.
/// </summary>
public WelcomeDialog()
{
InitializeComponent();
}
/// <summary>
/// This method is invoked by WixSHarp runtime when the custom dialog content is internally fully initialized.
/// This is a convenient place to do further initialization activities (e.g. localization).
/// </summary>
public void Init()
{
ViewModelBinder.Bind(new WelcomeDialogModel { Host = ManagedFormHost }, this, null);
}
}
/// <summary>
/// ViewModel for standard WelcomeDialog.
/// <para>Follows the design of the canonical Caliburn.Micro ViewModel (MVVM).</para>
/// <para>See https://caliburnmicro.com/documentation/cheat-sheet</para>
/// </summary>
/// <seealso cref="Caliburn.Micro.Screen" />
internal class WelcomeDialogModel : Caliburn.Micro.Screen
{
public ManagedForm Host;
ISession session => Host?.Runtime.Session;
IManagedUIShell shell => Host?.Shell;
public BitmapImage Banner => session?.GetResourceBitmap("WixSharpUI_Bmp_Dialog").ToImageSource();
public bool CanGoPrev => false;
public void GoPrev()
=> shell?.GoPrev();
public void GoNext()
=> shell?.GoNext();
public void Cancel()
=> shell?.Cancel();
}
}