private void CreateNsiFileCommandAction() { var sb = new StringBuilder(); if (UserVariablesViewModel.HasMUI) { sb.Append("!include \"${NSISDIR}\\Contrib\\Modern UI\\System.nsh\"" + Environment.NewLine); } if (RegistryViewModel.RegistrySectionNeeded) { sb.Append("!include Registry.nsh" + Environment.NewLine); } sb.Append(Environment.NewLine); sb.Append(UserVariablesViewModel.GetInstallDataToNsi()); sb.Append(GeneralViewModel.GetInstallDataToNsi()); sb.Append(PagesViewModel.GetInstallDataToNsi()); sb.Append(SectionsViewModel.GetInstallDataToNsi()); var filename = GetFilenameToSaveEvent?.Invoke(); if (!string.IsNullOrWhiteSpace(filename)) { File.WriteAllText(filename, sb.ToString()); } }
public MainWindowViewModel() { GeneralViewModel = new GeneralViewModel(); UserVariablesViewModel = new UserVariablesViewModel(); ShortcutsViewModel = new ShortcutsViewModel(UserVariablesViewModel); FilesViewModel = new FilesViewModel(GeneralViewModel, ShortcutsViewModel, UserVariablesViewModel); RegistryViewModel = new RegistryViewModel(); PagesViewModel = new PagesViewModel(); SectionsViewModel = new SectionsViewModel(FilesViewModel, RegistryViewModel); CreateNsiFileCommand = new CommandAction(CreateNsiFileCommandAction); LoadNsiFileCommand = new CommandAction(LoadNsiFileCommandAction); }