コード例 #1
0
        public void InjectView(IInstalledPageView view)
        {
            View = view;

            View.FilterTextChanged       += new EventHandler((sender, e) => SyncListView());
            View.HideDependenciesChanged += new EventHandler((sender, e) => SyncListView());
            View.SelectedItemChanged     += OnSelectedItemChanged;
        }
コード例 #2
0
        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();
            }
        }