public PackageSourcesViewModel(Options options) { DisplayName = "Package Sources"; _options = options; PackageSources = _options.PackageSources; AddCommand = new RelayCommand(Add); RemoveCommand = new RelayCommand(Remove, () => SelectedSource != null); UpdateCommand = new RelayCommand(Update, () => { var x = SelectedSource != null && !PackageSources.Any(n => n.Name == Name && n.Location == Location && n.Provider == Provider); return x; }); CloseCommand = new RelayCommand(TryClose); }
public OptionsViewModel(Options options) { DisplayName = "Options"; Options = options; CloseCommand = new RelayCommand(TryClose); }
public MainViewModel() { DisplayName = "Mg2"; WindowManager = SimpleIoc.Default.GetInstance<IWindowManager>(); ReloadCommand = new RelayCommand(Reload); MarkCommand = new RelayCommand(() => TryMark()); MarkButtonClickCommand = new RelayCommand<RoutedEventArgs>(OnMarkButtonClicked); ReadMarkingsCommand = new RelayCommand(ReadMarkings); SaveMarkingsAsCommand = new RelayCommand(SaveMarkingsAs); CloseCommand = new RelayCommand(TryClose); UnmarkAllCommand = new RelayCommand(UnmarkAll, () => PackageItems.Any(n => !n.IsUnmarked)); ApplyMarkedChangesCommand = new RelayCommand(ApplyMarkedChanges, () => PackageItems.Any(n => !n.IsUnmarked)); UnmarkCommand = new RelayCommand(Unmark, () => SelectedPackageItem != null && SelectedPackageItem.CanBeMarked(PackageMark.Unmarked)); MarkForInstallationCommand = new RelayCommand(MarkForInstallation, () => SelectedPackageItem != null && SelectedPackageItem.CanBeMarked(PackageMark.MarkedForInstallation)); MarkForUpdateCommand = new RelayCommand(MarkForUpdate, () => SelectedPackageItem != null && SelectedPackageItem.CanBeMarked(PackageMark.MarkedForUpdate)); MarkForRemovalCommand = new RelayCommand(MarkForRemoval, () => SelectedPackageItem != null && SelectedPackageItem.CanBeMarked(PackageMark.MarkedForRemoval)); PropertiesCommand = new RelayCommand(() => WindowManager.ShowDialog(new PropertiesViewModel(SelectedPackageItem)), () => SelectedPackageItem != null); OptionsCommand = new RelayCommand(() => WindowManager.ShowDialog(new OptionsViewModel(Options))); RepositoriesCommand = new RelayCommand(() => WindowManager.ShowDialog(new PackageSourcesViewModel(Options))); FiltersCommand = new RelayCommand(() => WindowManager.ShowDialog(new FiltersViewModel(Filters))); ContentsCommand = new RelayCommand(ShowHelpContents); AboutCommand = new RelayCommand(() => WindowManager.ShowDialog(new AboutViewModel())); PackageItems = new List<PackageItem>(); IsIdle = true; PackageManager = SimpleIoc.Default.GetInstance<IPackageManager>(); Options = new Options(); Options.Load(); InitializeFilters(); Load(); }