Ejemplo n.º 1
0
        public void FuzzyFilter()
        {
            var tests     = new StringViewModelTests();
            var mproperty = tests.GetPropertyMock("Property");

            var target    = new object();
            var resource  = new Resource <string> (MockResourceProvider.SystemResourcesSource, "@android:string/foo_bar", "value");
            var resource2 = new Resource <string> (MockResourceProvider.SystemResourcesSource, "@android:string/foo_baz", "value");

            var mprovider = new Mock <IResourceProvider>();

            mprovider.Setup(r => r.GetResourcesAsync(target, mproperty.Object, CancellationToken.None)).ReturnsAsync(new[] { resource, resource2 });

            var vm = new ResourceSelectorViewModel(mprovider.Object, new[] { target }, mproperty.Object);

            Assume.That(vm.Resources, Contains.Item(resource));
            Assume.That(vm.Resources, Contains.Item(resource2));

            vm.FilterText = "baz";
            Assert.That(vm.Resources, Does.Not.Contain(resource));
            Assert.That(vm.Resources, Contains.Item(resource2));

            vm.FilterText = "string";
            Assert.That(vm.Resources, Contains.Item(resource));
            Assert.That(vm.Resources, Contains.Item(resource2));
        }
Ejemplo n.º 2
0
        public void RefreshSync()
        {
            var stateFilter = !string.IsNullOrEmpty(Settings.StateFilterName)
                                  ? Settings.StateFilterName
                                  : EntityScreen.StateFilter;

            ResourceSelectorViewModel.Refresh(EntityScreen, stateFilter, _request);
        }
 public ResourceGridWidgetViewModel(Widget model, IApplicationState applicationState,
     IResourceService resourceService, IUserService userService, ICacheService cacheService)
     : base(model, applicationState)
 {
     _applicationState = applicationState;
     _cacheService = cacheService;
     ResourceSelectorViewModel = new ResourceSelectorViewModel(applicationState, resourceService, userService, cacheService);
 }
Ejemplo n.º 4
0
        internal ResourceTableDataSource(ResourceSelectorViewModel resourceSelectorViewModel)
        {
            if (resourceSelectorViewModel == null)
            {
                throw new ArgumentNullException(nameof(resourceSelectorViewModel));
            }

            this.viewModel = resourceSelectorViewModel;
        }
        public RequestResourcePanel(IHostResourceProvider hostResources, ResourceSelectorViewModel viewModel, object value)
        {
            if (hostResources == null)
            {
                throw new ArgumentNullException(nameof(hostResources));
            }

            this.viewModel = viewModel;
            this.viewModel.PropertyChanged += OnPropertyChanged;
            Initialize(hostResources, value);
        }
Ejemplo n.º 6
0
        public void RefreshSync()
        {
            var stateFilter = !string.IsNullOrEmpty(Settings.StateFilterName)
                                  ? Settings.StateFilterName
                                  : EntityScreen.StateFilter;

            if (stateFilter == "*")
            {
                stateFilter = "";
            }
            ResourceSelectorViewModel.Refresh(EntityScreen, stateFilter, _request);
            ResourceSelectorViewModel.AutomationCommandName  = Settings.AutomationCommandName;
            ResourceSelectorViewModel.AutomationCommandValue = Settings.CommandValue;
        }
Ejemplo n.º 7
0
        public void Resources()
        {
            var tests     = new StringViewModelTests();
            var mproperty = tests.GetPropertyMock("Property");

            object target = new object();

            var resource  = new Resource <string> (MockResourceProvider.SystemResourcesSource, "Resource", "value");
            var mprovider = new Mock <IResourceProvider>();

            mprovider.Setup(r => r.GetResourcesAsync(target, mproperty.Object, CancellationToken.None)).ReturnsAsync(new[] { resource });

            var vm = new ResourceSelectorViewModel(mprovider.Object, new[] { target }, mproperty.Object);

            Assert.That(vm.Resources, Contains.Item(resource));
        }
Ejemplo n.º 8
0
 public ResourceDataSource(ResourceSelectorViewModel viewModel) : base()
 {
     this.vm = viewModel;
 }
 public ResourceSelectorWindow(IEnumerable <ResourceDictionary> mergedResources, IResourceProvider resourceProvider, IEnumerable <object> targets, IPropertyInfo property)
 {
     Resources.MergedDictionaries.AddItems(mergedResources);
     DataContext = new ResourceSelectorViewModel(resourceProvider, targets, property);
     InitializeComponent();
 }