public MainWindowController(ChocolateyService chocolateyService, WindowsTaskService windowsTaskService, ShortcutService shortcutService, CandyShopContext candyShopContext) { ChocolateyService = chocolateyService; WindowsTaskService = windowsTaskService; ShortcutService = shortcutService; CandyShopContext = candyShopContext; }
public CandyShopApplicationContext(CandyShopContext context) { Log.Debug("Launched CandyShop."); // init services ChocolateyService chocolateyService = new ChocolateyService(); WindowsTaskService windowsTaskService = new WindowsTaskService(); ShortcutService shortcutService = new ShortcutService(); // LoadOutdatedPackagesAsync(chocolateyService); // init controller MainWindowController candyShopController = new MainWindowController(chocolateyService, windowsTaskService, shortcutService, context); InstalledPageController installedPageController = new InstalledPageController(chocolateyService); // init views IMainWindowView mainView = new MainWindow(candyShopController); IInstalledPageView pageView = mainView.InstalledPackagesPage; installedPageController.InjectView(pageView); candyShopController.InjectView(mainView); // launch with form or in tray if (context.LaunchedMinimized) { // creates a tray icon, displays a notification if outdated packages // are found and opens the upgrade UI on click RunInBackground(candyShopController, chocolateyService); } else { // launch window candyShopController.InitView(); installedPageController.InitView(); } }