Ejemplo n.º 1
0
        public void FindTradeDataReadersInCurrentAssembly()
        {
            var assembly    = Assembly.GetExecutingAssembly();
            var readerTypes = AssemblyTypesSearcher.GetTypesImplementing <ITradeDataReader>(assembly.Location).ToList();

            Assert.AreEqual <int>(1, readerTypes.Count());
            Assert.AreEqual <Type>(typeof(DummyTradeDataReader), readerTypes[0]);
        }
        void LoadDataCallback(Object state)
        {
            try
            {
                var newPluginFiles = PluginDirectoryMonitor.GetUnprocessedFileNames();
                foreach (var pluginFile in newPluginFiles)
                {
                    var readerTypes = AssemblyTypesSearcher.GetTypesImplementing <ITradeDataReader>(pluginFile);
                    var registered  = ReaderTypesManager.RegisterReaderTypes(readerTypes);
                    PluginDirectoryMonitor.MarkFileName(pluginFile, registered > 0);
                }

                var newDataFiles = DataDirectoryMonitor.GetUnprocessedFileNames().AsParallel();
                newDataFiles.ForAll(fileName => LoadFileData(fileName));
            }
            catch (Exception e)
            {
                RunOnUiThread(() => NotifyException(e));
            }
            finally
            {
                LoadDataTimer.Change(AppSettingsProvider.CheckingIntervalMs, Timeout.Infinite);
            }
        }