Exemplo n.º 1
0
        public override void Select <T>(LookupOptions options, Action <SelectionResult> success, SelectOptions selectOptions)
        {
            var t = typeof(T);
            RegionSelectorContentProvider selectionContent = null;

            if (typeof(Region).IsAssignableFrom(t))
            {
                selectionContent = new RegionSelectorContentProvider(User, (n) => { return(n.ElemType != "Region"); }, "Region", SiteExplorerNodeType.Region);
            }
            else if (typeof(Site).IsAssignableFrom(t))
            {
                selectionContent = new RegionSelectorContentProvider(User, (n) => { return(n.ElemType != "Site"); }, "Site", SiteExplorerNodeType.Site);
            }
            else if (typeof(Trap).IsAssignableFrom(t))
            {
                selectionContent = new RegionSelectorContentProvider(User, (n) => { return(n.ElemType == "Material" || n.ElemType == "SiteVisit"); }, "Trap", SiteExplorerNodeType.Trap);
            }
            else if (typeof(Data.Model.Material).IsAssignableFrom(t))
            {
                selectionContent = new RegionSelectorContentProvider(User, (n) => { return(false); }, "", SiteExplorerNodeType.Material);
            }
            else if (typeof(SiteExplorerNode).IsAssignableFrom(t))
            {
                selectionContent = new RegionSelectorContentProvider(User, (n) => {
                    return(n.ElemType != "Region" && n.ElemType != "Site" && n.ElemType != "SiteGroup");
                }, "", SiteExplorerNodeType.Region, SiteExplorerNodeType.Site);
            }
            else
            {
                throw new Exception("Unhandled Selection Type: " + t.Name);
            }

            if (selectionContent != null)
            {
                var frm = new HierarchicalSelector(User, selectionContent, success);
                frm.Owner = ParentWindow;
                frm.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
                frm.ShowDialog();
            }
        }
        public override void Select <T>(LookupOptions options, Action <SelectionResult> success, SelectOptions selectOptions)
        {
            var t = typeof(T);
            IHierarchicalSelectorContentProvider selectionContent;

            if (typeof(Taxon).IsAssignableFrom(t))
            {
                selectionContent = new TaxonSelectorContentProvider(User, _explorer.Content as TaxonExplorer, options);
            }
            else
            {
                throw new Exception("Unhandled Selection Type: " + t.Name);
            }


            var frm = new HierarchicalSelector(User, selectionContent, success)
            {
                Owner = ParentWindow, WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            frm.ShowDialog();
        }
Exemplo n.º 3
0
        public void TestSingleStarMatch3()
        {
            var nr = new HierarchicalSelector("/*/*/*/c");

            Assert.IsFalse(nr.IsMatch("/a/b/c"));
        }
Exemplo n.º 4
0
        public void TestDoubleStarMatch()
        {
            var nr = new HierarchicalSelector("/**/c");

            Assert.IsTrue(nr.IsMatch("/a/b/c"));
        }