|
本帖最後由 chang91348 於 17-8-6 22:15 編輯
謝謝版主和先進的回覆,因為不是科班出身,所以都是買書以及網路拼湊出來程式,經由網路google 的結果,得到一個複雜的結果,還請各位指教...
經由檢視程式碼後,海期下單原本一開始以為是從 OverseaFutureOrderControl下單,可是卻是在skOrder下有一個事件
private void overseaFutureOrderControl1_OnOverseaFutureOrderSignal(string strLogInID, bool bAsyncOrder, OVERSEAFUTUREORDER pStock)
{
string strMessage = "";
m_nCode = m_pSKOrder.SendOverseaFutureOrder(strLogInID, bAsyncOrder, pStock, out strMessage);
WriteMessage("海期委託:" + strMessage);
SendReturnMessage("Order", m_nCode, "SendOverseaFutureOrder");
}
似乎是海期下單後,在skOrder接受到訊息在此用SendOverseaFutureOrder下單的; 所以我在SKOSQuote 內新增了
public Form1 Mainform();
然後在 Form1 內
skosQuote1.Mainform=this;
//再自設一段程式碼
public void SendOFOrder(string strLogInID, bool bAsyncOrder, OVERSEAFUTUREORDER pStock)
{
skOrder1.SendOFOrder(strLogInID, bAsyncOrder, pStock);
}
而 SKOrder 內則定義 SendOFOrder如下(其實就是overseaFutureOrderControl1_OnOverseaFutureOrderSignal事件的程式碼)
public void SendOFOrder(string strLogInID, bool bAsyncOrder, OVERSEAFUTUREORDER pStock)
{
string strMessage = "";
m_nCode = m_pSKOrder.SendOverseaFutureOrder(strLogInID, bAsyncOrder, pStock, out strMessage);
WriteMessage("海期委託:" + strMessage);
SendReturnMessage("Order", m_nCode, "SendOverseaFutureOrder");
}
在SKOSQuote 內運算達到條件時,則呼叫
Mainform.SendOFOrder(ID,Yes,OSOrder);
請教諸位,這樣的程式碼可行嗎? |
|