예제 #1
0
        public MainWindowViewModel(AutoCompleteBasedOnLucene autoCompleteText, IGetActionsForItem getActionsForItem,
                                   Logger log, UpdateManagerAdapter updateManager, IWindowManager windowManager,
                                   Shutdown shutdown)
        {
            _autoCompleteText  = autoCompleteText;
            _getActionsForItem = getActionsForItem;
            _log = log;

            _updateManager = updateManager;
            _windowManager = windowManager;
            _shutdown      = shutdown;
            _updateManager.UpdatesAvailable += (sender, args) =>
            {
                {
                    Status.SetMessage(this, "Update available, downloading");
                    _updateManager.PrepareUpdates();
                }
            };
            _updateManager.UpdatesReady += (sender, args) =>
            {
                Status.SetMessage(this, "Update prepared, ready for install");
                NotifyOfPropertyChange(() => UpdateVisible);
                NotifyOfPropertyChange(() => CanUpdate);
            };

            _cancelationTokenSource         = new CancellationTokenSource();
            _argumentCancelationTokenSource = new CancellationTokenSource();
            CommandOptions =
                new ListWithCurrentSelection <AutoCompletionResult.CommandResult>(
                    new AutoCompletionResult.CommandResult(new TextItem(string.Empty), null));
            ArgumentOptions = new ListWithCurrentSelection <string>();
            Result          = CommandOptions.Current;
        }
        public MainWindowViewModel(AutoCompleteBasedOnLucene autoCompleteText, IGetActionsForItem getActionsForItem,
            Logger log, UpdateManagerAdapter updateManager, IWindowManager windowManager,
            Shutdown shutdown)
        {
            _autoCompleteText = autoCompleteText;
            _getActionsForItem = getActionsForItem;
            _log = log;

            _updateManager = updateManager;
            _windowManager = windowManager;
            _shutdown = shutdown;
            _updateManager.UpdatesAvailable += (sender, args) =>
            {
                {
                    Status.SetMessage(this, "Update available, downloading");
                    _updateManager.PrepareUpdates();
                }
            };
            _updateManager.UpdatesReady += (sender, args) =>
            {
                Status.SetMessage(this, "Update prepared, ready for install");
                NotifyOfPropertyChange(() => UpdateVisible);
                NotifyOfPropertyChange(() => CanUpdate);
            };

            _cancelationTokenSource = new CancellationTokenSource();
            _argumentCancelationTokenSource = new CancellationTokenSource();
            CommandOptions =
                new ListWithCurrentSelection<AutoCompletionResult.CommandResult>(
                    new AutoCompletionResult.CommandResult(new TextItem(string.Empty), null));
            ArgumentOptions = new ListWithCurrentSelection<string>();
            Result = CommandOptions.Current;
        }