Example #1
0
 public void SetUser(IUser user)
 {
     this.lblQm.Text               = user.Signature;
     this.skinLabel_id.Text        = user.ID;
     this.skinLabel_name.Text      = user.Name;
     this.pnlImgTx.BackgroundImage = GlobalResourceManager.GetHeadImageOnline((GGUser)user);
 }
Example #2
0
        public UpdateUserInfoForm(IRapidPassiveEngine engine, GlobalUserCache globalUserCache, GGUser user)
        {
            InitializeComponent();

            this.rapidPassiveEngine = engine;
            this.currentUser        = user;
            int registerPort = int.Parse(ConfigurationManager.AppSettings["RemotingPort"]);

            this.ggService = (IRemotingService)Activator.GetObject(typeof(IRemotingService), string.Format("tcp://{0}:{1}/RemotingService", ConfigurationManager.AppSettings["ServerIP"], registerPort));;

            this.skinLabel_ID.Text = user.UserID;
            this.skinTextBox_nickName.SkinTxt.Text  = user.Name;
            this.skinTextBox_signature.SkinTxt.Text = user.Signature;

            if (user.HeadImageIndex >= 0)
            {
                this.headImageIndex           = user.HeadImageIndex;
                this.pnlImgTx.BackgroundImage = GlobalResourceManager.GetHeadImage(user); //根据ID获取头像
            }
            else
            {
                this.pnlImgTx.BackgroundImage = user.HeadImage;
                this.selfPhoto = true;
            }
        }
Example #3
0
        private INDiskOutter nDiskOutter; // V2.0

        #region Ctor
        public MainForm()
        {
            InitializeComponent();
            this.autoDocker1.Initialize(this);

            this.toolStripSplitButton_Friends.Visible = true;
            this.添加好友toolStripMenuItem.Visible        = true;
            this.查找好友ToolStripMenuItem.Visible        = true;
            this.头像显示ToolStripMenuItem.Visible        = true;

            UiSafeInvoker invoker = new UiSafeInvoker(this, true, true, GlobalResourceManager.Logger);

            GlobalResourceManager.SetUiSafeInvoker(invoker);

            this.toolstripButton_mainMenu.Image = GlobalResourceManager.Png64;

            this.friendListBox1.AddCatalogClicked        += new CbGeneric(friendListBox1_AddCatalogClicked);
            this.friendListBox1.ChangeCatalogNameClicked += new CbGeneric <string>(friendListBox1_ChangeCatalogNameClicked);
            this.friendListBox1.UserDoubleClicked        += new CbGeneric <IUser>(friendListBox1_UserDoubleClicked);
            this.friendListBox1.RemoveUserClicked        += new CbGeneric <IUser>(friendListBox1_RemoveUserClicked);
            this.friendListBox1.ChatRecordClicked        += new CbGeneric <IUser>(friendListBox1_ChatRecordClicked);
            this.friendListBox1.CatalogAdded             += new CbGeneric <string>(friendListBox1_CatalogAdded);
            this.friendListBox1.CatalogNameChanged       += new CbGeneric <string, string, bool>(friendListBox1_CatalogNameChanged);
            this.friendListBox1.CatalogRemoved           += new CbGeneric <string>(friendListBox1_CatalogRemoved);
            this.friendListBox1.FriendCatalogMoved       += new CbGeneric <string, string, string>(friendListBox1_FriendCatalogMoved);
            this.recentListBox1.UnitDoubleClicked        += new CbGeneric <string, bool>(recentListBox1_UserDoubleClicked);
            this.recentListBox1.ChatRecordClicked        += new CbGeneric <string, bool>(recentListBox1_ChatRecordClicked);
            this.groupListBox.GroupDoubleClicked         += new CbGeneric <IGroup>(groupListBox_GroupDoubleClicked);
            this.groupListBox.DismissGroupClicked        += new CbGeneric <IGroup>(groupListBox_DismissGroupClicked);
            this.groupListBox.QuitGroupClicked           += new CbGeneric <IGroup>(groupListBox_QuitGroupClicked);
            this.groupListBox.ChatRecordClicked          += new CbGeneric <IGroup>(groupListBox_ChatRecordClicked);
        }
Example #4
0
        void do_rapidPassiveEngine_ConnectionInterrupted()
        {
            this.globalUserCache.CurrentUser.UserStatus = UserStatus.OffLine;
            this.skinButton_headImage.Image             = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser);
            this.skinButton_State.Image   = Properties.Resources.imoffline__2_;
            this.skinButton_State.Tag     = ChatListSubItem.UserStatus.OffLine;
            this.skinButton_State.Enabled = false;
            this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:离线,正在重连 . . .", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID));
            this.notifyIcon.ChangeMyStatus(UserStatus.OffLine);

            foreach (GGUser friend in this.globalUserCache.GetAllUser())
            {
                friend.UserStatus = UserStatus.OffLine;
            }
            this.friendListBox1.SetAllUserOffline();
            this.recentListBox1.SetAllUserOffline();

            foreach (ChatForm form in this.chatFormManager.GetAllForms())
            {
                form.MyselfOffline();
            }

            foreach (GroupChatForm form in this.groupChatFormManager.GetAllForms())
            {
                form.MyselfOffline();
            }
        }
Example #5
0
        public LoginForm(IRapidPassiveEngine engine, ICustomizeHandler handler)
        {
            this.rapidPassiveEngine = engine;
            this.customizeHandler   = handler;

            int registerPort = int.Parse(ConfigurationManager.AppSettings["RemotingPort"]);

            this.remotingService = (IRemotingService)Activator.GetObject(typeof(IRemotingService), string.Format("tcp://{0}:{1}/RemotingService", ConfigurationManager.AppSettings["ServerIP"], registerPort));;

            InitializeComponent();

            Dictionary <UserStatus, Image> statusImageDictionary = new Dictionary <UserStatus, Image>();

            statusImageDictionary.Add(UserStatus.Online, this.imageList_state.Images[0]);
            statusImageDictionary.Add(UserStatus.Away, this.imageList_state.Images[1]);
            statusImageDictionary.Add(UserStatus.Busy, this.imageList_state.Images[2]);
            statusImageDictionary.Add(UserStatus.DontDisturb, this.imageList_state.Images[3]);
            statusImageDictionary.Add(UserStatus.Hide, this.imageList_state.Images[4]);
            statusImageDictionary.Add(UserStatus.OffLine, this.imageList_state.Images[5]);
            GlobalResourceManager.SetStatusImage(statusImageDictionary);

            this.skinLabel_SoftName.Text = GlobalResourceManager.SoftwareName;

            this.checkBoxRememberPwd.Checked = SystemSettings.Singleton.RememberPwd;
            this.checkBoxAutoLogin.Checked   = SystemSettings.Singleton.AutoLogin;
            this.textBoxId.SkinTxt.Text      = SystemSettings.Singleton.LastLoginUserID;
            if (SystemSettings.Singleton.RememberPwd)
            {
                this.textBoxPwd.SkinTxt.Text = "11111111";
                this.pwdMD5   = SystemSettings.Singleton.LastLoginPwdMD5;
                this.pwdIsMD5 = true;
            }
        }
        public void GroupmateStateChanged(string userID, UserStatus newStatus)
        {
            ChatListSubItem[] items = this.chatListBox1.GetSubItemsByNicName(userID);
            if (items == null || items.Length == 0)
            {
                return;
            }

            items[0].Status = GlobalResourceManager.ConvertUserStatus(newStatus);
            this.chatListBox1.Invalidate();
        }
Example #7
0
        void form_UserInfoChanged(GGUser user)
        {
            this.labelSignature.Text        = this.globalUserCache.CurrentUser.Signature;
            this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser);
            this.labelName.Text             = this.globalUserCache.CurrentUser.Name;
            this.globalUserCache.AddOrUpdateUser(this.globalUserCache.CurrentUser);

            foreach (ChatForm chatForm in this.chatFormManager.GetAllForms())
            {
                chatForm.OnMyInfoChanged(this.globalUserCache.CurrentUser);
            }
        }
        public void OnUserInfoChanged(GGUser user)
        {
            ChatListSubItem[] items = this.chatListBox1.GetSubItemsByNicName(user.UserID);
            if (items == null || items.Length == 0)
            {
                return;
            }

            items[0].HeadImage   = GlobalResourceManager.GetHeadImage(user);
            items[0].DisplayName = user.Name;
            items[0].PersonalMsg = user.Signature;
            items[0].Tag         = user;
            this.chatListBox1.Invalidate();
        }
Example #9
0
        //状态选择项
        private void Item_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem Item = (ToolStripMenuItem)sender;

            skinButton_State.Image = Item.Image;
            skinButton_State.Tag   = Item.Tag;
            this.globalUserCache.CurrentUser.UserStatus = (UserStatus)Convert.ToInt32(skinButton_State.Tag);
            this.myStatus = this.globalUserCache.CurrentUser.UserStatus;

            this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser, true);
            this.notifyIcon.ChangeMyStatus(this.myStatus);
            this.rapidPassiveEngine.CustomizeOutter.Send(InformationTypes.ChangeStatus, BitConverter.GetBytes((int)this.globalUserCache.CurrentUser.UserStatus));

            this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus)));
        }
Example #10
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                GlobalResourceManager.PreInitialize();

                //ESPlus.GlobalUtil.SetMaxLengthOfUserID(20);
                ESPlus.GlobalUtil.SetMaxLengthOfMessage(1024 * 1024 * 10);
                //OMCS.GlobalUtil.SetMaxLengthOfUserID(20);
                MainForm            mainForm      = new MainForm();
                IRapidPassiveEngine passiveEngine = RapidEngineFactory.CreatePassiveEngine();

                NDiskPassiveHandler     nDiskPassiveHandler = new NDiskPassiveHandler();                                  //V 2.0
                ComplexCustomizeHandler complexHandler      = new ComplexCustomizeHandler(nDiskPassiveHandler, mainForm); //V 2.0
                LoginForm loginForm = new LoginForm(passiveEngine, complexHandler);

                if (loginForm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                #region 初始化OMCS
                Program.MultimediaManager = MultimediaManagerFactory.GetSingleton();
                Program.MultimediaManager.CameraDeviceIndex     = SystemSettings.Singleton.WebcamIndex;
                Program.MultimediaManager.MicrophoneDeviceIndex = SystemSettings.Singleton.MicrophoneIndex;
                Size?okSize = OMCS.Tools.Camera.MatchCameraVideoSize(SystemSettings.Singleton.WebcamIndex, GlobalConsts.CommonQualityVideo);
                Program.MultimediaManager.CameraVideoSize     = okSize == null ? new Size(320, 240) : okSize.Value;
                Program.MultimediaManager.OmcsLogger          = GlobalResourceManager.Logger;
                Program.MultimediaManager.CameraEncodeQuality = 10;
                Program.MultimediaManager.Initialize(passiveEngine.CurrentUserID, "", ConfigurationManager.AppSettings["ServerIP"], int.Parse(ConfigurationManager.AppSettings["OmcsServerPort"]));
                #endregion

                nDiskPassiveHandler.Initialize(passiveEngine.FileOutter, null);
                mainForm.Initialize(passiveEngine, loginForm.LoginStatus, loginForm.StateImage);
                Application.Run(mainForm);
            }
            catch (Exception ee)
            {
                MessageBoxEx.Show(ee.Message);
                ee = ee;
            }
        }
Example #11
0
        void do_rapidPassiveEngine_RelogonCompleted(LogonResponse logonResponse)
        {
            if (logonResponse.LogonResult != LogonResult.Succeed)
            {
                this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:离线,请重新登录。", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID));
                MessageBoxEx.Show("自动重登录失败,可能是密码已经被修改。请重启程序,手动登录!", GlobalResourceManager.SoftwareName);
                return;
            }

            this.globalUserCache.CurrentUser.UserStatus = this.myStatus;
            this.skinButton_headImage.Image             = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser);
            this.skinButton_State.Enabled = true;
            this.skinButton_State.Image   = GlobalResourceManager.GetStatusImage(this.globalUserCache.CurrentUser.UserStatus);
            this.skinButton_State.Tag     = (int)this.globalUserCache.CurrentUser.UserStatus;
            this.globalUserCache.StartRefreshFriendInfo();
            this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus)));
            this.notifyIcon.ChangeMyStatus(this.globalUserCache.CurrentUser.UserStatus);
        }
Example #12
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            this.globalUserCache.StartRefreshFriendInfo();
            InformationForm frm = new InformationForm(this.rapidPassiveEngine.CurrentUserID, this.globalUserCache.CurrentUser.Name, GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser));

            frm.Show();
        }
Example #13
0
        /// <summary>
        /// 初始化流程:
        /// (1)Initialize时,从服务器加载自己的全部信息,从本地缓存文件加载好友列表。
        /// (2)MainForm_Load,填充ChatListBox
        /// (3)MainForm_Shown,调用globalUserCache在后台刷新:若是第一次登录,则分批从服务器加载好友资料。否则,从服务器获取好友最新状态和版本,并刷新本地缓存。
        /// (4)globalUserCache.FriendRTDataRefreshCompleted 事件,请求离线消息、离线文件、正式通知好友自己上线
        /// </summary>
        public void Initialize(IRapidPassiveEngine engine, ChatListSubItem.UserStatus userStatus, Image stateImage)//, Image headImage, string nickName, ChatListSubItem.UserStatus userStatus, Image stateImage)
        {
            GlobalResourceManager.PostInitialize(engine.CurrentUserID);
            this.Cursor = Cursors.WaitCursor;

            this.toolTip1.SetToolTip(this.skinButton_headImage, "帐号:" + engine.CurrentUserID);
            this.rapidPassiveEngine = engine;

            this.globalUserCache = new GlobalUserCache(this.rapidPassiveEngine);
            this.globalUserCache.FriendInfoChanged            += new CbGeneric <GGUser>(globalUserCache_FriendInfoChanged);
            this.globalUserCache.FriendStatusChanged          += new CbGeneric <GGUser>(globalUserCache_FriendStatusChanged);
            this.globalUserCache.GroupChanged                 += new CbGeneric <GGGroup, GroupChangedType, string>(globalUserCache_GroupInfoChanged);
            this.globalUserCache.FriendRTDataRefreshCompleted += new CbGeneric(globalUserCache_FriendRTDataRefreshCompleted);
            this.globalUserCache.FriendRemoved                += new CbGeneric <string>(globalUserCache_FriendRemoved);
            this.globalUserCache.FriendAdded += new CbGeneric <GGUser>(globalUserCache_FriendAdded);

            this.globalUserCache.CurrentUser.UserStatus = (UserStatus)((int)userStatus);
            this.myStatus                   = this.globalUserCache.CurrentUser.UserStatus;
            this.labelSignature.Text        = this.globalUserCache.CurrentUser.Signature;
            this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser);
            this.labelName.Text             = this.globalUserCache.CurrentUser.Name;

            skinButton_State.Image       = stateImage;
            skinButton_State.Tag         = userStatus;
            this.skinLabel_softName.Text = GlobalResourceManager.SoftwareName;
            this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus)));

            this.MaximumSize = new Size(543, Screen.GetWorkingArea(this).Height);
            this.Size        = SystemSettings.Singleton.MainFormSize;
            this.Location    = SystemSettings.Singleton.MainFormLocation;//new Point(Screen.PrimaryScreen.Bounds.Width - this.Width - 20, 40);

            this.friendListBox1.Initialize(this.globalUserCache.CurrentUser, this, new UserInformationForm(new Point(this.Location.X - 284, this.friendListBox1.Location.Y)));
            this.groupListBox.Initialize(this.globalUserCache.CurrentUser, GlobalConsts.CompanyGroupID);
            this.recentListBox1.Initialize(this);

            if (!SystemSettings.Singleton.ShowLargeIcon)
            {
                this.friendListBox1.IconSizeMode  = ChatListItemIcon.Small;
                this.大头像ToolStripMenuItem.Checked = false;
                this.小头像ToolStripMenuItem.Checked = true;
            }

            //文件传送
            this.rapidPassiveEngine.FileOutter.FileRequestReceived  += new CbFileRequestReceived(fileOutter_FileRequestReceived);
            this.rapidPassiveEngine.FileOutter.FileResponseReceived += new CbGeneric <TransferingProject, bool>(fileOutter_FileResponseReceived);

            this.rapidPassiveEngine.ConnectionInterrupted      += new CbGeneric(rapidPassiveEngine_ConnectionInterrupted);            //预订断线事件
            this.rapidPassiveEngine.BasicOutter.BeingPushedOut += new CbGeneric(BasicOutter_BeingPushedOut);
            this.rapidPassiveEngine.RelogonCompleted           += new CbGeneric <LogonResponse>(rapidPassiveEngine_RelogonCompleted); //预订重连成功事件
            this.rapidPassiveEngine.MessageReceived            += new CbGeneric <string, int, byte[], string>(rapidPassiveEngine_MessageReceived);

            //群、组
            this.rapidPassiveEngine.ContactsOutter.BroadcastReceived += new CbGeneric <string, string, int, byte[], string>(ContactsOutter_BroadcastReceived);
            this.rapidPassiveEngine.ContactsOutter.ContactsOffline   += new CbGeneric <string>(ContactsOutter_ContactsOffline); //所有联系人的下线事件

            //网盘访问器 V2.0
            this.nDiskOutter = new NDiskOutter(this.rapidPassiveEngine.FileOutter, this.rapidPassiveEngine.CustomizeOutter);

            this.notifyIcon.UnhandleMessageOccured += new CbGeneric <UnhandleMessageType, string>(notifyIcon_UnhandleMessageOccured);
            this.notifyIcon.UnhandleMessageGone    += new CbGeneric <UnhandleMessageType, string>(notifyIcon_UnhandleMessageGone);
            this.notifyIcon.Initialize(this, this);
        }
Example #14
0
 public Image GetHeadImage(IUser user)
 {
     return(GlobalResourceManager.GetHeadImage((GGUser)user));
 }
Example #15
0
 public static Image GetHeadImage(GGUser user)
 {
     return(GlobalResourceManager.GetHeadImage(user, false));
 }
        private void AddUserItem(GGUser friend)
        {
            ChatListSubItem subItem = new ChatListSubItem(friend.UserID, friend.UserID, friend.Name, friend.Signature, GlobalResourceManager.ConvertUserStatus(friend.UserStatus), GlobalResourceManager.GetHeadImage(friend));

            subItem.Tag = friend;
            this.chatListBox1.Items[0].SubItems.AddAccordingToStatus(subItem);
        }
Example #17
0
 public Icon GetStatusIcon(UserStatus status)
 {
     return(GlobalResourceManager.GetStatusIcon(status));
 }
Example #18
0
 public void PlayAudioAsyn()
 {
     GlobalResourceManager.PlayAudioAsyn();
 }
Example #19
0
 public static void SetStatusImage(Dictionary <UserStatus, Image> _statusImageDictionary)
 {
     GlobalResourceManager.do_SetStatusImage(_statusImageDictionary);
 }