Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            DispatcherUnhandledException += AppGlobalDispatcherUnhandledException;


            // Initialize server configuration
            Config config = new Config(Settings.Default.ConfigFile);

            Dictionary <string, string> configDict;

            if (config.Content.TryGetValue("ACCOUNTSERVER", out configDict))
            {
                MessageHandlerContainer.Register <AccountHandler, AccountHandler>(GenSignInOption(configDict));
            }

            if (config.Content.TryGetValue("OTCSERVER", out configDict))
            {
                MessageHandlerContainer.Register <AbstractOTCHandler, OTCContractHandler>(GenSignInOption(configDict));
            }

            if (config.Content.TryGetValue("OTCOPTIONSERVER", out configDict))
            {
                MessageHandlerContainer.Register <OTCOptionTradingDeskHandler, OTCOptionTradingDeskHandler>(GenSignInOption(configDict));
                MessageHandlerContainer.Register <OTCOptionDataHandler, OTCOptionDataHandler>(GenSignInOption(configDict));
                MessageHandlerContainer.Register <OTCOptionTradeHandler, OTCOptionTradeHandler>(GenSignInOption(configDict));
            }

            if (config.Content.TryGetValue("CTPMDSERVER", out configDict))
            {
                MessageHandlerContainer.Register <MarketDataHandler, MarketDataHandler>(GenSignInOption(configDict));
            }

            if (config.Content.TryGetValue("CTPTRADESERVER", out configDict))
            {
                MessageHandlerContainer.Register <TraderExHandler, TraderExHandler>(GenSignInOption(configDict));
            }

            if (config.Content.TryGetValue("CTPOPTIONSERVER", out configDict))
            {
                MessageHandlerContainer.Register <CTPOptionDataHandler, CTPOptionDataHandler>(GenSignInOption(configDict));
            }

            if (config.Content.TryGetValue("CTSMDSERVER", out configDict))
            {
                MessageHandlerContainer.Register <CTSMarketDataHandler, CTSMarketDataHandler>(GenSignInOption(configDict));
            }

            if (config.Content.TryGetValue("CTSTRADESERVER", out configDict))
            {
                MessageHandlerContainer.Register <CTSTradeHandler, CTSTradeHandler>(GenSignInOption(configDict));
            }

            MessageHandlerContainer.DefaultInstance.Refresh();
        }
Exemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Config config = new Config("settings.ini");

            var configDict = config.Content["TESTINGSERVER"];

            MessageHandlerContainer.Register <SimMarketDataHandler, SimMarketDataHandler>
                (new SignInOptions
            {
                FrontServer       = configDict["ADDRESS"],
                UserName          = configDict["USERNAME"],
                Password          = configDict["PASSWORD"],
                ReconnectTimeSpan = TimeSpan.Parse(configDict["RECONN_TIMESPAN"])
            });

            MessageHandlerContainer.DefaultInstance.Refresh();

            base.OnStartup(e);
        }
Exemplo n.º 3
0
 internal static int?GetOrderForHandler(this MessageHandlerContainer container, IBaseMessageHandler handler)
 {
     return(container.MessageHandlerOrderingModels.FirstOrDefault(x => x.MessageHandlerType == handler.GetType())?.Order);
 }