Пример #1
0
        void app_OnLogin(Chatting.Protocol.Response response)
        {
            if (response.Success)
            {
                Dispatcher.Invoke(new Action(() =>
                {

                    this.Visibility = Visibility.Hidden;
                    this.notifyIcon = new System.Windows.Forms.NotifyIcon();
                    this.notifyIcon.BalloonTipText = "托盘应用程序正在运行!";
                    this.notifyIcon.Text = "托盘应用程序!";
                    this.notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath);
                    this.notifyIcon.Visible = true;
                    this.notifyIcon.ShowBalloonTip(1000);
                    wf.MenuItem mi = new wf.MenuItem("退出", (p, q) =>
                    {
                        this.Close();
                        App.Current.Shutdown();
                    });
                    wf.MenuItem mi2 = new wf.MenuItem("显示登录窗口", (p, q) =>
                    {
                        this.Visibility = Visibility.Visible;
                    });

                    wf.MenuItem mi3 = new wf.MenuItem("打开聊天窗口", (p, q) =>
                    {
                        App.ChatWin.Show();
                    });
                    this.notifyIcon.ContextMenu = new wf.ContextMenu(new wf.MenuItem[] { mi, mi2, mi3 });
                }), null);

            }
            else
            {
                MessageBox.Show(response.Data.ToString());
            }
        }
Пример #2
0
 public void SendFile(string uname, Chatting.Protocol.FileInfo fi)
 {
     Request reques = new Request();
     reques.SourceUserName = CurrentUser.UserName;
     reques.TargetUserName = uname;
     reques.Data = fi;
     reques.ProcessType = ProcessType.File;
     CliendSocket.SocketSend(reques);
 }
Пример #3
0
        void app_OnRegister(Chatting.Protocol.Response response)
        {
            if (response.Success)
            {
                User user = response.Data as User;
                App.CurrentUser = user;

                MessageBox.Show("注册成功");
            }
            else
            {
                MessageBox.Show(response.Data.ToString());
            }
        }