Beispiel #1
0
 public UpdateService()
 {
     var loc = new LocalServiceLocator();
     CoApp = loc.CoAppService;
     UpdateSettings = loc.UpdateSettingsService;
     AllPossibleProducts = new Dictionary<Product, bool>();
 }
        public FeedSettingsViewModel()
        {
            Title = "Feeds";
            CoAppService = new LocalServiceLocator().CoAppService;
            Add =
                new RelayCommand<string>(
                    (feedUrl) =>
                        {

                            RaiseAllCanExecutesChanged(false);
                            CoAppService.AddSystemFeed(feedUrl).ContinueWith((t) => ReloadFeeds()).ContinueWith(
                                t => RaiseAllCanExecutesChanged(true));
                        });
            Remove =
                new RelayCommand<string>(
                    (feedUrl) =>
                        {
                            RaiseAllCanExecutesChanged(false);
                            CoAppService.RemoveSystemFeed(feedUrl).ContinueWith((t) => ReloadFeeds()).ContinueWith(
                                t =>
                                    RaiseAllCanExecutesChanged(true));

                        });

            //if can't elevate, do something
            ElevateAdd = new RelayCommand<string>((s) => CoAppService.Elevate().ContinueAlways(t => ReloadPolicies()).ContinueWith((t) => Add.Execute(s)));
            ElevateRemove = new RelayCommand<string>((s) => CoAppService.Elevate().ContinueWith(t => ReloadPolicies()).ContinueWith((t) => Remove.Execute(s)));
            Loaded += ReloadFeeds;
        }
Beispiel #3
0
 public ActivityService()
 {
     CoApp = new LocalServiceLocator().CoAppService;
     Activities = new ObservableCollection<Activity>();
     ((ObservableCollection<Activity>) Activities).CollectionChanged +=
         (s, a) => Messenger.Default.Send(new ActivitiesUpdatedMessage());
 }
Beispiel #4
0
 public PackageViewModel()
 {
     Loaded += OnLoad;
     var loc = new LocalServiceLocator();
     CoApp = loc.CoAppService;
     VmLoc = new ViewModelLocator();
     Nav = loc.NavigationService;
     Activity = loc.ActivityService;
 }
Beispiel #5
0
        public HomeViewModel()
        {
            Loaded += OnLoaded;
            var loc = new LocalServiceLocator();
            Featured = loc.FeaturedService;
            CoApp = loc.CoAppService;

            GoToSearch = new RelayCommand(() => loc.NavigationService.GoTo(new ViewModelLocator().SearchViewModel));
        }
Beispiel #6
0
        public PolicyService()
        {
            var loc = new LocalServiceLocator();
            CoApp = loc.CoAppService;
            CoApp.Elevated += CoAppOnElevated;

            UserService = loc.WindowsUserService;
            _policyTask = CoApp.Policies;
        }
        public PrivacySettingsViewModel()
        {
            Title = "Privacy";
             CoApp = new LocalServiceLocator().CoAppService;

             Loaded += OnLoaded;

             Save = new RelayCommand(OnSave );
             ElevateSave = new RelayCommand(OnElevateSave);
        }
 public UpdateSettingsViewModel()
 {
     Title = "Update";
     Loaded += OnLoaded;
     Save = new RelayCommand(ExecuteSave);
     var loc = new LocalServiceLocator();
     UpdateService = loc.UpdateSettingsService;
     CoApp = loc.CoAppService;
     ElevateSave = new RelayCommand(ExecuteElevateSave);
 }
Beispiel #9
0
        public ProductViewModel()
        {
            var loc = new LocalServiceLocator();
            CoApp = loc.CoAppService;
            Nav = loc.NavigationService;
            Activity = loc.ActivityService;
            VmLoc = new ViewModelLocator();

            Loaded += OnLoad;
        }
        public PermissionsSettingsViewModel()
        {
            Title = "Permissions";
            MessengerInstance.Register<PoliciesUpdatedMessage>(this, GetPoliciesAgain);
            Updating = new PermissionViewModel();
            Installing = new PermissionViewModel();
            Remove = new PermissionViewModel();
            //Active = new PermissionViewModel();
            //Block = new PermissionViewModel();
            //Require = new PermissionViewModel();
            SetState = new PermissionViewModel();

            ChangeSystemFeed = new PermissionViewModel();
            Policy = new LocalServiceLocator().PolicyService;
            CoApp = new LocalServiceLocator().CoAppService;
            Save = new RelayCommand(ExecuteSave);
            ElevateSave = new RelayCommand(ExecuteElevateSave);

            Loaded += OnLoaded;

            UserName = Policy.UserName;
        }
Beispiel #11
0
        public SearchViewModel()
        {
            Loc = new LocalServiceLocator();

            CoApp = Loc.CoAppService;
            Vm = new ViewModelLocator();

            FrictionlessSort = PossibleSorts[0].Create(ListSortDirection.Ascending);

            AddFilter = new RelayCommand<GUIFilterBase>(i =>
                                                            {
                                                                AppliedFilters.Add(i.Create());
                                                                RaisePropertyChanged("FiltersToShow");

                                                                ApplyFilters();
                                                            });
            RemoveFilter = new RelayCommand<FrictionlessFilter>(i =>
                                                                    {
                                                                        AppliedFilters.Remove(i);
                                                                        RaisePropertyChanged("FiltersToShow");
                                                                        ApplyFilters();
                                                                    });

            Sort = new RelayCommand<SortDescriptor>(i =>
                                                        {
                                                            FrictionlessSort = i.Create(ListSortDirection.Ascending);
                                                            ApplyFilters();
                                                        });

            SortDescending = new RelayCommand<SortDescriptor>(i =>
                                                                  {
                                                                      FrictionlessSort =
                                                                          i.Create(ListSortDirection.Descending);
                                                                      ApplyFilters();
                                                                  });

            Loaded += OnLoaded;
            GoToProduct = new RelayCommand<ProductInfo>(p => Loc.NavigationService.GoTo(Vm.GetProductViewModel(p.CanonicalName)));
        }
Beispiel #12
0
 public PolicyServiceSample()
 {
     CoApp = new LocalServiceLocator().CoAppService;
 }
        public SelectUpdatesViewModel()
        {
            Title = "Select the updates you want to install";
            Products = new CollectionViewSource {Source = ProductList};

            Products.GroupDescriptions.Add(new PropertyGroupDescription("Product.IsUpgrade",
                                                                        new IsUpgradeToNiceConverter()));
            var loc = new LocalServiceLocator();
            _updateService = loc.UpdateService;
            CoApp = loc.CoAppService;

            Save = new RelayCommand(() =>
                                        {
                                            Parallel.ForEach(ProductList.ToArray(), i =>
                                                                                        {
                                                                                            if (i.IsSelected)
                                                                                            {
                                                                                                _updateService.
                                                                                                    SelectProduct(
                                                                                                        i.Product);
                                                                                            }
                                                                                            else
                                                                                                _updateService.
                                                                                                    UnselectProduct(
                                                                                                        i.Product);

                                                                                        });
                                            loc.NavigationService.GoTo(ViewModelLocator.PrimaryViewModelStatic);
                                        });

            ElevateBlock = new RelayCommand<SelectableProduct>(ExecuteElevateBlock, p => true);
            Block = new RelayCommand<SelectableProduct>(ExecuteBlock, p => true);

            Loaded += OnLoaded;
        }
Beispiel #14
0
 public FeaturedService()
 {
     CoApp = new LocalServiceLocator().CoAppService;
 }
        public AskToCreateEventViewModel()
        {
            Title = "Automatically update CoApp packages?";
            UpdateService = new LocalServiceLocator().UpdateService;
            CoAppService = new LocalServiceLocator().CoAppService;
            ElevateSetScheduledTask = new RelayCommand(RunElevateSetScheduleTask);
            DontScheduleTask = new RelayCommand(Leave);
            SetScheduledTask = new RelayCommand(() =>
                                                    {
                                                        UpdateService.SetDefaultScheduledTask().ContinueWith(t =>
                                                                                                                 {
                                                                                                                     if
                                                                                                                         (
                                                                                                                         t
                                                                                                                             .
                                                                                                                             IsCanceled ||
                                                                                                                         t
                                                                                                                             .
                                                                                                                             IsFaulted)
                                                                                                                     {
                                                                                                                         Logger
                                                                                                                             .
                                                                                                                             Error
                                                                                                                             ("We couldn't set update task. {0} {1}",
                                                                                                                              t
                                                                                                                                  .
                                                                                                                                  Exception
                                                                                                                                  .
                                                                                                                                  Message,
                                                                                                                              t
                                                                                                                                  .
                                                                                                                                  Exception
                                                                                                                                  .
                                                                                                                                  StackTrace);

                                                                                                                         var
                                                                                                                             modalModel
                                                                                                                                 = new BasicModalViewModel
                                                                                                                                       {
                                                                                                                                           Title
                                                                                                                                               =
                                                                                                                                               "We couldn't set update task",
                                                                                                                                           Content
                                                                                                                                               =
                                                                                                                                               "The update task couldn't be set",
                                                                                                                                       };
                                                                                                                         modalModel
                                                                                                                             .
                                                                                                                             SetViaButtonDescriptions
                                                                                                                             (new List
                                                                                                                                  <
                                                                                                                                  ButtonDescription
                                                                                                                                  >
                                                                                                                                  {
                                                                                                                                      new ButtonDescription
                                                                                                                                          {
                                                                                                                                              Title
                                                                                                                                                  =
                                                                                                                                                  "Continue"
                                                                                                                                          }
                                                                                                                                  });

                                                                                                                         MessengerInstance
                                                                                                                             .
                                                                                                                             Send
                                                                                                                             (
                                                                                                                                 new MetroDialogBoxMessage
                                                                                                                                     {
                                                                                                                                         ModalViewModel
                                                                                                                                             =
                                                                                                                                             modalModel
                                                                                                                                     }
                                                                                                                             );
                                                                                                                     }

                                                                                                                     Leave
                                                                                                                         ();
                                                                                                                 });
                                                    });
        }
 public UpdateSettingsService()
 {
     CoApp = new LocalServiceLocator().CoAppService;
 }