Ejemplo n.º 1
0
        /// <summary>
        /// 触发状态变更事件。
        /// </summary>
        /// <param name="args"></param>
        protected virtual void FireOrderDriverStateChanged(USeOrderDriverState newState, string reason)
        {
            Debug.WriteLine(string.Format("[{0}] driver state changed {1} ==> {2},reason:{3}.", ToString(), this.DriverState, newState, reason));

            USeOrderDriverStateChangedEventArgs args = new USeOrderDriverStateChangedEventArgs("",
                                                                                               this.DriverState,
                                                                                               newState,
                                                                                               reason);

            this.DriverState = newState;

            EventHandler <USeOrderDriverStateChangedEventArgs> handel = this.OnDriverStateChanged;

            if (handel != null)
            {
                try
                {
                    handel(this, args);
                }
                catch
                {
                    Debug.Assert(false);
                }
            }
        }
Ejemplo n.º 2
0
 private void OrderDriver_OnDriverStateChanged(object sender, USe.TradeDriver.Common.USeOrderDriverStateChangedEventArgs e)
 {
     if (e.OldState == USeOrderDriverState.Ready && e.NewState != USeOrderDriverState.Ready)
     {
         AlarmNotice alarm = new AlarmNotice(AlarmType.TradeDriverDisconect, "交易驱动断线");
         if (this.InvokeRequired)
         {
             this.BeginInvoke(new Action <AlarmNotice>(AddAlarmNotice), alarm);
             return;
         }
         else
         {
             AddAlarmNotice(alarm);
         }
     }
 }