private CloseableTabItem FindChatTab()
        {
            INWindow         inWindow = this.dataService.INWindow as INWindow;
            CloseableTabItem result;

            if (inWindow != null)
            {
                ItemCollection ic = inWindow.ContentTab.Items;
                foreach (TabItem item in (System.Collections.IEnumerable)ic)
                {
                    if (item != null)
                    {
                        CloseableTabItem cti = item as CloseableTabItem;
                        if (cti != null)
                        {
                            TabItemHeaderControl tabHeader = cti.Header as TabItemHeaderControl;
                        }
                        PersonalChatTabControl pctc = item.Content as PersonalChatTabControl;
                        if (pctc != null && this.staff != null && pctc.StaffId == this.staff.Uid)
                        {
                            result = cti;
                            return(result);
                        }
                    }
                }
            }
            result = null;
            return(result);
        }
 public NewFileListItem(System.IO.FileInfo fileInfo, PersonalChatTabControl staffChatTab, Staff staff)
 {
     try
     {
         this.InitializeComponent();
         if (fileInfo != null && staffChatTab != null && staff != null)
         {
             this.fileInfo            = fileInfo;
             this.staffChatTab        = staffChatTab;
             this.staff               = staff;
             this.item                = new FileItem(fileInfo);
             this.item.FromUid        = this.sessionService.Uid;
             this.item.ToJid          = this.staff.Jid;
             this.item.ToUid          = this.staff.Uid;
             this.item.FileService    = this.fileService;
             this.item.ProcessEvent   = new ProcessEvent(this.ProcessEventHandle);
             this.item.EndEvent       = new EndEvent(this.EndEventHandle);
             this.item.ErrorEvent     = new ErrorEvent(this.ErrorEventHandle);
             this.item.StopEvent      = new StopEvent(this.StopEventHandle);
             this.progressBar.Maximum = (double)fileInfo.Length;
             this.imgIcon.Source      = this.IconToBitmap(Icon.ExtractAssociatedIcon(fileInfo.FullName));
             this.IconBase64          = this.IconToBase64(Icon.ExtractAssociatedIcon(fileInfo.FullName));
             this.item.IconBase64     = this.IconBase64;
             this.tbkFilename.Text    = fileInfo.Name.Trim();
             this.fileName            = fileInfo.Name.Trim();
             this.tbkMsg.Text         = "正在发送文件";
             this.tbkSize.Text        = this.GetLength(fileInfo.Length);
             this.ShowCancelButton();
         }
     }
     catch (System.Exception e)
     {
         this.logger.Error(e.ToString());
     }
 }
 public NewFileListItem(string fileName, string id, long size, PersonalChatTabControl staffChatTab, Staff staff, string iconBase64)
 {
     if (staffChatTab != null && staff != null)
     {
         this.InitializeComponent();
         this.staffChatTab        = staffChatTab;
         this.staff               = staff;
         this.item                = new FileItem(id, this.fileDir + fileName);
         this.item.FileService    = this.fileService;
         this.item.ProcessEvent   = new ProcessEvent(this.ProcessEventHandle);
         this.item.EndEvent       = new EndEvent(this.EndEventHandle);
         this.item.ErrorEvent     = new ErrorEvent(this.ErrorEventHandle);
         this.item.IconBase64     = iconBase64;
         this.IconBase64          = iconBase64;
         this.imgIcon.Source      = this.IconDecode(this.IconBase64);
         this.progressBar.Maximum = (double)size;
         this.tbkFilename.Text    = fileName;
         this.fileName            = fileName;
         this.tbkMsg.Text         = "收到文件请求";
         this.tbkSize.Text        = this.GetLength(size);
         this.ShowAcceptButton();
     }
 }
        private void StaffNewMessage(Message message)
        {
            EntStaffTab item = this.dataService.GetStaffChatTab((long)((ulong)Jid.GetUid(message.FromJid))) as EntStaffTab;

            if (item == null)
            {
                Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid)));
                if (staff != null)
                {
                    item = new EntStaffTab(staff);
                    item.SetDefaultStyle();
                    ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
                    this.dataService.AddStaffChatTab(staff.Uid, item);
                }
            }
            this.baseTab = item;
            PersonalChatTabControl tab = item.TabContent;

            if (tab != null)
            {
                tab.ChatComponent.AddMessageStaff(message, false);
                tab.ChatComponent.inputMsgBox.Focus();
            }
        }
        private bool PickUpMessageProcessor()
        {
            bool           hasSelected = false;
            TabItem        tempItem    = null;
            ItemCollection ic          = this.inWindow.ContentTab.Items;

            foreach (TabItem item in (System.Collections.IEnumerable)ic)
            {
                if (item != null)
                {
                    CloseableTabItem     cti       = item as CloseableTabItem;
                    TabItemHeaderControl tabHeader = null;
                    if (cti != null)
                    {
                        tabHeader = (cti.Header as TabItemHeaderControl);
                    }
                    PersonalChatTabControl  pctc = item.Content as PersonalChatTabControl;
                    GroupChatTabControl     gctc = item.Content as GroupChatTabControl;
                    FriendsChatTabControl   fctc = item.Content as FriendsChatTabControl;
                    CoopStaffChatTabControl coopStaffChatTabControl = item.Content as CoopStaffChatTabControl;
                    if (pctc != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(pctc.StaffId, MessageActorType.EntStaff);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowStaffNewMessage(pctc.StaffId, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasSelectedItem(MessageActorType.CooperationStaff, pctc.StaffId);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                    if (gctc != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(gctc.GroupId, MessageActorType.EntGroup);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowGroupNewMessage(gctc.GroupId, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasSelectedItem(MessageActorType.EntGroup, gctc.GroupId);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                    if (fctc != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(fctc.RosterId, MessageActorType.Roster);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowRosterNewMessage(fctc.RosterId, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasSelectedItem(MessageActorType.AddRoster, fctc.RosterId);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                    if (coopStaffChatTabControl != null)
                    {
                        System.Collections.Generic.List <Message> list = this.dataModel.GetCooperationStaffMessage(coopStaffChatTabControl.Uid, coopStaffChatTabControl.Projectid, MessageActorType.CooperationStaff);
                        if (list != null)
                        {
                            if (tabHeader != null)
                            {
                                tabHeader.SetFlashingStyle();
                            }
                            this.ShowCooperationStaffNewMessage(coopStaffChatTabControl.Uid, coopStaffChatTabControl.Projectid, list);
                        }
                        if (!hasSelected)
                        {
                            hasSelected = this.HasCoopeationSelectedItem(MessageActorType.CooperationStaff, coopStaffChatTabControl.Projectid);
                            if (hasSelected)
                            {
                                tempItem = item;
                            }
                        }
                    }
                }
            }
            if (tempItem != null)
            {
                this.baseTab = (tempItem as BaseTab);
            }
            return(hasSelected);
        }
示例#6
0
 private void StaffMessageCacheProcessor(OfflineFileResponse response, PersonalChatTabControl tab)
 {
     System.Collections.Generic.List<Message> list = this.dataModel.GetMessage(response.fromUid, MessageActorType.EntStaff);
     if (list != null)
     {
         foreach (Message message in list)
         {
             tab.ChatComponent.AddMessageStaff(message, false);
         }
     }
     DataModel.Instance.RemoveMessage(response.fromUid, MessageActorType.EntStaff);
     MessageBoxWindow box = this.dataModel.GetMessageBox();
     if (box != null)
     {
         box.Refresh();
     }
 }
 public NewFileListItem(string fileName, string id, long size, PersonalChatTabControl staffChatTab, Staff staff, string iconBase64)
 {
     if (staffChatTab != null && staff != null)
     {
         this.InitializeComponent();
         this.staffChatTab = staffChatTab;
         this.staff = staff;
         this.item = new FileItem(id, this.fileDir + fileName);
         this.item.FileService = this.fileService;
         this.item.ProcessEvent = new ProcessEvent(this.ProcessEventHandle);
         this.item.EndEvent = new EndEvent(this.EndEventHandle);
         this.item.ErrorEvent = new ErrorEvent(this.ErrorEventHandle);
         this.item.IconBase64 = iconBase64;
         this.IconBase64 = iconBase64;
         this.imgIcon.Source = this.IconDecode(this.IconBase64);
         this.progressBar.Maximum = (double)size;
         this.tbkFilename.Text = fileName;
         this.fileName = fileName;
         this.tbkMsg.Text = "收到文件请求";
         this.tbkSize.Text = this.GetLength(size);
         this.ShowAcceptButton();
     }
 }
 public NewFileListItem(System.IO.FileInfo fileInfo, PersonalChatTabControl staffChatTab, Staff staff)
 {
     try
     {
         this.InitializeComponent();
         if (fileInfo != null && staffChatTab != null && staff != null)
         {
             this.fileInfo = fileInfo;
             this.staffChatTab = staffChatTab;
             this.staff = staff;
             this.item = new FileItem(fileInfo);
             this.item.FromUid = this.sessionService.Uid;
             this.item.ToJid = this.staff.Jid;
             this.item.ToUid = this.staff.Uid;
             this.item.FileService = this.fileService;
             this.item.ProcessEvent = new ProcessEvent(this.ProcessEventHandle);
             this.item.EndEvent = new EndEvent(this.EndEventHandle);
             this.item.ErrorEvent = new ErrorEvent(this.ErrorEventHandle);
             this.item.StopEvent = new StopEvent(this.StopEventHandle);
             this.progressBar.Maximum = (double)fileInfo.Length;
             this.imgIcon.Source = this.IconToBitmap(Icon.ExtractAssociatedIcon(fileInfo.FullName));
             this.IconBase64 = this.IconToBase64(Icon.ExtractAssociatedIcon(fileInfo.FullName));
             this.item.IconBase64 = this.IconBase64;
             this.tbkFilename.Text = fileInfo.Name.Trim();
             this.fileName = fileInfo.Name.Trim();
             this.tbkMsg.Text = "正在发送文件";
             this.tbkSize.Text = this.GetLength(fileInfo.Length);
             this.ShowCancelButton();
         }
     }
     catch (System.Exception e)
     {
         this.logger.Error(e.ToString());
     }
 }