/// <summary> /// 创建聊天窗体 /// </summary> /// <param name="native">方法库</param> public ChatWindow(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\ChatWindow.xml"; Native = m_native; LoadFile(xmlPath, null); m_window = FindControl("windowChat") as WindowEx; 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> /// <param name="message">消息</param> private void OnLoginDataCallBack(CMessage message) { List <LoginInfo> loginInfos = new List <LoginInfo>(); LoginService.GetLoginInfos(loginInfos, message.m_body, message.m_bodyLength); if (loginInfos.Count > 0) { LoginInfo loginInfo = loginInfos[0]; if (loginInfo.m_state == 1) { DataCenter.SaveLoginInfo(loginInfo); m_window.Invoke(loginInfo.m_type); } else { m_window.Invoke(-1); } } }
/// <summary> /// 登录 /// </summary> public void Login() { int state = DataCenter.Connect(); if (state == -1) { m_chart.ShowMessageBox("无法连接服务器!", "提示", 0); return; } TabControlA tabLogin = GetTabControl("tabLogin"); TabPageA selectedTabpage = tabLogin.SelectedTabPage; TextBoxA txtUserName = GetTextBox("txtUserName"); TextBoxA txtPassword = GetTextBox("txtPassword"); String userName = txtUserName.Text; String passWord = txtPassword.Text; if (userName.Length == 0) { m_chart.ShowMessageBox("请输入邮箱!", "提示", 0); return; } if (userName.IndexOf("@") == -1) { m_chart.ShowMessageBox("邮箱格式不符合要求!", "提示", 0); return; } if (passWord.Length == 0) { m_chart.ShowMessageBox("请输入密码!", "提示", 0); return; } int ret = m_loginService.Login(userName, passWord, m_loginRequestID); if (ret != -1) { UserCookieService cookieService = DataCenter.UserCookieService; UserCookie cookie = new UserCookie(); cookie.m_key = "LOGININFO"; cookie.m_value = userName + "," + passWord; cookieService.AddCookie(cookie); m_window.Enabled = false; } }
/// <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(); }
/// <summary> /// 获取或设置是否需要创建表 /// </summary> public void CreateTable() { String dataBasePath = DataCenter.GetUserPath() + "\\data\\" + DATABASENAME; if (!CFileA.IsFileExist(dataBasePath)) { //创建数据库文件 SQLiteConnection.CreateFile(dataBasePath); } //创建表 SQLiteConnection conn = new SQLiteConnection(m_connectStr); conn.Open(); SQLiteCommand cmd = conn.CreateCommand(); cmd.CommandText = CREATETABLESQL; cmd.ExecuteNonQuery(); conn.Close(); }
/// <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> /// <param name="native">方法库</param> public SecurityFilterResult(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\SecurityFilterResult.xml"; m_xml = new UIXmlEx(); m_xml.Native = m_native; m_xml.LoadFile(xmlPath, null); m_window = m_xml.FindControl("windowSFR") as WindowEx; m_gridFilterResult = m_xml.FindControl("gridFilterResult") as GridA; m_gridFilterResult.RowStyle.Font = new FONT("SimSun", 14, false, false, false); m_gridCellClick = new GridCellMouseEvent(GridCellClick); m_gridFilterResult.RegisterEvent(m_gridCellClick, EVENTID.GRIDCELLCLICK); //注册秒表 m_timerEvent = new ControlTimerEvent(CallTimer); m_window.RegisterEvent(m_timerEvent, EVENTID.TIMER); //注册点击事件 RegisterEvents(m_window); }
/// <summary> /// 创建连接设置窗体 /// </summary> /// <param name="native">方法库</param> /// <param name="order">主窗体</param> public ConnectWindow(INativeBase native) { m_native = native; String xmlPath = DataCenter.GetAppPath() + "\\config\\ConnectWindow.xml"; Native = native; LoadFile(xmlPath, null); m_window = GetWindow("windowConnect") as WindowEx; m_gridServers = GetGrid("gridServers"); m_gridSelectedRowsChangedEvent = new ControlEvent(GridSelectedRowsChanged); m_gridServers.RegisterEvent(m_gridSelectedRowsChangedEvent, EVENTID.GRIDSELECTEDROWSCHANGED); m_connectServer = DataCenter.ConnectService; m_proxyService = DataCenter.ProxyService; m_serverService = DataCenter.ServerService; m_cbMainServerIP = GetComboBox("cbMainServerIP"); m_cbType = GetComboBox("cbType"); m_spinPort = GetSpin("spinPort"); m_txtIP = GetTextBox("txtIP"); m_txtMainServerPort = GetSpin("spinMainServerPort"); //注册点击事件 RegisterEvents(m_window); }
/// <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 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> private void LoadIcons() { String dir = DataCenter.GetAppPath() + "\\config\\icons\\"; m_gridIcons.ResourcePath = dir; List <String> files = new List <String>(); CFileA.GetFiles(dir, files); int filesSize = files.Count; int columnsSize = m_gridIcons.GetColumns().Count; m_gridIcons.BeginUpdate(); GridRow row = null; for (int i = 0; i < filesSize; i++) { int col = i; if (i >= columnsSize) { col = i % columnsSize; } if (col == 0) { row = new GridRow(); row.Height = 64; m_gridIcons.AddRow(row); } String file = files[i]; file = file.Substring(file.LastIndexOf('\\') + 1); GridIconCell iconCell = new GridIconCell(); iconCell.SetString(file); row.AddCell(col, iconCell); } m_gridIcons.EndUpdate(); m_gridIcons.Invalidate(); }
/// <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 UserSecurityCellT2() { AllowDrag = true; BorderColor = COLOR.EMPTY; ResourcePath = DataCenter.GetAppPath() + "\\config\\images"; }