/// <summary> /// 销毁方法 /// </summary> public override void Dispose() { if (!IsDisposed) { m_chart = null; if (m_gridTemplate != null) { m_gridTemplate.UnRegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_gridSelectedRowsChangedEvent = null; m_gridTemplate = null; } if (m_securityFilterService != null) { m_securityFilterService.UnRegisterListener(m_securityFilterService.OperatorRequestID, m_securityFilterDataCallBackEvent); m_securityFilterDataCallBackEvent = null; m_securityFilterService = null; } if (m_window != null) { m_window.UnRegisterEvent(m_invokeEvent, EVENTID.INVOKE); m_invokeEvent = null; m_window.StopTimer(m_timerID); 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) { m_chart = null; if (m_gridLayouts != null) { m_gridLayouts.UnRegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_gridSelectedRowsChangedEvent = null; m_gridLayouts = null; } if (m_indicatorLayoutService != null) { m_indicatorLayoutService.UnRegisterListener(m_indicatorLayoutService.OperatorRequestID, m_indicatorLayoutDataCallBack); m_indicatorLayoutDataCallBack = null; m_indicatorLayoutService = 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="sender">调用者</param> /// <param name="e">参数</param> private void MainWindow_Loaded(object sender, RoutedEventArgs e) { //创建管理器 m_host = new WPFHost(); //注册消息 WindowInteropHelper helper = new WindowInteropHelper(this); m_host.WindowHwnd = helper.Handle; HwndSource hwndSource = HwndSource.FromHwnd(m_host.WindowHwnd); hwndSource.AddHook(new HwndSourceHook(WndProc)); //启动服务 DataCenter.StartService(); //创建方法库 m_chart = new OwChart(); m_chart.CreateNative(); m_native = m_chart.Native; m_wpfPaint = new WPFPaint(); m_native.Paint = m_wpfPaint; m_native.Host = m_host; m_host.Render = new Render(m_native); m_native.DisplaySize = new SIZE(525, 350); AddChild(m_host.Render); m_host.Container = m_host.Render; m_host.Native = m_native; m_chart.Load(WPFHost.GetAppPath() + "\\config\\MainFrame.xml"); m_host.Render.Chart = m_chart; m_chart.ShowLoginWindow(); }
/// <summary> /// 销毁方法 /// </summary> public void Dispose() { if (!m_isDisposed) { m_chart = null; if (m_gridFilterResult != null) { m_gridFilterResult.UnRegisterEvent(m_gridCellClick, EVENTID.GRIDCELLCLICK); m_gridCellClick = null; m_gridFilterResult = null; } if (m_window != null) { m_window.StopTimer(m_timerID); m_window.UnRegisterEvent(m_timerEvent, EVENTID.TIMER); m_timerEvent = null; m_window.Close(); m_window.Dispose(); m_window = null; } if (m_xml != null) { m_xml.Dispose(); m_xml = null; } m_isDisposed = true; } }
/// <summary> /// 销毁方法 /// </summary> public override void Dispose() { if (!IsDisposed) { m_chart = null; if (m_gridIcons != null) { m_gridIcons.UnRegisterEvent(m_gridCellClickEvent, EVENTID.GRIDCELLCLICK); m_gridCellClickEvent = null; m_gridIcons = null; } if (m_gridMacros != null) { m_gridMacros.UnRegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_gridSelectedRowsChangedEvent = null; m_gridMacros = null; } if (m_macroService != null) { m_macroService.UnRegisterListener(m_macroService.OperatorRequestID, m_macroDataCallBack); m_macroDataCallBack = null; m_macroService = 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="chart">行情控件</param> /// <param name="indicator">指标</param> /// <param name="id">ID</param> /// <param name="name">名称</param> /// <param name="withParameters">是否有参数</param> public CFunctionEx(OwChart chart, CIndicator indicator, int id, String name) { m_chart = chart; m_indicator = indicator; m_ID = id; m_name = name; }
/// <summary> /// 加载XML /// </summary> /// <param name="xmlPath">XML路径</param> public override void Load(String xmlPath) { LoadFile(xmlPath, null); m_owChart = new OwChart(this); DataCenter.MainUI = this; ControlA control = Native.GetControls()[0]; control.BackColor = CDraw.PCOLORS_BACKCOLOR9; RegisterEvents(control); //CFunctionAjax.SetListener(control); //ShowLoginWindow(); }
/// <summary> /// 创建图形控件 /// </summary> public MainForm() { InitializeComponent(); m_chart = new OwChart(); m_chart.CreateNative(); m_native = m_chart.Native; m_native.Paint = new GdiPlusPaintEx(); m_host = new WinformControlHostEx(); m_host.Native = m_native; m_native.Host = m_host; m_host.HWnd = Handle; m_native.AllowScaleSize = true; m_native.DisplaySize = new SIZE(ClientSize.Width, ClientSize.Height); m_chart.ResetScaleSize(GetClientSize()); Invalidate(); m_chart.Load(DataCenter.GetAppPath() + "\\config\\MainFrame.xml"); m_native.Update(); //m_chart.ShowLoginWindow(); }