Guest User

Untitled

a guest
Feb 24th, 2018
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. var installApiController = new InstallApiController();
  2. var installSetup = installApiController.GetSetup();
  3.  
  4. var instructions = new Dictionary<string, JToken>();
  5.  
  6. var databaseModel = new DatabaseModel
  7. {
  8. DatabaseType = DatabaseType.SqlCe
  9. };
  10. var userModel = new UserModel
  11. {
  12. Email = "my@email.com",
  13. Name = "My name",
  14. Password = "somepassword",
  15. SubscribeToNewsLetter = false
  16. };
  17.  
  18. foreach (var step in installSetup.Steps)
  19. {
  20. if (step.StepType == typeof(DatabaseModel))
  21. {
  22. instructions.Add(step.Name, JToken.FromObject(databaseModel));
  23. }
  24. else if (step.StepType == typeof(UserModel))
  25. {
  26. instructions.Add(step.Name, JToken.FromObject(userModel));
  27. }
  28. }
  29.  
  30. var installInstructions = new InstallInstructions
  31. {
  32. InstallId = installSetup.InstallId,
  33. Instructions = instructions
  34. };
  35.  
  36. InstallProgressResultModel progressInfo = null;
  37. do
  38. {
  39. string stepName = "";
  40. if (progressInfo != null)
  41. {
  42. stepName = progressInfo.NextStep;
  43. }
  44.  
  45. try
  46. {
  47. progressInfo = installApiController.PostPerformInstall(installInstructions);
  48. }
  49. catch (Exception e)
  50. {
  51. throw new Exception(stepName, e);
  52. }
  53.  
  54. }
  55. while (progressInfo.ProcessComplete == false);
Add Comment
Please, Sign In to add comment