public void FunctionRepository_Load_DefaultRepository()
        {
            IFrameworkRepository <IFunction> functionRepo = MathOpsFactory.FunctionRepository();

            functionRepo.Load();
            IEnumerable <IFunction> functions = functionRepo.All();

            Assert.IsTrue(functionRepo.All().Count > 0);
        }
Ejemplo n.º 2
0
        public CalculateIntellisenseProvider(ISyntaxTreeBuilderHelper syntaxTreeBuilderHelper)
        {
            _syntaxTreeBuilderHelper = syntaxTreeBuilderHelper;
            IntellisenseProviderType = IntellisenseProviderType.NonDefault;
            IFrameworkRepository <IFunction> functionList = MathOpsFactory.FunctionRepository();

            functionList.Load();
            bool creatingFunctions = false;

            if (_functionNames == null)
            {
                creatingFunctions = true;
                _functionNames    = new HashSet <string>(StringComparer.Ordinal);
            }

            IntellisenseResult = functionList.All().Select(currentFunction =>
            {
                string description         = currentFunction.Description;
                string dropDownDescription = description;
                if (description != null && description.Length > 80)
                {
                    dropDownDescription = description.Substring(0, 77) + "...";
                }
                if (creatingFunctions)
                {
                    _functionNames.Add(currentFunction.FunctionName);
                }
                IntellisenseProviderResult result = new IntellisenseProviderResult(this, currentFunction.FunctionName, dropDownDescription, description, currentFunction.arguments != null ? currentFunction.arguments.ToArray() : new string[0], currentFunction.ArgumentDescriptions != null ? currentFunction.ArgumentDescriptions.ToArray() : new string[0]);
                return(result);
            }).OrderBy(p => p.Name).ToList();
        }
Ejemplo n.º 3
0
        private void InitializeWebResources()
        {
            _webResources = WebResourceRepositoryFactory.CreateWebResourceRepository(_resource);
            _webResources.Load();

            if (_webResources == null)
            {
                throw new InvalidOperationException("WebResourceFactory returned null repository");
            }

            _rootWebResource = new WebResourceViewModel(null)
            {
                Name = "root", IsRoot = true
            };
            _webResources.All().ToList().ForEach(c => _rootWebResource.Children.Add(c));
        }
Ejemplo n.º 4
0
        private static void InitMathFnRawData()
        {
            IFrameworkRepository <IFunction> repo = FunctionRepository();

            repo.Load();
            ICollection <IFunction> fns = repo.All();
            StringBuilder           tmp = new StringBuilder("<DL>");

            // build list
            foreach (IFunction f in fns)
            {
                _rawMathFnList.Add(f.FunctionName);
                tmp.Append("<");
                tmp.Append(f.FunctionName);
                tmp.Append("/>");
            }
            tmp.Append("</DL>");

            _mathFnDataList = tmp.ToString();
        }
Ejemplo n.º 5
0
        private void InitializeWebResources()
        {
            _webResources = WebResourceRepositoryFactory.CreateWebResourceRepository(_resource);
            _webResources.Load();

            if(_webResources == null)
            {
                throw new InvalidOperationException("WebResourceFactory returned null repository");
            }

            _rootWebResource = new WebResourceViewModel(null) { Name = "root", IsRoot = true };
            _webResources.All().ToList().ForEach(c => _rootWebResource.Children.Add(c));
        }