Exemple #1
0
        /// <summary>
        /// 登录
        /// </summary>
        public void Login()
        {
            DataCenter.LoadData(1);
            Close();
            return;

            int state = DataCenter.Connect();

            if (state == -1)
            {
                m_mainFrame.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_mainFrame.ShowMessageBox("请输入邮箱!", "提示", 0);
                return;
            }
            if (userName.IndexOf("@") == -1)
            {
                m_mainFrame.ShowMessageBox("邮箱格式不符合要求!", "提示", 0);
                return;
            }
            if (passWord.Length == 0)
            {
                m_mainFrame.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;
            }
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
        /// <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();
        }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
        /// <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);
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// 调用控件线程方法
        /// </summary>
        /// <param name="args">参数</param>
        public void OnInvoke(object args)
        {
            if (args != null && args.ToString() == "close")
            {
                return;
            }
            int state = Convert.ToInt32(args);

            if (state >= 0)
            {
                DataCenter.LoadData(state);
                Close();
            }
            else
            {
                m_mainFrame.ShowMessageBox("您输入的用户名或密码错误!", "提示", 0);
                m_window.Enabled = true;
            }
            Native.Invalidate();
        }
Exemple #7
0
 /// <summary>
 /// 加载
 /// </summary>
 /// <param name="name">名称</param>
 public void Load(String name)
 {
     if (name == "MainFrame")
     {
         m_xml = new MainFrame();
     }
     m_xml.CreateNative();
     m_native                = m_xml.Native;
     m_native.Paint          = new GdiPlusPaintEx();
     m_host                  = new WinHostEx();
     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_xml.ResetScaleSize(GetClientSize());
     m_xml.Script = new GaiaScript(m_xml);
     m_xml.Load(DataCenter.GetAppPath() + "\\config\\" + name + ".html");
     m_native.Update();
     Invalidate();
 }
Exemple #8
0
        /// <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);
        }
Exemple #9
0
        /// <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;
        }
Exemple #10
0
        /// <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);
        }
Exemple #11
0
        static void Main(String[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DataCenter.StartService();

            /*int ctpID = CFunctionCTP.Create();
             * int ctpRequestID = CFunctionCTP.GenerateReqID(ctpID);
             * CFunctionCTP.Start(ctpID, ctpRequestID, "tcp://180.168.146.187:10010", "tcp://180.168.146.187:10000", "9999", "000678", "567890");
             * while (CFunctionCTP.IsMdRunning(ctpID) == 0 || CFunctionCTP.IsTdRunning(ctpID) == 0)
             * {
             *  Thread.Sleep(1000);
             * }
             *
             * ctpRequestID = CFunctionCTP.GenerateReqID(ctpID);
             * CFunctionCTP.SubMarketDatas(ctpID, ctpRequestID, "IF1705, rb1712");
             *
             * StringBuilder sb = new StringBuilder(1024);
             * while (true)
             * {
             *  if (CFunctionCTP.GetDepthMarketData(ctpID, sb) != 0)
             *  {
             *      int i = 0;
             *      i--;
             *  }
             * }*/


            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            if (args == null || args.Length == 0)
            {
                MainForm mainForm = new MainForm();
                mainForm.Load("MainFrame");
                Application.Run(mainForm);
            }
        }
Exemple #12
0
        /// <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();
        }
Exemple #13
0
        /// <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);
        }
Exemple #14
0
 /// <summary>
 /// 退出程序
 /// </summary>
 public override void Exit()
 {
     DataCenter.DisConnect();
 }
Exemple #15
0
 /// <summary>
 /// 创建单元格
 /// </summary>
 public UserSecurityCellT2()
 {
     AllowDrag    = true;
     BorderColor  = COLOR.EMPTY;
     ResourcePath = DataCenter.GetAppPath() + "\\config\\images";
 }