예제 #1
0
        public void OnNotifyMsgNtf(String strNotifyMsg)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new DlgtVoidInputString(OnNotifyMsgNtf), strNotifyMsg);
            }
            else
            {
                string[] msgs = strNotifyMsg.Split(new Char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string msg in msgs)
                {
                    string jsonMsg = GlobalMgr.TrimStartString(msg, "#", "");

                    if (jsonMsg.ToLower() == "{ping}")
                    {
                        //if(HeartBeatLostTime >= MAX_HEARTBEAT_LOST)
                        //SetStatus("服务器已连接");

                        // We get feedback, reset the heart beat lost count to 0.
                        HeartBeatLostTime = 0;
                        continue;
                    }

                    try
                    {
                        JObject jo = JObject.Parse(jsonMsg);
                        if (jo == null)
                        {
                            return;
                        }

                        NtfMsgInfo ntfMsgInfo = new NtfMsgInfo();

                        ntfMsgInfo.TitleInfo = jo["title"].ToString();
                        ntfMsgInfo.LinkInfo  = jo["link"].ToString();
                        ntfMsgInfo.TimeInfo  = DateTime.Now.ToString(TimeConverter.Format, TimeConverter.CultureInfo);

                        InsertNewMsg(ntfMsgInfo);

                        TrayMsgControl.AddToTrayMsgQueue(ntfMsgInfo);
                        //   notifyIcon1.ShowBalloonTip(5000, ntfMsgInfo.TimeInfo, ntfMsgInfo.TitleInfo, ToolTipIcon.Info);

                        if (this.WindowState == FormWindowState.Minimized)
                        {
                            // Enable icon flash on Tray.
                            TrayIconFlash(true);
                        }
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
        }
예제 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!GlobalMgr.Init())
            {
                return;
            }

            Application.Run(GlobalMgr.s_formMain);
        }