示例#1
0
        private void 套利策略ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormArbitrage frmArbitrage = new FormArbitrage();

            frmArbitrage.delegate_Init               = new delete_init(this.axHSQuanTrade1.Init);
            frmArbitrage.delegate_GetParams          = new delegate_getstrategyparams(this.axHSQuanTrade1.GetStrategyParamInfo);
            frmArbitrage.delegate_GetAllStrategyName = new delegate_getallstrategyname(GetAllStrategy);
            frmArbitrage.delegate_AddrunStrategy     = new delegate_AddRunStrategy(axHSQuanTrade1.AddRunStrategy);
            frmArbitrage.del_SetStrategyParam        = new delegate_SetStrategyParam(axHSQuanTrade1.SetStrategyParam);
            frmArbitrage.del_GetStrategyParam        = new delete_getValues(axHSQuanTrade1.GetParamValue);
            frmArbitrage.m_oStrategyManager          = this.stragegymanager;
            frmArbitrage.del_GetStrategyContext      = new delegate_GetStrategyContext(axHSQuanTrade1.GetStrategyContext);
            frmArbitrage.del_SetStrategyContext      = new delegate_SetStrategyContext(axHSQuanTrade1.SetStrategyContext);
            frmArbitrage.del_StopStrategy            = new delete_stop(axHSQuanTrade1.StopStrategy);
            frmArbitrage.Init(RegisterOcxMsgChannel);
            frmArbitrage.MdiParent = this;

            //FormStrategyResume frmResume = new FormStrategyResume();

            //if (frmResume.HasResumeStrategy("商品套利策略"))
            //{
            //    frmResume.delegate_GetAllStrategyName = new delegate_getallstrategyname(GetAllStrategy);
            //    if (DialogResult.Yes == frmResume.ShowDialog())
            //    {
            //         StrategyContext oStrategy = null;
            //         if (frmResume.GetResumeStrategyCase(frmResume.ResumeStrategyId, ref oStrategy))
            //         {
            //             frmArbitrage.ResumeStrategy(oStrategy);
            //         }
            //    }
            //}

            frmArbitrage.Show();
        }
示例#2
0
        private void ResumeArbitrageForm()
        {
            FormStrategyResume frmResume = new FormStrategyResume();

            if (frmResume.HasResumeStrategy("商品套利策略"))
            {
                frmResume.delegate_GetAllStrategyName = new delegate_getallstrategyname(GetAllStrategy);

                List <StrategyContext> arContext = frmResume.GetStrategyContext("商品套利策略");
                foreach (StrategyContext oStrategy in arContext)
                {
                    FormArbitrage frmArbitrage = new FormArbitrage();
                    frmArbitrage.delegate_Init               = new delete_init(this.axHSQuanTrade1.Init);
                    frmArbitrage.delegate_GetParams          = new delegate_getstrategyparams(this.axHSQuanTrade1.GetStrategyParamInfo);
                    frmArbitrage.delegate_GetAllStrategyName = new delegate_getallstrategyname(GetAllStrategy);
                    frmArbitrage.delegate_AddrunStrategy     = new delegate_AddRunStrategy(axHSQuanTrade1.AddRunStrategy);
                    frmArbitrage.del_SetStrategyParam        = new delegate_SetStrategyParam(axHSQuanTrade1.SetStrategyParam);
                    frmArbitrage.del_GetStrategyParam        = new delete_getValues(axHSQuanTrade1.GetParamValue);
                    frmArbitrage.m_oStrategyManager          = this.stragegymanager;
                    frmArbitrage.del_GetStrategyContext      = new delegate_GetStrategyContext(axHSQuanTrade1.GetStrategyContext);
                    frmArbitrage.del_SetStrategyContext      = new delegate_SetStrategyContext(axHSQuanTrade1.SetStrategyContext);
                    frmArbitrage.del_StopStrategy            = new delete_stop(axHSQuanTrade1.StopStrategy);
                    frmArbitrage.Init(RegisterOcxMsgChannel);
                    frmArbitrage.MdiParent = this;

                    frmArbitrage.ResumeStrategy(oStrategy);
                    frmArbitrage.Show();
                }
            }
        }