Ejemplo n.º 1
0
        public Assembler Initialize(IStatusReporter mainForm)
        {
            if (this.StatusReporter != null && this.StatusReporter != mainForm)
            {
                string msg = "Assembler.InstanceInitialized.StatusReporter[" + this.StatusReporter + "] != mainForm[" + mainForm + "]";
                msg += "; you initialize the StatusReporter once per lifetime;"
                       + " if you need to re-initialize singleton with new IStatusReporter then refactor it"
                       + " and introduce Reset(IStatusReporter) method which won't throw this;"
                       + " or you can just set Assembler.InstanceInitialized.StatusReporter={your different IStatusReporter}"
                       + " to use Assembler.PopupException(), but no guarantee that OrderProcessor and DataSourceRepository will work properly";
                throw new Exception();
            }
            this.StatusReporter = mainForm;

            bool createdNewFile = this.RepositoryCustomSymbolInfo.Initialize(this.AppDataPath, "SymbolInfo.json", "", null);
            List <SymbolInfo> symbolInfosNotUsed = this.RepositoryCustomSymbolInfo.Deserialize();

            createdNewFile = this.MarketInfoRepository.Initialize(this.AppDataPath, "MarketInfo.json", "", null);
            this.MarketInfoRepository.Deserialize();

            this.RepositoryDllJsonStrategy.Initialize(this.AppDataPath, this.AppStartupPath);

            this.RepositoryDllStaticProvider.InitializeAndScan(this.AppStartupPath);
            this.RepositoryDllStreamingProvider.InitializeAndScan(this.AppStartupPath);
            this.RepositoryDllBrokerProvider.InitializeAndScan(this.AppStartupPath);
            this.RepositoryDllReporters.InitializeAndScan(this.AppStartupPath);

            this.WorkspacesRepository.Initialize(this.AppDataPath, "Workspaces", this.StatusReporter);
            this.WorkspacesRepository.ScanFolders();

            this.OrderProcessor.Initialize(this.AppDataPath, this.StatusReporter);

            //v1 this.RepositoryJsonDataSource.Initialize(this.AppDataPath);
            //v1 this.RepositoryJsonDataSource.DataSourcesDeserialize(this.MarketInfoRepository, this.OrderProcessor, this.StatusReporter);

            this.RepositoryJsonDataSource.Initialize(this.AppDataPath, "DataSources",
                                                     this.StatusReporter, this.MarketInfoRepository, this.OrderProcessor);
            this.RepositoryJsonDataSource.DeserializeJsonsInFolder();

            createdNewFile             = this.AssemblerDataSnapshotSerializer.Initialize(this.AppDataPath, "AssemblerDataSnapshot.json", "", null);
            this.AssemblerDataSnapshot = this.AssemblerDataSnapshotSerializer.Deserialize();

            return(Assembler.InstanceInitialized);
        }
Ejemplo n.º 2
0
//		[Obsolete("looks illogical, move IStatusReporter to Initialize() and use Assembler.InstanceInitialized instead of Assembler.Constructed")]
//		protected Assembler(IStatusReporter mainForm) : this() {
//			this.StatusReporter = mainForm;
//			Assembler.instance = this;
//		}
        public Assembler()
        {
            this.RepositoryCustomSymbolInfo = new RepositoryCustomSymbolInfo();
            this.MarketInfoRepository       = new RepositoryCustomMarketInfo();
            this.RepositoryJsonDataSource   = new RepositoryJsonDataSource();
            this.RepositoryDllJsonStrategy  = new RepositoryDllJsonStrategy();

            this.RepositoryDllStaticProvider    = new RepositoryDllStaticProvider();
            this.RepositoryDllStreamingProvider = new RepositoryDllStreamingProvider();
            this.RepositoryDllBrokerProvider    = new RepositoryDllBrokerProvider();
            this.RepositoryDllReporters         = new RepositoryDllReporters();

            this.WorkspacesRepository = new RepositoryFoldersNoJson();

            //this.ChartRendererConfigured = new ChartRenderer();
            this.OrderProcessor = new OrderProcessor();
            this.AlertsForChart = new DictionaryManyToOne <ChartShadow, Alert>();

            this.AssemblerDataSnapshot           = new AssemblerDataSnapshot();
            this.AssemblerDataSnapshotSerializer = new Serializer <AssemblerDataSnapshot>();
        }
Ejemplo n.º 3
0
		public Assembler Initialize(IStatusReporter mainForm) {
			if (this.StatusReporter != null && this.StatusReporter != mainForm) {
				string msg = "Assembler.InstanceInitialized.StatusReporter[" + this.StatusReporter + "] != mainForm[" + mainForm + "]";
				msg += "; you initialize the StatusReporter once per lifetime;"
					+ " if you need to re-initialize singleton with new IStatusReporter then refactor it"
					+ " and introduce Reset(IStatusReporter) method which won't throw this;"
					+ " or you can just set Assembler.InstanceInitialized.StatusReporter={your different IStatusReporter}"
					+ " to use Assembler.PopupException(), but no guarantee that OrderProcessor and DataSourceRepository will work properly";
				throw new Exception();
			}
			this.StatusReporter = mainForm;
			
			bool createdNewFile = this.RepositoryCustomSymbolInfo.Initialize(this.AppDataPath, "SymbolInfo.json", "", null);
			List<SymbolInfo> symbolInfosNotUsed = this.RepositoryCustomSymbolInfo.Deserialize();
			
			createdNewFile = this.MarketInfoRepository.Initialize(this.AppDataPath, "MarketInfo.json", "", null);
			this.MarketInfoRepository.Deserialize();
			
			this.RepositoryDllJsonStrategy.Initialize(this.AppDataPath, this.AppStartupPath);

			this.RepositoryDllStaticProvider.InitializeAndScan(this.AppStartupPath);
			this.RepositoryDllStreamingProvider.InitializeAndScan(this.AppStartupPath);
			this.RepositoryDllBrokerProvider.InitializeAndScan(this.AppStartupPath);
			this.RepositoryDllReporters.InitializeAndScan(this.AppStartupPath);
			
			this.WorkspacesRepository.Initialize(this.AppDataPath, "Workspaces", this.StatusReporter);
			this.WorkspacesRepository.ScanFolders();

			this.OrderProcessor.Initialize(this.AppDataPath, this.StatusReporter);

			//v1 this.RepositoryJsonDataSource.Initialize(this.AppDataPath);
			//v1 this.RepositoryJsonDataSource.DataSourcesDeserialize(this.MarketInfoRepository, this.OrderProcessor, this.StatusReporter);
			
			this.RepositoryJsonDataSource.Initialize(this.AppDataPath, "DataSources",
				this.StatusReporter, this.MarketInfoRepository, this.OrderProcessor);
			this.RepositoryJsonDataSource.DeserializeJsonsInFolder();

			createdNewFile = this.AssemblerDataSnapshotSerializer.Initialize(this.AppDataPath, "AssemblerDataSnapshot.json", "", null);
			this.AssemblerDataSnapshot = this.AssemblerDataSnapshotSerializer.Deserialize();
			
			return Assembler.InstanceInitialized;
		}
Ejemplo n.º 4
0
//		[Obsolete("looks illogical, move IStatusReporter to Initialize() and use Assembler.InstanceInitialized instead of Assembler.Constructed")]
//		protected Assembler(IStatusReporter mainForm) : this() {
//			this.StatusReporter = mainForm;
//			Assembler.instance = this;
//		}
		public Assembler() {
			this.RepositoryCustomSymbolInfo = new RepositoryCustomSymbolInfo();
			this.MarketInfoRepository = new RepositoryCustomMarketInfo();
			this.RepositoryJsonDataSource = new RepositoryJsonDataSource();
			this.RepositoryDllJsonStrategy = new RepositoryDllJsonStrategy();

			this.RepositoryDllStaticProvider = new RepositoryDllStaticProvider();
			this.RepositoryDllStreamingProvider = new RepositoryDllStreamingProvider();
			this.RepositoryDllBrokerProvider = new RepositoryDllBrokerProvider();
			this.RepositoryDllReporters = new RepositoryDllReporters();
			
			this.WorkspacesRepository = new RepositoryFoldersNoJson();

			//this.ChartRendererConfigured = new ChartRenderer();
			this.OrderProcessor = new OrderProcessor();
			this.AlertsForChart = new DictionaryManyToOne<ChartShadow, Alert>();
			
			this.AssemblerDataSnapshot = new AssemblerDataSnapshot();
			this.AssemblerDataSnapshotSerializer = new Serializer<AssemblerDataSnapshot>();
		}