/// <summary> /// 取消注册监听 /// </summary> /// <param name="requestID">请求ID</param> /// <param name="callBack">回调函数</param> public virtual void UnRegisterListener(int requestID, ListenerMessageCallBack callBack) { lock (m_listeners) { if (m_listeners.ContainsKey(requestID)) { m_listeners[requestID].Remove(callBack); } } }
/// <summary> /// 创建登录窗体 /// </summary> /// <param name="native">方法库</param> public LoginWindow(INativeBase native) { Load(native, "LoginWindow", "windowLogin"); m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册点击事件 RegisterEvents(m_window); m_loginService = DataCenter.LoginService; m_loginDataCallBackEvent = new ListenerMessageCallBack(LoginDataCallBack); m_loginService.RegisterListener(m_loginRequestID, m_loginDataCallBackEvent); }
/// <summary> /// 创建聊天窗体 /// </summary> /// <param name="native">方法库</param> public ChatWindow(INativeBase native) { Load(native, "ChatWindow", "windowChat"); m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册点击事件 RegisterEvents(m_window); m_chatService = DataCenter.ChatService; m_chatDataCallBackEvent = new ListenerMessageCallBack(ChatDataCallBack); m_chatService.RegisterListener(m_chatService.RequestID, m_chatDataCallBackEvent); }
/// <summary> /// 销毁方法 /// </summary> public override void Dispose() { if (!IsDisposed) { if (m_gridCategory != null) { m_gridCategory.UnRegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_gridSelectedRowsChangedEvent = null; m_gridCategory.UnRegisterEvent(m_gridCellEditEndEvent, EVENTID.GRIDCELLEDITEND); m_gridCellEditEndEvent = null; m_gridCategory = null; } if (m_gridSecurities != null) { m_gridSecurities.UnRegisterEvent(m_gridCellClick, EVENTID.GRIDCELLCLICK); m_gridCellClick = null; m_gridSecurities = null; } if (m_quoteService != null) { m_quoteService.UnRegisterListener(m_latestDataRequestID, m_latestDataCallBack); m_latestDataCallBack = null; m_quoteService = null; } m_latestDatas.Clear(); if (m_txtSearch != null) { m_txtSearch.UnRegisterEvent(m_searchTextBoxGotFocus, EVENTID.GOTFOCUS); m_searchTextBoxGotFocus = null; m_txtSearch = null; } if (m_userSecurityService != null) { m_userSecurityService.UnRegisterListener(m_userSecurityService.OperatorRequestID, m_userSecurityDataCallBack); m_userSecurityDataCallBack = null; m_userSecurityService = null; } if (m_window != null) { m_window.UnRegisterEvent(m_invokeEvent, EVENTID.INVOKE); m_invokeEvent = null; m_window.UnRegisterEvent(m_timerEvent, EVENTID.TIMER); m_timerEvent = null; m_window.Close(); m_window.Dispose(); m_window = null; } base.Dispose(); } }
/// <summary> /// 销毁方法 /// </summary> public override void Dispose() { if (!IsDisposed) { if (m_chatService != null) { if (m_chatDataCallBackEvent != null) { m_chatService.UnRegisterListener(m_chatService.RequestID, m_chatDataCallBackEvent); m_chatDataCallBackEvent = null; } m_chatService = null; } base.Dispose(); } }
/// <summary> /// 注册数据监听 /// </summary> /// <param name="requestID">请求ID</param> /// <param name="callBack">回调函数</param> public virtual void registerListener(int requestID, ListenerMessageCallBack callBack) { lock (m_listeners) { FCMessageListener listener = null; if (!m_listeners.ContainsKey(requestID)) { listener = new FCMessageListener(); m_listeners.put(requestID, listener); } else { listener = m_listeners.get(requestID); } listener.add(callBack); } }
/// <summary> /// 创建登录窗体 /// </summary> /// <param name="native">方法库</param> public LoginWindow(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\LoginWindow.xml"; Native = m_native; LoadFile(xmlPath, null); m_window = FindControl("windowLogin") as WindowEx; m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册点击事件 RegisterEvents(m_window); m_loginService = DataCenter.LoginService; m_loginDataCallBackEvent = new ListenerMessageCallBack(LoginDataCallBack); m_loginService.RegisterListener(m_loginRequestID, m_loginDataCallBackEvent); }
/// <summary> /// 注册数据监听 /// </summary> /// <param name="requestID">请求ID</param> /// <param name="callBack">回调函数</param> public virtual void RegisterListener(int requestID, ListenerMessageCallBack callBack) { lock (m_listeners) { MessageListener listener = null; if (!m_listeners.ContainsKey(requestID)) { listener = new MessageListener(); m_listeners[requestID] = listener; } else { listener = m_listeners[requestID]; } listener.Add(callBack); } }
/// <summary> /// 添加控件方法 /// </summary> public override void OnAdd() { base.OnAdd(); if (m_securityService == null) { //注册服务 m_securityService = DataCenter.SecurityService; m_userSecurityService = DataCenter.UserSecurityService; m_userSecurityDataCallBack = new ListenerMessageCallBack(UserSecurityDataCallBack); m_userSecurityService.RegisterListener(m_userSecurityService.GetListRequestID, m_userSecurityDataCallBack); m_userSecurityService.RegisterListener(m_userSecurityService.OperatorRequestID, m_userSecurityDataCallBack); //注册行情 m_quoteService = DataCenter.QuoteService; m_latestDataCallBack = new ListenerMessageCallBack(LatestDataCallBack); m_quoteService.RegisterListener(m_latestDataRequestID, m_latestDataCallBack); StartTimer(m_timerID, 10); } }
/// <summary> /// 创建条件选股界面 /// </summary> /// <param name="native">方法库</param> public IndicatorLayoutList(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\IndicatorLayoutList.xml"; Native = m_native; LoadFile(xmlPath, null); m_window = FindControl("windowILL") as WindowEx; m_gridLayouts = GetGrid("gridLayouts"); m_gridSelectedRowsChangedEvent = new ControlEvent(GridSelectedRowsChanged); m_gridLayouts.RegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册点击事件 RegisterEvents(m_window); m_indicatorLayoutService = DataCenter.IndicatorLayoutService; m_indicatorLayoutDataCallBack = new ListenerMessageCallBack(IndicatorLayoutDataCallBack); m_indicatorLayoutService.RegisterListener(m_indicatorLayoutService.OperatorRequestID, m_indicatorLayoutDataCallBack); }
/// <summary> /// 销毁方法 /// </summary> public override void Dispose() { if (!IsDisposed) { if (m_quoteService != null) { m_quoteService.UnRegisterListener(m_latestDataRequestID, m_latestDataCallBack); m_latestDataCallBack = null; m_quoteService = null; } m_latestDatas.Clear(); if (m_userSecurityService != null) { m_userSecurityService.UnRegisterListener(m_userSecurityService.OperatorRequestID, m_userSecurityDataCallBack); m_userSecurityDataCallBack = null; m_userSecurityService = null; } base.Dispose(); } }
/// <summary> /// 创建条件选股界面 /// </summary> /// <param name="native">方法库</param> public SecurityFilterList(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\SecurityFilterList.xml"; Native = m_native; LoadFile(xmlPath, null); m_window = FindControl("windowSF") as WindowEx; m_gridTemplate = GetGrid("gridTemplates"); m_gridSelectedRowsChangedEvent = new ControlEvent(GridSelectedRowsChanged); m_gridTemplate.RegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册秒表 m_timerEvent = new ControlTimerEvent(CallTimer); m_window.RegisterEvent(m_timerEvent, EVENTID.TIMER); //注册点击事件 RegisterEvents(m_window); m_securityService = DataCenter.SecurityService; m_securityFilterService = DataCenter.SecurityFilterService; m_securityFilterDataCallBackEvent = new ListenerMessageCallBack(SecurityFilterDataCallBack); m_securityFilterService.RegisterListener(m_securityFilterService.OperatorRequestID, m_securityFilterDataCallBackEvent); }
/// <summary> /// 创建股票列表窗体 /// </summary> /// <param name="native">方法库</param> public SecurityList(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\SecurityList.xml"; Native = m_native; LoadFile(xmlPath, null); m_window = FindControl("windowSecurity") as WindowEx; m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册点击事件 RegisterEvents(m_window); m_gridSecurities = GetGrid("gridSecurities"); m_gridSelectSecurities = GetGrid("gridSelectSecurities"); m_tvBlock = GetTree("tvBlock"); m_gridSelectedRowsChangedEvent = new ControlEvent(GridSelectedRowsChanged); m_tvBlock.RegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); //注册服务 m_securityService = DataCenter.SecurityService; m_securityDataCallBack = new ListenerMessageCallBack(SecurityDataCallBack); m_securityService.RegisterListener(m_securitiesRequestID, m_securityDataCallBack); m_userSecurityService = DataCenter.UserSecurityService; }
/// <summary> /// 创建自选股界面 /// </summary> /// <param name="native">方法库</param> public UserSecurityList(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\UserSecurityList.xml"; Native = m_native; LoadFile(xmlPath, null); m_window = FindControl("windowUS") as WindowEx; m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册秒表 m_timerEvent = new ControlTimerEvent(CallTimer); m_window.RegisterEvent(m_timerEvent, EVENTID.TIMER); //注册点击事件 RegisterEvents(m_window); m_gridCategory = GetGrid("gridCategory"); m_gridSelectedRowsChangedEvent = new ControlEvent(GridSelectedRowsChanged); m_gridCategory.RegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_gridCellEditEndEvent = new GridCellEvent(CategoryGridCellEditEnd); m_gridCategory.RegisterEvent(m_gridCellEditEndEvent, EVENTID.GRIDCELLEDITEND); m_gridSecurities = GetGrid("gridSecurities"); m_gridCellClick = new GridCellMouseEvent(GridCellClick); m_gridSecurities.RegisterEvent(m_gridCellClick, EVENTID.GRIDCELLCLICK); //注册服务 m_securityService = DataCenter.SecurityService; m_userSecurityService = DataCenter.UserSecurityService; m_userSecurityDataCallBack = new ListenerMessageCallBack(UserSecurityDataCallBack); m_userSecurityService.RegisterListener(m_userSecurityService.OperatorRequestID, m_userSecurityDataCallBack); //注册行情 m_quoteService = DataCenter.QuoteService; m_latestDataCallBack = new ListenerMessageCallBack(LatestDataCallBack); m_quoteService.RegisterListener(m_latestDataRequestID, m_latestDataCallBack); //搜索文本框 m_txtSearch = GetTextBox("txtSearch"); m_searchTextBoxGotFocus = new ControlEvent(SearchTextBoxGotFocus); m_txtSearch.RegisterEvent(m_searchTextBoxGotFocus, EVENTID.GOTFOCUS); }
/// <summary> /// 创建宏管理界面 /// </summary> /// <param name="native">方法库</param> public MacroList(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\MacroList.xml"; Native = m_native; LoadFile(xmlPath, null); m_window = FindControl("windowMacro") as WindowEx; m_divIcon = GetDiv("divIcon"); m_divIcon.ResourcePath = DataCenter.GetAppPath() + "\\config\\icons\\"; m_gridIcons = GetGrid("gridIcons"); m_gridCellClickEvent = new GridCellMouseEvent(GridCellClick); m_gridIcons.RegisterEvent(m_gridCellClickEvent, EVENTID.GRIDCELLCLICK); m_gridMacros = GetGrid("gridMacros"); m_gridSelectedRowsChangedEvent = new ControlEvent(GridSelectedRowsChanged); m_gridMacros.RegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_invokeEvent = new ControlInvokeEvent(Invoke); m_window.RegisterEvent(m_invokeEvent, EVENTID.INVOKE); //注册点击事件 RegisterEvents(m_window); m_macroService = DataCenter.MacroService; m_macroDataCallBack = new ListenerMessageCallBack(MacroDataCallBack); m_macroService.RegisterListener(m_macroService.OperatorRequestID, m_macroDataCallBack); }
/// <summary> /// 销毁方法 /// </summary> public override void Dispose() { if (!IsDisposed) { if (m_loginService != null) { if (m_loginDataCallBackEvent != null) { m_loginService.UnRegisterListener(m_loginRequestID, m_loginDataCallBackEvent); m_loginDataCallBackEvent = null; } m_loginService = null; } if (m_window != null) { m_window.UnRegisterEvent(m_invokeEvent, EVENTID.INVOKE); m_invokeEvent = null; m_window.Close(); m_window.Dispose(); m_window = null; } base.Dispose(); } }
/// <summary> /// 移除回调 /// </summary> /// <param name="callBack">回调</param> public void Remove(ListenerMessageCallBack callBack) { m_callBacks.Remove(callBack); }
/// <summary> /// 添加回调 /// </summary> /// <param name="callBack">回调</param> public void Add(ListenerMessageCallBack callBack) { m_callBacks.Add(callBack); }