Exemple #1
0
        public static object acq_numdict_create(object[] keys, double[] values)
        {
            if (ExcelDnaUtil.IsInFunctionWizard())
            {
                return(ExcelError.ExcelErrorRef);
            }
            else if (keys == null || values == null)
            {
                return(ExcelError.ExcelErrorRef);
            }
            else
            {
                return(ACQ.Excel.Handles.GlobalCache.CreateHandle(Tag, new object[] { keys, values, "acq_numdict_create" },
                                                                  (objectType, parameters) =>
                {
                    NumDictionary dict = new NumDictionary();

                    for (int i = 0; i < keys.Length; i++)
                    {
                        dict[keys[i].ToString()] = values[i];
                    }

                    return dict;
                }));
            }
        }
Exemple #2
0
        public static object acq_numdict_create_fake_data(string name)
        {
            if (ExcelDnaUtil.IsInFunctionWizard())
            {
                return(ExcelError.ExcelErrorRef);
            }
            else if (name == null)
            {
                return(ExcelError.ExcelErrorRef);
            }
            else
            {
                return(ACQ.Excel.Handles.GlobalCache.CreateHandle(Tag, new object[] { name, "acq_numdict_create_fake_data" },
                                                                  (objectType, parameters) =>
                {
                    NumDictionary dict = new NumDictionary();

                    System.Threading.Thread.Sleep(2000);     //simulate loading from DB

                    for (int i = 0; i < 100; i++)
                    {
                        dict[String.Format("{0}-{1}", name, i)] = i;
                    }
                    return dict;
                }));
            }
        }