private static void Main() { var culture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = culture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var installer = new FrmInstaller(); installer.Add(installer.CreatePage<WelcomePage>()); installer.Add(installer.CreatePage<LicensePage>()); installer.Add(installer.CreatePage<FeaturePage>(new FeaturePage.Model())); installer.Add(installer.CreatePage<SummaryPage>()); installer.Add(installer.CreatePage<InstallingPage>()); installer.Add(installer.CreatePage<FinishPage>()); Application.Run(installer); /* Initialize page models and pages by host model */ var installerModel = new InstallerModel { { typeof(WpfWizardPage<WelcomeWpfPage>), new WelcomePageModel() }, { typeof(HtmlWizardPage<WelcomeHtmlPageModel>), new WelcomeHtmlPageModel(Resources.WelcomeHtmlPage) { WelcomePageFlag = false } }, { typeof(LicensePage), null }, { typeof(FeaturePage), new FeaturePage.Model() }, { typeof(SummaryPage), null }, { typeof(InstallingPage), null }, { typeof(FinishPage), null }, { typeof(HtmlWizardPage<HtmlWizardPageModel>), new HtmlWizardPageModel(new Uri("http://www.cnblogs.com/daxnet/p/4612509.html")) } }; Application.Run(new FrmInstaller(installerModel)); }
public MainViewModel() { _installerModel = new InstallerModel(); EditDataCommand = new Command(EditData); MaterialsReadCommand = new Command(MaterialsRead); MakeReadOnlyCopyCommand = new Command(MakeReadOnlyCopy); }
public void InitializeTest() { InstallerModel dataModel = new InstallerModel(null); _wizardPage = new WizardPageMock( dataModel, new InstallerWizard( null, null, dataModel, true)); }
public async Task <IActionResult> Install(InstallerModel installerModel) { if (!await AllowInstaller()) { return(Json(new { success = false, messages = new[] { ValidationMessages.CannotProceedAlreadyInstalled } })); } if (ModelState.IsValid) { await using var transaction = await _context.Database.BeginTransactionAsync(); var user = Mapper.MapToEntity(installerModel); user.EmailConfirmed = true; var userResult = await _userManager.CreateAsync(user, installerModel.Password); if (userResult.Succeeded) { var roleResult = await _userManager.AddToRoleAsync(user, Utilities.Roles.Administrator); if (roleResult.Succeeded) { await transaction.CommitAsync(); TempData["SuccessMessage"] = new[] { OtherMessages.InstalledSuccessfully }; return(Json(new { success = true, destination = Url.Action("SignIn", "SignIn") })); } } await transaction.RollbackAsync(); ModelState.AddModelError("SomethingWrong", OtherMessages.SomethingWrong); } return(Json(new { success = false, messages = ModelState.SelectMany(state => state.Value.Errors).Select(error => error.ErrorMessage) })); }
/// <summary> /// Initializes a new instance of the <see cref="WizardPageMock"/> class. /// </summary> /// <param name="model">The view model to bind to this control.</param> /// <param name="context">The wizard context instance.</param> public WizardPageMock( InstallerModel model, InstallerWizard context) : base(model, context) { }
public static IdentityUser <Guid> MapToEntity(InstallerModel installerModel) => new IdentityUser <Guid> { UserName = installerModel.Username, Email = installerModel.Email };