public void Notify(object data)
        {
            if (data == null)
            {
                return;
            }
            if (data.Equals(SocketCommService.ObserverClearCacheMessageData))
            {
                ClearMenu();
                return;
            }
            if (!(data is UserInfo))
            {
                return;
            }
            UserInfo userInfo = data as UserInfo;
            if (userInfo == null)
            {
                return;
            }

            if (this.InvokeRequired == false)
            {
                UpdateMenu(userInfo);
            }
            else
            {
                if (UpdateMenuDelegateInstance == null)
                {
                    UpdateMenuDelegateInstance = new UpdateMenuDelegate(UpdateMenu);
                }
                BeginInvoke(UpdateMenuDelegateInstance, userInfo);
            }
        }
Esempio n. 2
0
        public void Notify(object data)
        {
            if (data == null)
            {
                return;
            }
            if (data.Equals(SocketCommService.ObserverClearCacheMessageData))
            {
                ClearMenu();
                return;
            }
            if (!(data is UserInfo))
            {
                return;
            }
            UserInfo userInfo = data as UserInfo;

            if (userInfo == null)
            {
                return;
            }

            if (this.InvokeRequired == false)
            {
                UpdateMenu(userInfo);
            }
            else
            {
                if (UpdateMenuDelegateInstance == null)
                {
                    UpdateMenuDelegateInstance = new UpdateMenuDelegate(UpdateMenu);
                }
                BeginInvoke(UpdateMenuDelegateInstance, userInfo);
            }
        }
Esempio n. 3
0
        public FrmTray()
        {
            InitializeComponent();

            this.InitTrayMenu();        //设置菜单列表

            DoInitMenu = InitTrayMenu;

            DoUpdateMenuByGroupName = FlushTrayChildMenuInGroup;

            Utils.ClearMemory();        //释放内存

            //注册热键
            _winQKey = HotKey.GlobalAddAtom(_winQ);
            HotKey.RegisterHotKey(this.Handle, _winQKey, HotKey.KeyModifiers.WindowsKey, (int)Keys.Q);
        }