public void RegisterFunctions()
 {
     ExcelRegistration.GetExcelFunctions()
     .ProcessParamsRegistrations()
     .Select(UpdateHelpTopic)
     .RegisterFunctions();
 }
Example #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);
            }
        }
Example #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();
     // ...
 }
Example #5
0
 public static void RegisterDataFunctions()
 {
     ExcelRegistration.RegisterFunctions(
         Array.ConvertAll(
             DataFunctionsRegistration._type.GetMethods(BindingFlags.Public | BindingFlags.Static),
             method => new ExcelFunctionRegistration(method)
             )
         );
 }
Example #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();
 }
Example #7
0
        public void RegisterFunctions()
        {
            var postAsyncReturnConfig = GetPostAsyncReturnConversionConfig();

            ExcelRegistration.GetExcelFunctions()
            .ProcessParameterConversions(postAsyncReturnConfig)
            .ProcessAsyncRegistrations(nativeAsyncIfAvailable: true)
            .RegisterFunctions();
        }
        public IEnumerable <ExcelFunctionRegistration> GetFunctionRegistrations()
        {
            var allFunctions = ExcelRegistration.GetExcelFunctions().ToList();

            foreach (var reg in allFunctions)
            {
                reg.FunctionAttribute.Name = reg.FunctionAttribute.Name + ".Custom";
            }
            return(allFunctions);
        }
Example #9
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();
 }
Example #10
0
        void RegisterFunctions()
        {
            var postAsyncReturnConfig = GetPostAsyncReturnConversionConfig();
            var conversionConfig      = GetParameterConversionConfig();

            ExcelRegistration.GetExcelFunctions()
            .ProcessMapArrayFunctions(conversionConfig)
            .ProcessParameterConversions(conversionConfig)
            .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
            .ProcessParameterConversions(postAsyncReturnConfig)
            .ProcessParamsRegistrations()
            .RegisterFunctions();
        }
Example #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();
        }
Example #12
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);
        }
        public void Register()
        {
            if (FunctionRegistration != null)
            {
                ExcelRegistration.RegisterFunctions(FunctionRegistration.GetFunctionRegistrations());
            }

            if (RibbonRegistration != null)
            {
                foreach (var addIn in RibbonRegistration.GetRibbonAddIns())
                {
                    ExcelComAddInHelper.LoadComAddIn(addIn);
                }
            }
        }
Example #14
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>();
        }
Example #15
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();
        }
Example #16
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();
        }
Example #17
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);
        }
Example #18
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();
        }
Example #19
0
 public override void RegisterCommands(IEnumerable <ExcelCommandRegistrationBase> registrationEntries)
 {
     // ReSharper disable InvokeAsExtensionMethod
     ExcelRegistration.RegisterCommands(registrationEntries.Select(f => f.ExcelCommandRegistrationInstance));
     // ReSharper restore InvokeAsExtensionMethod
 }
Example #20
0
 public IEnumerable <ExcelFunctionRegistration> GetFunctionRegistrations() => ExcelRegistration.GetExcelFunctions();
 private void SetupRegistration()
 {
     ProcessAndRegisterFunctions(ExcelRegistration.GetExcelFunctions());
 }
Example #22
0
 public override IEnumerable <ExcelCommandRegistrationBase> GetExcelCommands()
 {
     return(ExcelRegistration.GetExcelCommands()
            .Select(c => (ExcelCommandRegistrationBase) new ExcelCommandRegistrationWrapper(c)));
 }
Example #23
0
 public override IEnumerable <ExcelFunctionRegistrationBase> GetExcelFunctions()
 {
     return(ExcelRegistration.GetExcelFunctions()
            .Select(f => (ExcelFunctionRegistrationBase) new ExcelFunctionRegistrationWrapper(f)));
 }
 void RegisterFunctions()
 {
     ExcelRegistration.GetExcelFunctions()
     .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
     .RegisterFunctions();
 }