Exemplo n.º 1
0
 public void RegisterFunctions()
 {
     ExcelRegistration.GetExcelFunctions()
     .ProcessParamsRegistrations()
     .Select(UpdateHelpTopic)
     .RegisterFunctions();
 }
Exemplo n.º 2
0
        public void AutoOpen()
        {
            try
            {
                Application.ThreadException += ApplicationThreadUnhandledException;
                AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException;
                TaskScheduler.UnobservedTaskException      += TaskSchedulerUnobservedTaskException;
                ExcelIntegration.RegisterUnhandledExceptionHandler(ExcelUnhandledException);

                _log = Log.Logger = ConfigureLogging();
                _log.Information("Starting sample Excel-DNA Add-In with Serilog Sink LogDisplay");

                ExcelComAddInHelper.LoadComAddIn(this);

                _log.Verbose("Registering functions");

                ExcelRegistration.GetExcelFunctions()
                .Select(UpdateFunctionAttributes)
                .RegisterFunctions();

                _log.Information("Sample Excel-DNA Add-In with Serilog Sink LogDisplay started");
            }
            catch (Exception ex)
            {
                ProcessUnhandledException(ex);
            }
        }
Exemplo n.º 3
0
        public void AutoOpen()
        {
            ExcelIntegration.RegisterUnhandledExceptionHandler(ex => "!!! ERROR: " + ex.ToString());

            // Set the Parameter Conversions before they are applied by the ProcessParameterConversions call below.
            // CONSIDER: We might change the registration to be an object...?
            var conversionConfig      = GetParameterConversionConfig();
            var postAsyncReturnConfig = GetPostAsyncReturnConversionConfig();

            var functionHandlerConfig = GetFunctionExecutionHandlerConfig();

            // Get all the ExcelFunction functions, process and register
            // Since the .dna file has ExplicitExports="true", these explicit registrations are the only ones - there is no default processing
            ExcelRegistration.GetExcelFunctions()
            .ProcessMapArrayFunctions(conversionConfig)
            .ProcessParameterConversions(conversionConfig)
            .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
            .ProcessParameterConversions(postAsyncReturnConfig)
            .ProcessParamsRegistrations()
            .ProcessFunctionExecutionHandlers(functionHandlerConfig)
            .RegisterFunctions();

            // First example if Instance -> Static conversion
            InstanceMemberRegistration.TestInstanceRegistration();
        }
 public void AutoOpen()
 {
     ExcelRegistration
     .GetExcelFunctions()
     .ProcessParamsRegistrations()
     .RegisterFunctions();
     // ...
 }
Exemplo n.º 5
0
        public void RegisterFunctions()
        {
            var postAsyncReturnConfig = GetPostAsyncReturnConversionConfig();

            ExcelRegistration.GetExcelFunctions()
            .ProcessParameterConversions(postAsyncReturnConfig)
            .ProcessAsyncRegistrations(nativeAsyncIfAvailable: true)
            .RegisterFunctions();
        }
Exemplo n.º 6
0
 public void AutoOpen()
 {
     // Since we have specified ExplicitRegistration=true in the .dna file, we need to do all registration explicitly.
     // Here we only add the async processing, which applies to our IObservable function.
     ExcelRegistration.GetExcelFunctions()
     .ProcessAsyncRegistrations()
     .RegisterFunctions();
     ExcelRegistration.GetExcelCommands().RegisterCommands();
 }
        public IEnumerable <ExcelFunctionRegistration> GetFunctionRegistrations()
        {
            var allFunctions = ExcelRegistration.GetExcelFunctions().ToList();

            foreach (var reg in allFunctions)
            {
                reg.FunctionAttribute.Name = reg.FunctionAttribute.Name + ".Custom";
            }
            return(allFunctions);
        }
Exemplo n.º 8
0
 public void RegisterFunctions()
 {
     ExcelRegistration.GetExcelFunctions()
     .Where(x => x.FunctionAttribute.Category.Equals("FFE"))
     .Select(f =>
     {
         Log.Debug("Registered FFE function: {@FfeFunction}", f.FunctionAttribute.Name);
         return(f);
     })
     .RegisterFunctions();
 }
Exemplo n.º 9
0
        void RegisterFunctions()
        {
            var postAsyncReturnConfig = GetPostAsyncReturnConversionConfig();
            var conversionConfig      = GetParameterConversionConfig();

            ExcelRegistration.GetExcelFunctions()
            .ProcessMapArrayFunctions(conversionConfig)
            .ProcessParameterConversions(conversionConfig)
            .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
            .ProcessParameterConversions(postAsyncReturnConfig)
            .ProcessParamsRegistrations()
            .RegisterFunctions();
        }
Exemplo n.º 10
0
        private IEnumerable <string> GetFfeFunctionNames()
        {
            /*functionNames = GetExecutingAssembly().GetTypes()
             *                                    .SelectMany(t => t.GetMethods())
             *                                    .Where(m => m.GetCustomAttributes(typeof(ExcelFunctionAttribute), false).Length > 0)
             *                                    .Select(mi => mi.Name);*/
            // FFE functions
            functionNames = ExcelRegistration.GetExcelFunctions()
                            .Where(x => x.FunctionAttribute.Category.Equals("FFE"))
                            .Select(f => f.FunctionAttribute.Name);
            // + SSQ UDFs
            functionNames = functionNames.Union(SsqLoader.GetUdfs().Select(udf => udf.Value.QueryInformation.Name));

            return(functionNames);
        }
Exemplo n.º 11
0
        public void AutoOpen()
        {
            var functions = ExcelRegistration.GetExcelFunctions().ToList();

            if (HasNativeXMatch())
            {
                foreach (var func in functions)
                {
                    func.FunctionAttribute.Name = func.FunctionAttribute.Name + ".FROM.ADDIN";
                }
            }
            functions.RegisterFunctions();

            IntelliSenseServer.Install();
        }
Exemplo n.º 12
0
        public void RegisterFunctions()
        {
            // DI as best we can do it
            var instance = Resolver.Instance;

            instance.Register <SwaggerClient>((c) => new SwaggerClient());
            instance.Register <SwaggerRegistry>((c) => new SwaggerRegistry(c.Create <SwaggerClient>()));

            ExcelRegistration.GetExcelFunctions()
            .RegisterFunctions();

            _syncContext = SynchronizationContext.Current ?? new WindowsFormsSynchronizationContext();

            SwaggerRegistry.ApiLoadStatusStatic.Status = ApiLoadStatus.NotYetLoaded;

            instance.Create <SwaggerRegistry>();
        }
Exemplo n.º 13
0
        public void RegisterFunctions()
        {
            ExcelRegistration.GetExcelCommands().RegisterCommands();

            /* to walk through which functions are being registered.....
             * int i = 0;
             * List<String> los = new List<string>(0);
             * foreach (ExcelFunctionRegistration f in ExcelRegistration.GetExcelFunctions()) {
             *  los.Add(f.FunctionLambda.ToString());
             *  List<ExcelFunctionRegistration> ief = new List<ExcelFunctionRegistration>();
             *  ief.Add(f);
             *  i++;
             *  ExcelRegistration.RegisterFunctions(ief);
             * }
             */
            ExcelRegistration.GetExcelFunctions().RegisterFunctions();
        }
Exemplo n.º 14
0
        public void AutoOpen()
        {
            var functions = ExcelRegistration.GetExcelFunctions().ToList();

            if (HasNativeXMatch())
            {
                foreach (var func in functions)
                {
                    func.FunctionAttribute.Name = "HUST." + func.FunctionAttribute.Name;
                }
            }
            functions.RegisterFunctions();

            ///Cho phép hiển thị các dòng gợi ý hàm và gợi ý tham số của các thuộc tính
            ///<see cref="ExcelDna.Integration.ExcelFunctionAttribute"/> và <see cref="ExcelDna.Integration.ExcelArgumentAttribute"/>
            IntelliSenseServer.Install();
        }
Exemplo n.º 15
0
        public void AutoOpen()
        {
            if (AddIn.IsFirstRun == true)
            {
                IntelliSenseServer.Install();
                AddIn.IsFirstRun = false;
            }

            ExcelApp = ExcelDnaUtil.Application as Excel.Application;
            //ExcelApp.SheetActivate += ExcelApp_SheetActivate;
            ExcelApp.SheetSelectionChange += ExcelApp_SheetSelectionChange;
            ExcelApp.WindowActivate       += ExcelApp_WindowActivate;
            ExcelRegistration.GetExcelFunctions()//在此处显示注册函数
            .Where(func => func.FunctionAttribute.Name.StartsWith("Params"))
            .ProcessParamsRegistrations()
            .RegisterFunctions();


            //ComAddInConnection com_addin = new ComAddInConnection();
            //ExcelComAddInHelper.LoadComAddIn(com_addin);
        }
Exemplo n.º 16
0
        public virtual void AutoOpen()
        {
            ExcelIntegration.RegisterUnhandledExceptionHandler(OnError);

            // Set the Parameter Conversions before they are applied by the ProcessParameterConversions call below.
            // CONSIDER: We might change the registration to be an object...?
            var conversionConfig = GetParameterConversionConfig();

            // Get all the ExcelFunction functions, process and register
            // Since the .dna file has ExplicitExports="true", these explicit registrations are the only ones - there is no default processing
            ExcelRegistration.GetExcelFunctions()
            .ProcessParameterConversions(conversionConfig)
            .ProcessParamsRegistrations()
            .RegisterFunctions();

            var registration = new Registration(Container);

            foreach (var methodInfo in Methods)
            {
                registration.AddMethod(methodInfo);
            }

            foreach (var propertyInfo in Properties)
            {
                registration.AddProperty(propertyInfo);
            }

            var bindingService = Container.GetInstance <IBindingService>();
            var application    = (Application)ExcelDnaUtil.Application;

            application.SheetChange += bindingService.OnSheetChange;

            registration.GetAllRegistrations()
            .ProcessParameterConversions(conversionConfig)
            .ProcessParamsRegistrations()
            .ProcessAsyncRegistrations()
            .RegisterFunctions();
        }
Exemplo n.º 17
0
 public IEnumerable <ExcelFunctionRegistration> GetFunctionRegistrations() => ExcelRegistration.GetExcelFunctions();
Exemplo n.º 18
0
 private void SetupRegistration()
 {
     ProcessAndRegisterFunctions(ExcelRegistration.GetExcelFunctions());
 }
 void RegisterFunctions()
 {
     ExcelRegistration.GetExcelFunctions()
     .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
     .RegisterFunctions();
 }
Exemplo n.º 20
0
 public override IEnumerable <ExcelFunctionRegistrationBase> GetExcelFunctions()
 {
     return(ExcelRegistration.GetExcelFunctions()
            .Select(f => (ExcelFunctionRegistrationBase) new ExcelFunctionRegistrationWrapper(f)));
 }