Пример #1
0
        public LoginController(LoginForm loginForm, T2SDKWrap t2SDKWrap)
        {
            this._t2SDKWrap = t2SDKWrap;
            this._loginBLL  = new LoginBLL2(t2SDKWrap);

            this._loginForm = loginForm;
            this._loginForm.LoginController = this;
        }
Пример #2
0
        //public T2SDKWrap T2SDKWrap
        //{
        //    get { return _t2SDKWrap; }
        //}

        public LoginController(LoginForm loginForm, T2SDKWrap t2SDKWrap)
        {
            this._t2SDKWrap = t2SDKWrap;
            //this._loginBLL = new LoginBLL(t2SDKWrap);
            //this._loginBLL
            this._productBLL = new ProductBLL();
            this._userBLL    = new UserBLL();

            this._loginForm = loginForm;
            this._loginForm.LoginController = this;
        }
Пример #3
0
        public void Init(T2SDKWrap t2SDKWrap)
        {
            lock (_locker)
            {
                _loginBLL        = new LoginSyncBLL(t2SDKWrap);
                _accountBLL      = new AccountBLL(t2SDKWrap);
                _securityBLL     = new SecurityBLL(t2SDKWrap);
                _querySyncBLL    = new UFX.impl.QuerySyncBLL(t2SDKWrap);
                _withdrawSyncBLL = new UFX.impl.WithdrawSyncBLL(t2SDKWrap);

                _UFXMessageHandlerFactory = new UFXMessageHandlerFactory();
            }
        }
Пример #4
0
 public SecurityBLL(T2SDKWrap t2SDKWrap)
     : base(t2SDKWrap)
 {
     RegisterUFX(UFXFunctionCode.Entrust);
     RegisterUFX(UFXFunctionCode.Withdraw);
     RegisterUFX(UFXFunctionCode.EntrustBasket);
     RegisterUFX(UFXFunctionCode.WithdrawBasket);
     RegisterUFX(UFXFunctionCode.QuerySecurityEntrust);
     RegisterUFX(UFXFunctionCode.QuerySecurityEntrustHistorical);
     RegisterUFX(UFXFunctionCode.QuerySecurityDeal);
     RegisterUFX(UFXFunctionCode.QuerySecurityDealHistorical);
     RegisterUFX(UFXFunctionCode.QuerySecurityHolding);
     RegisterUFX(UFXFunctionCode.QueryMultipleHolding);
     RegisterUFX(UFXFunctionCode.QueryFuturesEntrust);
     RegisterUFX(UFXFunctionCode.QueryFuturesEntrustHistorical);
     RegisterUFX(UFXFunctionCode.QueryFuturesDeal);
     RegisterUFX(UFXFunctionCode.QueryFuturesDealHistorical);
 }
Пример #5
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //处理未捕获的异常
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            //处理UI线程异常
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            //处理非UI线程异常
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //ConfigManager.Instance.GetTerminalConfig();
            //var config = new CT2Configinterface();
            //int iRet = config.Load("config/t2sdk.ini");

            //if (iRet != 0)
            //{
            //    string msg = "读取连接配置对象失败!";
            //    return;
            //}

            //LoginBLL loginBLL = new LoginBLL(config);

            T2SDKWrap t2SDKWrap = new T2SDKWrap();

            t2SDKWrap.Connect();
            //LoginBLL2 loginBLL = new LoginBLL2(t2SDKWrap);

            LoginController loginController = new LoginController(new LoginForm(), t2SDKWrap);

            Application.Run(loginController.LoginForm);
            if (_s_mainfrmController != null)
            {
                Application.Run(_s_mainfrmController.MainForm);
            }

            t2SDKWrap.Close();
            glExitApp = true;
        }
Пример #6
0
        public MainController(MainForm mainForm, T2SDKWrap t2SDKWrap)
        {
            this._t2SDKWrap    = t2SDKWrap;
            this._strategyBLL  = new StrategyBLL2(this._t2SDKWrap);
            this._securityBLL  = new SecurityBLL(this._t2SDKWrap);
            this._arbitrageBLL = new ArbitrageBLL(this._t2SDKWrap);

            //var accounts = LoginManager.Instance.Accounts;
            //foreach (var account in accounts)
            //{
            //    _arbitrageBLL.QueryInstance(account);
            //}

            //_arbitrageBLL.QueryMonitorItem();

            //Console.WriteLine("===========查询委托证券 开始==============");
            //_securityBLL.QueryEntrust();
            //Console.WriteLine("===========查询委托证券 结束==============");

            _strategyBLL.QueryTrading();

            this._mainForm = mainForm;
            this._mainForm.MainController = this;
        }
Пример #7
0
 public LoginSyncBLL(T2SDKWrap t2SDKWrap)
 {
     _t2SDKWrap = t2SDKWrap;
 }
Пример #8
0
 public QuerySyncBLL(T2SDKWrap t2SDKWrap)
     : base(t2SDKWrap)
 {
 }
Пример #9
0
 public WithdrawSyncBLL(T2SDKWrap t2SDKWrap)
     : base(t2SDKWrap)
 {
 }
Пример #10
0
 public AccountBLL(T2SDKWrap t2SDKWrap)
 {
     _t2SDKWrap = t2SDKWrap;
 }
Пример #11
0
 public MainForm(GridConfig gridConfig, T2SDKWrap t2SDKWrap)
     : this()
 {
     _gridConfig = gridConfig;
     _t2SDKWrap  = t2SDKWrap;
 }
Пример #12
0
        public MainController(MainForm mainForm, T2SDKWrap t2SDKWrap)
        {
            this._t2SDKWrap = t2SDKWrap;

            this._mainForm = mainForm;
        }
Пример #13
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var    log4net     = ConfigurationManager.AppSettings["log4net"];
            string logFilePath = Path.Combine(Application.StartupPath, log4net);

            //XmlConfigurator.Configure();
            XmlConfigurator.Configure(new Uri(logFilePath));
            logger.Info("Log4net initialize...: " + logFilePath);
            //XmlConfigurator.ConfigureAndWatch("log4net.config");

            //处理未捕获的异常
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            //处理UI线程异常
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            //处理非UI线程异常
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //var setting = SettingManager.Instance.Get();
            var settingConfig = ConfigManager.Instance.GetDefaultSettingConfig();
            //var buttonConfig = ConfigManager.Instance.GetButtonConfig();

            //TODO:每个交易日开始时初始化????
            //清算交易实例
            var tradeInstanceSecuBLL = new TradeInstanceSecurityBLL();

            tradeInstanceSecuBLL.SettlePosition();

            uint timeOut = (uint)settingConfig.DefaultSetting.Timeout;

            T2SDKWrap t2SDKWrap = new T2SDKWrap(timeOut);
            var       conRet    = t2SDKWrap.Connect();

            if (conRet != Model.ConnectionCode.Success)
            {
                glExitApp = true;
                return;
            }

            T2Subscriber t2Subscriber = new T2Subscriber(timeOut);

            conRet = t2Subscriber.Connect();
            if (conRet != Model.ConnectionCode.Success)
            {
                t2SDKWrap.Close();
                glExitApp = true;
                return;
            }

            UFXBLLManager.Instance.Init(t2SDKWrap);
            UFXBLLManager.Instance.Subscriber = t2Subscriber;

            //TODO: subscribe the message after getting login information
            LoginController loginController = new LoginController(new LoginForm(), t2SDKWrap);

            Application.Run(loginController.LoginForm);
            if (_s_mainfrmController != null)
            {
                Application.Run(_s_mainfrmController.MainForm);
            }

            //realloc the connection and service
            loginController.Logout();
            t2SDKWrap.Close();
            t2Subscriber.Close();

            glExitApp = true;
        }
Пример #14
0
 public UFXBLLBase(T2SDKWrap t2SDKWrap)
 {
     _t2SDKWrap   = t2SDKWrap;
     _dataHandler = HandlData;
 }