コード例 #1
0
 public NewFileListItem(System.IO.FileInfo fileInfo, GroupChatTabControl groupChatTab, EntGroup group)
 {
     try
     {
         this.InitializeComponent();
         if (fileInfo != null && groupChatTab != null && group != null)
         {
             this.fileInfo = fileInfo;
             this.groupChatTab = groupChatTab;
             this.group = group;
             this.item = new FileItem(fileInfo);
             this.item.FromUid = this.sessionService.Uid;
             this.item.Gid = this.group.Gid;
             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)
     {
         ServiceUtil.Instance.Logger.Error(e.ToString());
     }
 }
コード例 #2
0
 public NewFileListItem(System.IO.FileInfo fileInfo, GroupChatTabControl groupChatTab, EntGroup group)
 {
     try
     {
         this.InitializeComponent();
         if (fileInfo != null && groupChatTab != null && group != null)
         {
             this.fileInfo            = fileInfo;
             this.groupChatTab        = groupChatTab;
             this.group               = group;
             this.item                = new FileItem(fileInfo);
             this.item.FromUid        = this.sessionService.Uid;
             this.item.Gid            = this.group.Gid;
             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)
     {
         ServiceUtil.Instance.Logger.Error(e.ToString());
     }
 }
コード例 #3
0
 private void WatchShieldMessage(GroupChatTabControl chatTab)
 {
     if (chatTab != null && this.messageCache != null && this.messageCache.Count > 0)
     {
         foreach (Message message in this.messageCache)
         {
             if (message != null)
             {
                 chatTab.ChatComponent.AddMessageGroup(message, false);
             }
         }
         this.ClearMessageCache();
     }
 }
コード例 #4
0
 private void WatchMessage(GroupChatTabControl chatTab)
 {
     System.Collections.Generic.List <Message> list = DataModel.Instance.GetMessage(this.group.Gid, MessageActorType.EntGroup);
     if (list != null)
     {
         foreach (Message message in list)
         {
             if (message != null)
             {
                 chatTab.ChatComponent.AddMessageGroup(message, false);
             }
         }
         DataModel.Instance.RemoveMessage(this.group.Gid, MessageActorType.EntGroup);
         MessageBoxWindow mbw = DataModel.Instance.GetMessageBox();
         if (mbw != null)
         {
             mbw.Refresh();
         }
         this.FlashIconPorcessor();
     }
 }
コード例 #5
0
 private void MouseDoubleClickHandler(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (WindowModel.Instance.IsOpenMessageCenterWindow())
         {
         }
         if (e.LeftButton == MouseButtonState.Pressed)
         {
             EntGroupTab item = this.dataService.GetEntGroupChatTab(this.group.Gid) as EntGroupTab;
             if (item != null)
             {
                 ((INWindow)this.dataService.INWindow).ContentTab.SelectedItem = item;
                 GroupChatTabControl chat = item.TabContent;
                 if (chat != null)
                 {
                     this.WatchMessage(chat);
                     this.WatchShieldMessage(chat);
                     this.UpdateShieldCount();
                 }
             }
             else
             {
                 item = new EntGroupTab(this.group);
                 item.SetDefaultStyle();
                 ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
                 this.dataService.AddEntGroupChatTab(this.group.Gid, item);
                 ((INWindow)this.dataService.INWindow).ContentTab.SelectedItem = item;
                 this.WatchMessage(item.TabContent);
                 this.WatchShieldMessage(item.TabContent);
                 this.UpdateShieldCount();
             }
         }
     }
     catch (System.Exception ex)
     {
         this.logger.Error(ex.ToString());
     }
 }
コード例 #6
0
        private void GroupNewMessage(Message message)
        {
            EntGroupTab item = this.dataService.GetEntGroupChatTab(message.Gid) as EntGroupTab;

            if (item == null)
            {
                EntGroup group = this.dataService.GetEntGroup(message.Gid);
                if (group != null)
                {
                    item = new EntGroupTab(group);
                    item.SetDefaultStyle();
                    ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
                    this.dataService.AddEntGroupChatTab(group.Gid, item);
                }
            }
            this.baseTab = item;
            GroupChatTabControl tab = item.TabContent;

            if (tab != null)
            {
                tab.ChatComponent.AddMessageGroup(message, false);
                tab.ChatComponent.inputMsgBox.Focus();
            }
        }
コード例 #7
0
 public NewFileListItem(string fileName, string id, long size, GroupChatTabControl groupChatTab, EntGroup group, string iconBase64, string userName)
 {
     if (groupChatTab != null && group != null)
     {
         this.InitializeComponent();
         this.groupChatTab        = groupChatTab;
         this.group               = group;
         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.userName            = userName;
         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.userName + "】的文件请求";
         this.tbkSize.Text        = this.GetLength(size);
         this.ShowAcceptButton();
     }
 }
コード例 #8
0
        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);
        }
コード例 #9
0
 private void GroupMessageCacheProcessor(GroupFileUploadResponse response, GroupChatTabControl tab)
 {
     System.Collections.Generic.List<Message> list = this.dataModel.GetMessage(response.gid, MessageActorType.EntGroup);
     if (list != null)
     {
         foreach (Message message in list)
         {
             tab.ChatComponent.AddMessageGroup(message, false);
         }
     }
     this.dataModel.RemoveMessage(response.gid, MessageActorType.EntGroup);
     MessageBoxWindow box = this.dataModel.GetMessageBox();
     if (box != null)
     {
         box.Refresh();
     }
 }
コード例 #10
0
 private void WatchShieldMessage(GroupChatTabControl chatTab)
 {
     if (chatTab != null && this.messageCache != null && this.messageCache.Count > 0)
     {
         foreach (Message message in this.messageCache)
         {
             if (message != null)
             {
                 chatTab.ChatComponent.AddMessageGroup(message, false);
             }
         }
         this.ClearMessageCache();
     }
 }
コード例 #11
0
 private void WatchMessage(GroupChatTabControl chatTab)
 {
     System.Collections.Generic.List<Message> list = DataModel.Instance.GetMessage(this.group.Gid, MessageActorType.EntGroup);
     if (list != null)
     {
         foreach (Message message in list)
         {
             if (message != null)
             {
                 chatTab.ChatComponent.AddMessageGroup(message, false);
             }
         }
         DataModel.Instance.RemoveMessage(this.group.Gid, MessageActorType.EntGroup);
         MessageBoxWindow mbw = DataModel.Instance.GetMessageBox();
         if (mbw != null)
         {
             mbw.Refresh();
         }
         this.FlashIconPorcessor();
     }
 }
コード例 #12
0
 public NewFileListItem(string fileName, string id, long size, GroupChatTabControl groupChatTab, EntGroup group, string iconBase64, string userName)
 {
     if (groupChatTab != null && group != null)
     {
         this.InitializeComponent();
         this.groupChatTab = groupChatTab;
         this.group = group;
         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.userName = userName;
         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.userName + "】的文件请求";
         this.tbkSize.Text = this.GetLength(size);
         this.ShowAcceptButton();
     }
 }