Ejemplo n.º 1
0
        private VisioAutomation.ShapeSheet.Query.CellQuery _create_query(
            VisioPowerShell.Models.NamedSrcDictionary dicof_named_to_cell,
            IList <string> cellnames)
        {
            var invalid_names = cellnames.Where(cellname => !dicof_named_to_cell.ContainsKey(cellname)).ToList();

            if (invalid_names.Count > 0)
            {
                string msg = "Invalid cell names: " + string.Join(",", invalid_names);
                throw new ArgumentException(msg);
            }

            var query = new VisioAutomation.ShapeSheet.Query.CellQuery();

            foreach (string cellname in cellnames)
            {
                foreach (var resolved_cellname in dicof_named_to_cell.ExpandKeyWildcard(cellname))
                {
                    if (!query.Columns.Contains(resolved_cellname))
                    {
                        var resolved_src = dicof_named_to_cell[resolved_cellname];
                        query.Columns.Add(resolved_src, resolved_cellname);
                    }
                }
            }

            return(query);
        }
Ejemplo n.º 2
0
        private VisioAutomation.ShapeSheet.Query.CellQuery _CreateQuery(
            VisioPowerShell.Models.NamedSrcDictionary celldic,
            IList <string> cellnames)
        {
            var invalid_names = cellnames.Where(cellname => !celldic.ContainsKey(cellname)).ToList();

            if (invalid_names.Count > 0)
            {
                var    quoted_names = invalid_names.Select(s => string.Format("\"{0}\"", s));
                string msg          = "Invalid cell names: " + string.Join(",", quoted_names);
                throw new ArgumentException(nameof(cellnames), msg);
            }

            var query = new VisioAutomation.ShapeSheet.Query.CellQuery();

            foreach (string cellname in cellnames)
            {
                // resolve any wildcards to the actual cell names
                var resolved_cellnames = celldic.ExpandKeyWildcard(cellname);

                foreach (var resolved_cellname in resolved_cellnames)
                {
                    if (!query.Columns.Contains(resolved_cellname))
                    {
                        var resolved_src = celldic[resolved_cellname];
                        query.Columns.Add(resolved_src, resolved_cellname);
                    }
                }
            }

            return(query);
        }