//internal RowDefinition GroupDescriptionRow;
 //internal RowDefinition SearchRow;
 //internal RowDefinition GroupMemberListRow;
 //internal StatusBar GroupDescriptionBar;
 //internal TextBox groupDescription;
 //internal StatusBar GroupMemberListBar;
 //internal TextBlock tbkGroupCount;
 //internal IconButton btnSearch;
 //internal TextBox tbxSearch;
 //internal GroupMemberListView GroupMemberList;
 ////private bool _contentLoaded;
 public GroupMemberControl(EntGroup group)
 {
     try
     {
         this.InitializeComponent();
         if (group != null)
         {
             this.group = group;
             this.groupDescription.Text = group.Description;
             this.GroupMemberList.Gid = this.group.Gid;
             if (group.Member != null)
             {
                 long[] member = group.Member;
                 for (int i = 0; i < member.Length; i++)
                 {
                     uint uid = (uint)member[i];
                     this.GroupMemberList.AddGroupMember(this.dataService.GetStaff((long)((ulong)uid)));
                 }
                 this.GroupMemberList.SortGroupMember();
             }
         }
     }
     catch (System.Exception)
     {
     }
 }
 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
 public void AddGroupList(System.Collections.Generic.List <GetIsMark> getIsMark)
 {
     try
     {
         this.GroupName.Items.Clear();
         this.GroupNode.Clear();
         for (int i = 0; i < getIsMark.Count; i++)
         {
             foreach (EntGroup gp in this.groups)
             {
                 if (gp.Gid == getIsMark[i].id)
                 {
                     this.group = gp;
                     break;
                 }
             }
             if (this.group != null)
             {
                 if (!this.GroupNode.ContainsKey(this.group.Gid))
                 {
                     MsgCenterTreeNode node = new MsgCenterTreeNode(this.group, true);
                     node.SessionService = this.sessionService;
                     node.DataService    = this.dataService;
                     this.GroupNode.Add(this.group.Gid, node);
                     this.GroupName.Items.Add(node);
                 }
             }
             this.group = null;
         }
     }
     catch (System.Exception ex)
     {
         this.logger.Error(ex.ToString());
     }
 }
 public EntGroupManagerWindow(EntGroup group)
 {
     if (group != null)
     {
         ThemeSwitcher.LoadSkin(ThemeEnum.Aero, this);
         this.InitializeComponent();
         this.group = group;
         this.txtName.Text = group.Name;
         this.txtDescription.Text = group.Description;
         long[] memebers = this.group.Member;
         if (memebers != null && memebers.Length > 0)
         {
             long[] array = memebers;
             for (int i = 0; i < array.Length; i++)
             {
                 long member = array[i];
                 Staff staff = this.dataService.GetStaff(member);
                 if (staff != null)
                 {
                     this.AddListMemberItem(staff);
                 }
             }
         }
         this.InitData();
     }
     base.Closed += new System.EventHandler(this.EntGroupManagerWindow_Closed);
 }
Пример #5
0
        public void AddAdmin(long uid)
        {
            GroupNodeStaff gns = this.FindListItem(uid);

            if (gns != null)
            {
                gns.AddAdminImage();
                EntGroup group = this.dataService.GetEntGroup(this.gid);
                if (group != null && group.IsAdmin(this.sessionService.Uid))
                {
                    gns.DeleAdminContextMenu();
                }
                if (uid == this.sessionService.Uid)
                {
                    foreach (GroupNodeStaff gnstaff in (System.Collections.IEnumerable) this.GroupMemberList.Items)
                    {
                        if (gnstaff.Staff.Uid == this.sessionService.Uid)
                        {
                            gnstaff.ClearAdminContextMenu();
                        }
                        else
                        {
                            if (group.IsAdmin(gnstaff.Staff.Uid))
                            {
                                gnstaff.DeleAdminContextMenu();
                            }
                            else
                            {
                                gnstaff.AddAdminContextMenu();
                            }
                        }
                    }
                }
            }
        }
        private bool InitGroupInfo(MessageCenterChatInfo info)
        {
            bool result;

            if (info.Type == MessageCenterType.EntGroup)
            {
                EntGroup group = this.dataService.GetEntGroup(info.Id);
                if (group != null)
                {
                    this.tbkID.Text     = info.Id.ToString();
                    this.tbkName.Text   = group.Name;
                    this.tbkDate.Text   = info.LastTime;
                    this.imgHead.Source = group.AdminIcon;
                    this.gp             = group;
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
Пример #7
0
 public EntGroupManagerWindow(EntGroup group)
 {
     if (group != null)
     {
         ThemeSwitcher.LoadSkin(ThemeEnum.Aero, this);
         this.InitializeComponent();
         this.group               = group;
         this.txtName.Text        = group.Name;
         this.txtDescription.Text = group.Description;
         long[] memebers = this.group.Member;
         if (memebers != null && memebers.Length > 0)
         {
             long[] array = memebers;
             for (int i = 0; i < array.Length; i++)
             {
                 long  member = array[i];
                 Staff staff  = this.dataService.GetStaff(member);
                 if (staff != null)
                 {
                     this.AddListMemberItem(staff);
                 }
             }
         }
         this.InitData();
     }
     base.Closed += new System.EventHandler(this.EntGroupManagerWindow_Closed);
 }
        public void MessageCenterRecordGroup(Message[] messages, EntGroup group, int total)
        {
            bool color = true;

            this.TotalRecord = total;
            this.trgMessageTable.Rows.Clear();
            int i;

            for (i = messages.Length - 1; i >= 0; i--)
            {
                if (messages[i].MessageBlocks != null && messages[i].MessageBlocks.Length != 0)
                {
                    MsgRecordItem row = new MsgRecordItem(messages[i], group);
                    if (color)
                    {
                        row.Background = new SolidColorBrush(Color.FromRgb(241, 250, 255));
                        color          = false;
                    }
                    else
                    {
                        row.Background = new SolidColorBrush(Color.FromRgb(221, 253, 214));
                        color          = true;
                    }
                    WindowModel.Instance.MsgRecordPage.trgMessageTable.Rows.Add(row);
                }
            }
            this.SetRecordPageParam();
            this.InitTitleName("在" + group.Name + "的消息记录");
            string st = messages[i + 1].CreateTime.Substring(0, 10);

            this.DateSelect.Text = st;
        }
 public void AddGroupList(System.Collections.Generic.List<GetIsMark> getIsMark)
 {
     try
     {
         this.GroupName.Items.Clear();
         this.GroupNode.Clear();
         for (int i = 0; i < getIsMark.Count; i++)
         {
             foreach (EntGroup gp in this.groups)
             {
                 if (gp.Gid == getIsMark[i].id)
                 {
                     this.group = gp;
                     break;
                 }
             }
             if (this.group != null)
             {
                 if (!this.GroupNode.ContainsKey(this.group.Gid))
                 {
                     MsgCenterTreeNode node = new MsgCenterTreeNode(this.group, true);
                     node.SessionService = this.sessionService;
                     node.DataService = this.dataService;
                     this.GroupNode.Add(this.group.Gid, node);
                     this.GroupName.Items.Add(node);
                 }
             }
             this.group = null;
         }
     }
     catch (System.Exception ex)
     {
         this.logger.Error(ex.ToString());
     }
 }
 //internal RowDefinition GroupDescriptionRow;
 //internal RowDefinition SearchRow;
 //internal RowDefinition GroupMemberListRow;
 //internal StatusBar GroupDescriptionBar;
 //internal TextBox groupDescription;
 //internal StatusBar GroupMemberListBar;
 //internal TextBlock tbkGroupCount;
 //internal IconButton btnSearch;
 //internal TextBox tbxSearch;
 //internal GroupMemberListView GroupMemberList;
 ////private bool _contentLoaded;
 public GroupMemberControl(EntGroup group)
 {
     try
     {
         this.InitializeComponent();
         if (group != null)
         {
             this.group = group;
             this.groupDescription.Text = group.Description;
             this.GroupMemberList.Gid   = this.group.Gid;
             if (group.Member != null)
             {
                 long[] member = group.Member;
                 for (int i = 0; i < member.Length; i++)
                 {
                     uint uid = (uint)member[i];
                     this.GroupMemberList.AddGroupMember(this.dataService.GetStaff((long)((ulong)uid)));
                 }
                 this.GroupMemberList.SortGroupMember();
             }
         }
     }
     catch (System.Exception)
     {
     }
 }
 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());
     }
 }
Пример #12
0
 public ItemGroup(EntGroup group)
 {
     this.InitializeComponent();
     this.group = group;
     this.AddEventListenerHandler();
     this.InitService();
     this.InitData();
 }
Пример #13
0
 public ItemGroup(EntGroup group)
 {
     this.InitializeComponent();
     this.group = group;
     this.AddEventListenerHandler();
     this.InitService();
     this.InitData();
 }
 public MsgCenterTreeNode(EntGroup gp, bool isMark)
 {
     this.viewModel.AddEventListenerHandler();
     this.InitializeComponent();
     this.group = gp;
     this.GroupIsMark = isMark;
     base.MouseLeftButtonUp += new MouseButtonEventHandler(this.GroupMsgCenterTreeNode_MouseLeftButtonUp);
     this.UpdateInfoGroup();
 }
Пример #15
0
        public void AddAdminImage()
        {
            EntGroup entGroup = this.dataService.GetEntGroup(this.gid);

            if (entGroup != null)
            {
                this.imgFaceManager.Source = entGroup.AdminIcon;
            }
        }
Пример #16
0
        private void DeleAdmin_Click(object sender, RoutedEventArgs e)
        {
            EntGroup group = this.dataService.GetEntGroup(this.gid);

            if (group != null)
            {
                this.viewModel.AdminRemove(this.gid, this.staff.Uid + ":");
            }
        }
 public MsgCenterTreeNode(EntGroup gp, bool isMark)
 {
     this.viewModel.AddEventListenerHandler();
     this.InitializeComponent();
     this.group              = gp;
     this.GroupIsMark        = isMark;
     base.MouseLeftButtonUp += new MouseButtonEventHandler(this.GroupMsgCenterTreeNode_MouseLeftButtonUp);
     this.UpdateInfoGroup();
 }
 public void UpdateGroupInfo(EntGroup group)
 {
     if (group != null)
     {
         ItemGroup ig = this.FindItemGroup(group);
         if (ig != null)
         {
             ig.ChangeGroupName(group.Name, true);
         }
     }
 }
        private void ViewMoreRecord(object sender, MouseButtonEventArgs e)
        {
            Staff    staff = this.dataService.GetStaff(this.id);
            EntGroup group = this.dataService.GetEntGroup(this.id);

            if (staff != null && this.type == MessageActorType.EntStaff)
            {
                if (!WindowModel.Instance.IsOpenMessageCenterWindow())
                {
                    WindowModel.Instance.MessageCenterWindow.Show();
                    WindowModel.Instance.MessageCenterWindow.Topmost = true;
                }
                else
                {
                    WindowModel.Instance.MessageCenterWindow.work.IsExpanded = true;
                    if (WindowModel.Instance.MessageCenterWindow.WindowState == WindowState.Minimized)
                    {
                        WindowModel.Instance.MessageCenterWindow.WindowState = WindowState.Normal;
                    }
                    WindowModel.Instance.MessageCenterWindow.Topmost = true;
                }
                WindowModel.Instance.MessageCenterWindow.workTreeView.NodeExpand(staff.Uid, true);
                this.viewModel.SendStaffMessageRecord(this.sessionService.Uid, staff.Uid, "0", 1, 10, MessageRecordType.MESSAGE_CENTER_RECORD);
                WindowModel.Instance.MsgRecordPage.InitData(staff.Uid, false, true, 0);
                WindowModel.Instance.MsgRecordPage.InitTitleName("与" + staff.Name + "消息记录");
                WindowModel.Instance.MessageCenterWindow.ViewMsgFrame.NavigationService.Navigate(WindowModel.Instance.MsgRecordPage);
            }
            else
            {
                if (group != null)
                {
                    if (!WindowModel.Instance.IsOpenMessageCenterWindow())
                    {
                        WindowModel.Instance.MessageCenterWindow.Show();
                        WindowModel.Instance.MessageCenterWindow.Topmost = true;
                    }
                    else
                    {
                        WindowModel.Instance.MessageCenterWindow.work.IsExpanded = true;
                        if (WindowModel.Instance.MessageCenterWindow.WindowState == WindowState.Minimized)
                        {
                            WindowModel.Instance.MessageCenterWindow.WindowState = WindowState.Normal;
                        }
                        WindowModel.Instance.MessageCenterWindow.Topmost = true;
                    }
                    WindowModel.Instance.MessageCenterWindow.workTreeView.NodeExpand(group.Gid, false);
                    this.viewModel.SendGroupMessageRecord(group.Gid, "0", 1, 10, this.sessionService.Uid, MessageRecordType.MESSAGE_CENTER_RECORD);
                    WindowModel.Instance.MsgRecordPage.InitData(group.Gid, false, false, 0);
                    WindowModel.Instance.MsgRecordPage.InitTitleName("与" + group.Name + "群消息记录");
                    WindowModel.Instance.MessageCenterWindow.ViewMsgFrame.NavigationService.Navigate(WindowModel.Instance.MsgRecordPage);
                }
            }
        }
 public GroupChatTabControl(EntGroup group)
 {
     this.InitializeComponent();
     this.ChatComponent.InitData(group);
     this.ChatComponent.MsgRecordStatus = new ChatComponent.MsgRecordStatusDelegate(this.MsgRecordStatusHandle);
     this.ChatComponent.viewMsgBox.PreviewDragEnter += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.viewMsgBox.PreviewDragOver += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.viewMsgBox.PreviewDrop += new System.Windows.DragEventHandler(this.UserControl_Drop);
     this.ChatComponent.inputMsgBox.PreviewDragEnter += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.inputMsgBox.PreviewDragOver += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.inputMsgBox.PreviewDrop += new System.Windows.DragEventHandler(this.UserControl_Drop);
     this.group = group;
     this.InitUI();
 }
Пример #21
0
 public GroupChatTabControl(EntGroup group)
 {
     this.InitializeComponent();
     this.ChatComponent.InitData(group);
     this.ChatComponent.MsgRecordStatus               = new ChatComponent.MsgRecordStatusDelegate(this.MsgRecordStatusHandle);
     this.ChatComponent.viewMsgBox.PreviewDragEnter  += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.viewMsgBox.PreviewDragOver   += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.viewMsgBox.PreviewDrop       += new System.Windows.DragEventHandler(this.UserControl_Drop);
     this.ChatComponent.inputMsgBox.PreviewDragEnter += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.inputMsgBox.PreviewDragOver  += new System.Windows.DragEventHandler(this.TextBox_PreviewDragEnter);
     this.ChatComponent.inputMsgBox.PreviewDrop      += new System.Windows.DragEventHandler(this.UserControl_Drop);
     this.group = group;
     this.InitUI();
 }
        public ItemGroup FindItemGroup(EntGroup group)
        {
            ItemGroup result;

            foreach (ItemGroup ig in (System.Collections.IEnumerable) this.listEntGroup.Items)
            {
                if (ig.Gid == group.Gid)
                {
                    result = ig;
                    return(result);
                }
            }
            result = null;
            return(result);
        }
 private void DataSelect_SelectedDateChanged(object sender, System.EventArgs e)
 {
     if (this.DataSelect.IsDropDownOpen && this.DataSelect.IsInitialized)
     {
         this.InitUI();
         this.Clear();
         System.DateTime dt     = this.DataSelect.SelectedDate.Value;
         string          format = "yyyy-MM-dd";
         string          time   = dt.ToString(format, System.Globalization.DateTimeFormatInfo.InvariantInfo);
         System.Globalization.DateTimeFormatInfo info  = new System.Globalization.DateTimeFormatInfo();
         System.Globalization.DateTimeStyles     style = System.Globalization.DateTimeStyles.None;
         this.DataSelect.SelectedDate = new System.DateTime?(System.DateTime.Parse(time, info, style));
         this.Starttime = time + " 00:00:00";
         this.endtime   = time + " 24:00:00";
         if (this.type == MessageActorType.EntStaff)
         {
             Staff staff = this.dataService.GetStaff(this.id);
             if (staff != null)
             {
                 this.viewModel.SendStaffDataSearchMessage(this.sessionService.Uid, staff.Uid, this.Starttime, 0, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                 this.sessionService.IsDateSearch = true;
             }
         }
         else
         {
             if (this.type == MessageActorType.CooperationStaff)
             {
                 if (this.coopStaff != null)
                 {
                     this.viewModel.SendCooperationMessageRecordRequestByDate(this.sessionService.Uid, this.coopStaff.Uid, this.coopStaff.ProjectId, this.Starttime, this.page, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                 }
             }
             else
             {
                 EntGroup group = this.dataService.GetEntGroup(this.id);
                 if (group != null)
                 {
                     this.viewModel.SendGroupSearchRecord(this.sessionService.Uid, this.id, this.Starttime, 0, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                     this.sessionService.IsDateSearch = true;
                 }
             }
         }
         this.InitPage();
         this.DataSelect.Text           = this.endtime;
         this.DataSelect.IsDropDownOpen = false;
     }
 }
        private bool GroupInfo(GetIsMark mark)
        {
            EntGroup group = this.dataService.GetEntGroup(mark.id);
            bool     result;

            if (group != null)
            {
                this.imgHead.Source = group.AdminIcon;
                this.tbkName.Text   = group.Name;
                this.tbkDate.Text   = mark.updateTime;
                this.tbkID.Text     = group.Gid.ToString();
                this.entgroup       = group;
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Пример #25
0
 public GroupNodeStaff(long gid, Staff staff)
 {
     try
     {
         this.InitializeComponent();
         if (staff != null)
         {
             this.gid                = gid;
             this.staff              = staff;
             this.tbkName.Text       = this.GetName(staff);
             this.imgFace.Background = new ImageBrush
             {
                 ImageSource = staff.HeaderImage
             };
             this.imgFace_foreground.Source = staff.StatusIcon;
             EntGroup entGroup = this.dataService.GetEntGroup(gid);
             if (entGroup != null)
             {
                 if (entGroup.IsAdmin(staff.Uid))
                 {
                     this.imgFaceManager.Source = entGroup.AdminIcon;
                 }
                 if (staff.Uid != this.sessionService.Uid && entGroup.IsAdmin(this.sessionService.Uid))
                 {
                     if (!entGroup.IsAdmin(staff.Uid))
                     {
                         this.AddAdminContextMenu();
                     }
                     else
                     {
                         this.DeleAdminContextMenu();
                     }
                 }
             }
         }
     }
     catch (System.Exception e)
     {
         ServiceUtil.Instance.Logger.Error(e.ToString());
     }
 }
 public void DeleEntGroup(EntGroup group)
 {
     try
     {
         if (group != null)
         {
             ItemGroup ig = this.FindItemGroup(group);
             if (ig != null)
             {
                 this.listEntGroup.Items.Remove(ig);
             }
         }
     }
     catch (System.Exception ex)
     {
         if (this.logger != null)
         {
             this.logger.Error(ex);
         }
     }
 }
 public void AddEntGroup(EntGroup group)
 {
     try
     {
         if (group != null)
         {
             if (null == this.FindItemGroup(group))
             {
                 ItemGroup ig = new ItemGroup(group);
                 this.listEntGroup.Items.Add(ig);
             }
         }
     }
     catch (System.Exception ex)
     {
         if (this.logger != null)
         {
             this.logger.Error(ex);
         }
     }
 }
 public void DeleEntGroup(EntGroup group)
 {
     try
     {
         if (group != null)
         {
             ItemGroup ig = this.FindItemGroup(group);
             if (ig != null)
             {
                 this.listEntGroup.Items.Remove(ig);
             }
         }
     }
     catch (System.Exception ex)
     {
         if (this.logger != null)
         {
             this.logger.Error(ex);
         }
     }
 }
 public void AddEntGroup(EntGroup group)
 {
     try
     {
         if (group != null)
         {
             if (null == this.FindItemGroup(group))
             {
                 ItemGroup ig = new ItemGroup(group);
                 this.listEntGroup.Items.Add(ig);
             }
         }
     }
     catch (System.Exception ex)
     {
         if (this.logger != null)
         {
             this.logger.Error(ex);
         }
     }
 }
Пример #30
0
        public void CreateOrAtcivateEntGroupManagerWindow(EntGroup entGroup, OperationType type)
        {
            long gid;

            if (entGroup == null)
            {
                gid = -1L;
            }
            else
            {
                gid = entGroup.Gid;
            }
            if (this.entGroupManagerWindows.ContainsKey(gid))
            {
                EntGroupManagerWindow temEntGroupManagerWindow = this.entGroupManagerWindows[gid];
                temEntGroupManagerWindow.Activate();
            }
            else
            {
                if (type == OperationType.Add)
                {
                    EntGroupManagerWindow temEntGroupManagerWindow = new EntGroupManagerWindow();
                    this.entGroupManagerWindows.Add(gid, temEntGroupManagerWindow);
                    temEntGroupManagerWindow.Show();
                }
                else
                {
                    if (type == OperationType.Modify)
                    {
                        if (entGroup == null)
                        {
                            throw new System.InvalidOperationException("操作类型为Modify时,参数不可为空!");
                        }
                        EntGroupManagerWindow temEntGroupManagerWindow = new EntGroupManagerWindow(entGroup);
                        this.entGroupManagerWindows.Add(gid, temEntGroupManagerWindow);
                        temEntGroupManagerWindow.Show();
                    }
                }
            }
        }
Пример #31
0
 public EntGroupTab(EntGroup group)
 {
     if (group != null)
     {
         this.InitializeComponent();
         this.group = group;
         this.TabHeader.Label = group.Name;
         this.TabHeader.imgIcon.Source = this.imageService.GetIcon(ImageTypeIcon.Group);
         base.Tag = new MenuItem
         {
             Icon = new Image
             {
                 Width = 16.0,
                 Height = 16.0,
                 Source = this.imageService.GetIcon(ImageTypeIcon.Group)
             },
             Header = group.Name
         };
         this.TabContent = new GroupChatTabControl(group);
         base.SetFocus2DesktopButton();
         this.AddEventListenerHandler();
     }
 }
        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();
            }
        }
 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();
     }
 }
Пример #34
0
 public void InitData(EntGroup group)
 {
     this.group = group;
     this.InitService();
 }
 public void PickUpMessage()
 {
     try
     {
         if (!this.PickUpMessageProcessor())
         {
             if (this.messageType == MessageActorType.EntStaff)
             {
                 Staff staff = this.dataService.GetStaff(this.id);
                 if (staff != null)
                 {
                     System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(this.id, MessageActorType.EntStaff);
                     this.ShowStaffNewMessage(this.id, list);
                 }
             }
             if (this.messageType == MessageActorType.EntGroup)
             {
                 EntGroup group = this.dataService.GetEntGroup(this.id);
                 if (group != null)
                 {
                     System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(this.id, MessageActorType.EntGroup);
                     this.ShowGroupNewMessage(this.id, list);
                 }
             }
             if (this.messageType == MessageActorType.Roster)
             {
                 Roster roster = this.dataService.GetRoster(this.id);
                 if (roster != null)
                 {
                     System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(this.id, MessageActorType.Roster);
                     this.ShowRosterNewMessage(this.id, list);
                 }
             }
             if (this.messageType == MessageActorType.AddRoster)
             {
                 System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(this.id, MessageActorType.AddRoster);
                 if (list != null && list.Count > 0)
                 {
                     this.ShowAddRosterNewMessage(this.id, list);
                 }
             }
             if (this.messageType == MessageActorType.AddRosterAsk)
             {
                 System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(this.id, MessageActorType.AddRosterAsk);
                 if (list != null && list.Count > 0)
                 {
                     this.ShowAddRosterAskNewMessage(this.id, list);
                 }
             }
             if (this.messageType == MessageActorType.CooperationStaff)
             {
                 System.Collections.Generic.List <Message> list = this.dataModel.GetCooperationStaffMessage(this.id, this.projectid, MessageActorType.CooperationStaff);
                 if (list != null && list.Count > 0)
                 {
                     this.ShowCooperationStaffNewMessage(this.id, this.projectid, list);
                 }
             }
         }
         this.FlashIconPorcessor();
         MessageBoxWindow mbw = this.dataModel.GetMessageBox();
         if (mbw != null)
         {
             mbw.Refresh();
         }
         this.ActiveInWindow();
     }
     catch (System.Exception ex)
     {
         this.logger.Error(ex.ToString());
     }
 }
Пример #36
0
 public void Refresh()
 {
     try
     {
         this.lbMessageBox.Items.Clear();
         if (!this.dataModel.HasMessage())
         {
             NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.Default);
             base.Close();
         }
         foreach (string key in this.dataModel.MessageBoxSort)
         {
             if (!string.IsNullOrEmpty(key))
             {
                 System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(key);
                 if (list != null && list.Count > 0)
                 {
                     Message message = list[0];
                     if (message != null)
                     {
                         if (message.MessageObjectType == MessageActorType.EntStaff)
                         {
                             Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid)));
                             if (staff != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.EntStaff, staff.Uid, staff.Name, list.Count.ToString(), staff.HeaderImage);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.EntGroup)
                         {
                             EntGroup group = this.dataService.GetEntGroup(message.Gid);
                             if (group != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.EntGroup, group.Gid, group.Name, list.Count.ToString(), this.imageService.GetIcon(ImageTypeIcon.Group));
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.Roster)
                         {
                             Roster roster = this.dataService.GetRoster((long)((ulong)Jid.GetUid(message.FromJid)));
                             if (roster != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.Roster, roster.Uid, roster.Name, list.Count.ToString(), roster.HeaderImage);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.AddRoster)
                         {
                             RosterAddRequest request = message.MessageObject as RosterAddRequest;
                             if (request != null && request.user != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.AddRoster, request.uid, "验证消息", list.Count.ToString(), null);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.AddRosterAsk)
                         {
                             RosterAddResponse response = message.MessageObject as RosterAddResponse;
                             if (response != null && response.user != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.AddRosterAsk, response.uid, "验证消息", list.Count.ToString(), null);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.CooperationStaff)
                         {
                             CooperationStaff staff2 = this.dataService.GetCooperationStaff((long)((ulong)Jid.GetUid(message.FromJid)), message.ProjectId);
                             if (staff2 != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.CooperationStaff, staff2.Uid, staff2.UnitedProjectid, staff2.Name, list.Count.ToString(), staff2.HeaderImage);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                     }
                 }
             }
         }
         base.Top = SystemParameters.WorkArea.Height - 47.0 - (double)(this.lbMessageBox.Items.Count * 30);
     }
     catch (System.Exception e)
     {
         this.logger.Error(e.ToString());
     }
 }
Пример #37
0
 public void EntGroupListEventHandle(System.Collections.ObjectModel.Collection<GroupReadResponse> list)
 {
     try
     {
         if (list != null)
         {
             foreach (GroupReadResponse response in list)
             {
                 if (response != null)
                 {
                     EntGroup group = new EntGroup();
                     group.Admin = this.StringToLong(response.admin.Split(new char[]
                     {
                         ':'
                     }));
                     group.Description = response.description;
                     group.Gid = response.gid;
                     group.Member = this.StringToLong(response.member.Split(new char[]
                     {
                         ':'
                     }));
                     group.Name = response.name;
                     group.AdminIcon = this.imageService.GetIcon(ImageTypeIcon.GroupIconAdmin);
                     this.dataService.AddEntGroup(group);
                 }
             }
             this.ShowEntGroup();
         }
     }
     catch (System.Exception e)
     {
         ServiceUtil.Instance.Logger.Error(e.ToString());
     }
 }
 public void UpdateGroupInfo(EntGroup group)
 {
     if (group != null)
     {
         ItemGroup ig = this.FindItemGroup(group);
         if (ig != null)
         {
             ig.ChangeGroupName(group.Name, true);
         }
     }
 }
Пример #39
0
 private void EntGroupNoticeCreate(GroupOperationResponse response)
 {
     EntGroup group = this.dataService.GetEntGroup(response.gid);
     if (group == null)
     {
         group = new EntGroup();
         group.Gid = response.gid;
         group.AdminIcon = this.imageService.GetIcon(ImageTypeIcon.GroupIconAdmin);
         this.dataService.AddEntGroup(group);
     }
     group.Name = response.name;
     group.Description = response.description;
     group.Member = this.StringToLong(response.member.Split(new char[]
     {
         ':'
     }));
     group.Admin = this.StringToLong(response.admin.Split(new char[]
     {
         ':'
     }));
     this.CreateEntGroupHandler(group);
 }
Пример #40
0
 public void MessageCenterRecordGroup(Message[] messages, EntGroup group, int total)
 {
     bool color = true;
     this.TotalRecord = total;
     this.trgMessageTable.Rows.Clear();
     int i;
     for (i = messages.Length - 1; i >= 0; i--)
     {
         if (messages[i].MessageBlocks != null && messages[i].MessageBlocks.Length != 0)
         {
             MsgRecordItem row = new MsgRecordItem(messages[i], group);
             if (color)
             {
                 row.Background = new SolidColorBrush(Color.FromRgb(241, 250, 255));
                 color = false;
             }
             else
             {
                 row.Background = new SolidColorBrush(Color.FromRgb(221, 253, 214));
                 color = true;
             }
             WindowModel.Instance.MsgRecordPage.trgMessageTable.Rows.Add(row);
         }
     }
     this.SetRecordPageParam();
     this.InitTitleName("在" + group.Name + "的消息记录");
     string st = messages[i + 1].CreateTime.Substring(0, 10);
     this.DateSelect.Text = st;
 }
 public ItemGroup FindItemGroup(EntGroup group)
 {
     ItemGroup result;
     foreach (ItemGroup ig in (System.Collections.IEnumerable)this.listEntGroup.Items)
     {
         if (ig.Gid == group.Gid)
         {
             result = ig;
             return result;
         }
     }
     result = null;
     return result;
 }
 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();
     }
 }
Пример #43
0
 public void CreateEntGroupHandler(EntGroup group)
 {
     if (group != null)
     {
         INWindow window = this.dataService.INWindow as INWindow;
         if (window != null)
         {
             window.Employee.listEntGroup.AddEntGroup(group);
         }
     }
 }
Пример #44
0
 public void UpdateGroupHandler(EntGroup group)
 {
     try
     {
         if (group != null)
         {
             INWindow window = this.dataService.INWindow as INWindow;
             if (window != null)
             {
                 window.Employee.listEntGroup.UpdateGroupInfo(group);
             }
         }
     }
     catch (System.Exception e)
     {
         ServiceUtil.Instance.Logger.Error(e.ToString());
     }
 }
 public void ChatContentRecoredHandler(int page)
 {
     this.textPage.Text = page.ToString();
     page = this.GetPage(page);
     this.Clear();
     if (this.sessionService.IsDateSearch)
     {
         Staff staff = this.dataService.GetStaff(this.id);
         if (this.type == MessageActorType.EntStaff)
         {
             if (staff != null)
             {
                 this.viewModel.SendStaffDataSearchMessage(this.sessionService.Uid, staff.Uid, this.Starttime, page, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
             }
         }
         else
         {
             if (this.type == MessageActorType.CooperationStaff)
             {
                 if (this.coopStaff != null)
                 {
                     this.viewModel.SendCooperationMessageRecordRequestByDate(this.sessionService.Uid, this.coopStaff.Uid, this.coopStaff.ProjectId, this.Starttime, page, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                 }
             }
             else
             {
                 EntGroup group = this.dataService.GetEntGroup(this.id);
                 if (group != null)
                 {
                     this.viewModel.SendGroupSearchRecord(this.sessionService.Uid, this.id, this.Starttime, page, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                 }
             }
         }
     }
     else
     {
         if (this.type == MessageActorType.EntStaff)
         {
             long  from_uid = this.sessionService.Uid;
             Staff staff    = this.dataService.GetStaff(this.id);
             if (staff != null)
             {
                 this.viewModel.SendStaffMessageRecord(from_uid, staff.Uid, "0", page, 10, MessageRecordType.MESSAGE_CHAT_RECORD);
             }
         }
         else
         {
             if (this.type == MessageActorType.CooperationStaff)
             {
                 if (this.coopStaff != null)
                 {
                     this.viewModel.SendCooperationMessageRecordRequest(this.sessionService.Uid, this.coopStaff.Uid, this.coopStaff.UnitedProjectid, this.Starttime, page, 10, MessageRecordType.MESSAGE_CHAT_RECORD);
                 }
             }
             else
             {
                 EntGroup group = this.dataService.GetEntGroup(this.id);
                 if (group != null)
                 {
                     this.viewModel.SendGroupMessageRecord(group.Gid, "0", page, 10, this.sessionService.Uid, MessageRecordType.MESSAGE_CHAT_RECORD);
                 }
             }
         }
     }
 }
Пример #46
0
 public void WriteFileStream(Message message)
 {
     if (this.type == MessageActorType.EntStaff)
     {
         this.staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid)));
         if (this.staff != null)
         {
             this.temp = string.Concat(new string[]
             {
                 "Staff$",
                 this.staff.Uid.ToString(),
                 "$",
                 message.ToJid,
                 "$",
                 this.staff.Name,
                 "$",
                 message.CreateTime,
                 "\r\n"
             });
             this.data = this.StringToBytes(this.temp);
             this.fst.Seek((long)this.offset, System.IO.SeekOrigin.Current);
             this.fst.Write(this.data, 0, this.data.Length);
             this.fst.Flush();
             message.MessageString = this.utilService.MessageEncode(message.MessageBlocks);
             this.WriteMessageToFile(message.MessageString);
         }
         this.staff = null;
         this.temp = null;
         this.data = null;
     }
     else
     {
         this.group = this.dataService.GetEntGroup(message.Gid);
         if (this.group != null)
         {
             this.temp = string.Concat(new string[]
             {
                 "Group$",
                 this.group.Gid.ToString(),
                 "$",
                 this.group.Name,
                 "$",
                 message.CreateTime,
                 "\r\n"
             });
             this.data = this.StringToBytes(this.temp);
             this.fst.Write(this.data, this.offset, this.data.Length);
             this.fst.Flush();
             message.MessageString = this.utilService.MessageEncode(message.MessageBlocks);
             this.WriteMessageToFile(message.MessageString);
         }
         this.group = null;
         this.temp = null;
         this.data = null;
     }
 }
Пример #47
0
 private void EntGroupMessageRecordEvent(GroupMessageRecordResponse response)
 {
     try
     {
         if (response.GroupMessageRecord != null)
         {
             System.Collections.Generic.List <GroupMessageRecord> records = response.GroupMessageRecord;
             Message[]    messages = new Message[response.GroupMessageRecord.Count];
             MessageStyle ms       = null;
             for (int i = 0; i < messages.Length; i++)
             {
                 ms                        = this.GroupMessageRecordProcessor(records, ms, i);
                 messages[i]               = new Message();
                 messages[i].FromJid       = records[i].from_uid + "@null/null";
                 messages[i].CreateTime    = records[i].createTime;
                 messages[i].ToJid         = records[i].gid.ToString();
                 messages[i].MessageBlocks = this.utilService.MessageDecode(records[i].message);
                 messages[i].Style         = ms;
                 messages[i].RecordId      = records[i].id;
                 messages[i].IsMark        = records[i].isMark;
                 messages[i].FileName      = records[i].fileName;
                 messages[i].Icon          = records[i].icon;
                 messages[i].Url           = records[i].url;
                 messages[i].Style         = ms;
             }
             if (records.Count != 0 && response.groupMessageRecordType == 4)
             {
                 if (WindowModel.Instance.IsOpenMessageCenterWindow())
                 {
                     EntGroup group = this.dataService.GetEntGroup(long.Parse(messages[0].ToJid));
                     WindowModel.Instance.MsgRecordPage.MessageCenterRecordGroup(messages, group, records[0].total);
                     System.GC.Collect();
                 }
             }
             else
             {
                 if (records.Count != 0 && response.groupMessageRecordType == 3)
                 {
                     EntGroupTab item = this.dataService.GetEntGroupChatTab(records[0].gid) as EntGroupTab;
                     if (item != null)
                     {
                         GroupChatTabControl tab = item.TabContent;
                         if (tab != null)
                         {
                             tab.ChatComponent.AddGroupMessageRecords(messages, records[0].total);
                             System.GC.Collect();
                         }
                     }
                 }
                 else
                 {
                     if (records.Count == 0)
                     {
                         if (response.GroupMessageRecord.Count == 0 && response.groupMessageRecordType == 4)
                         {
                             WindowModel.Instance.MsgRecordPage.ClearPage();
                         }
                         else
                         {
                             if (response.GroupMessageRecord.Count == 0 && response.groupMessageRecordType == 3)
                             {
                                 INWindow inWindow = this.dataService.INWindow as INWindow;
                                 if (inWindow != null)
                                 {
                                     EntGroupTab gctc = inWindow.ContentTab.SelectedItem as EntGroupTab;
                                     if (gctc != null)
                                     {
                                         gctc.TabContent.ChatComponent.MsgRecordComp.setShowPage();
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (System.Exception e)
     {
         this.logger.Error(e.ToString());
     }
 }
 private bool InitGroupInfo(MessageCenterChatInfo info)
 {
     bool result;
     if (info.Type == MessageCenterType.EntGroup)
     {
         EntGroup group = this.dataService.GetEntGroup(info.Id);
         if (group != null)
         {
             this.tbkID.Text = info.Id.ToString();
             this.tbkName.Text = group.Name;
             this.tbkDate.Text = info.LastTime;
             this.imgHead.Source = group.AdminIcon;
             this.gp = group;
             result = true;
         }
         else
         {
             result = false;
         }
     }
     else
     {
         result = false;
     }
     return result;
 }
Пример #49
0
 public void CreateOrAtcivateEntGroupManagerWindow(EntGroup entGroup, OperationType type)
 {
     long gid;
     if (entGroup == null)
     {
         gid = -1L;
     }
     else
     {
         gid = entGroup.Gid;
     }
     if (this.entGroupManagerWindows.ContainsKey(gid))
     {
         EntGroupManagerWindow temEntGroupManagerWindow = this.entGroupManagerWindows[gid];
         temEntGroupManagerWindow.Activate();
     }
     else
     {
         if (type == OperationType.Add)
         {
             EntGroupManagerWindow temEntGroupManagerWindow = new EntGroupManagerWindow();
             this.entGroupManagerWindows.Add(gid, temEntGroupManagerWindow);
             temEntGroupManagerWindow.Show();
         }
         else
         {
             if (type == OperationType.Modify)
             {
                 if (entGroup == null)
                 {
                     throw new System.InvalidOperationException("操作类型为Modify时,参数不可为空!");
                 }
                 EntGroupManagerWindow temEntGroupManagerWindow = new EntGroupManagerWindow(entGroup);
                 this.entGroupManagerWindows.Add(gid, temEntGroupManagerWindow);
                 temEntGroupManagerWindow.Show();
             }
         }
     }
 }
Пример #50
0
 public void DeleGroupHandler(EntGroup group)
 {
     try
     {
         if (group != null)
         {
             EntGroupTab item = this.dataService.GetEntGroupChatTab(group.Gid) as EntGroupTab;
             if (item != null)
             {
                 this.ItemGroupCloseTab(item, group.Gid);
             }
             INWindow window = this.dataService.INWindow as INWindow;
             if (window != null)
             {
                 window.Employee.listEntGroup.DeleEntGroup(group);
             }
             this.dataService.RemoveEntGroup(group.Gid);
         }
     }
     catch (System.Exception e)
     {
         ServiceUtil.Instance.Logger.Error(e.ToString());
     }
 }
 private bool GroupInfo(GetIsMark mark)
 {
     EntGroup group = this.dataService.GetEntGroup(mark.id);
     bool result;
     if (group != null)
     {
         this.imgHead.Source = group.AdminIcon;
         this.tbkName.Text = group.Name;
         this.tbkDate.Text = mark.updateTime;
         this.tbkID.Text = group.Gid.ToString();
         this.entgroup = group;
         result = true;
     }
     else
     {
         result = false;
     }
     return result;
 }
Пример #52
0
 private void InitData()
 {
     this.fileDirectory = null;
     this.fst = null;
     this.offset = 0;
     this.temp = null;
     this.data = null;
     this.staff = null;
     this.group = null;
 }
Пример #53
0
        //internal Image imgHead;
        //internal FlowDocumentScrollViewer MessageContent;
        //internal Image imgIsMarked;
        //private bool _contentLoaded;
        public MsgRecordItem(Message message, EntGroup gp)
        {
            this.InitializeComponent();
            Staff fromStaff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid)));

            if (!string.IsNullOrEmpty(message.Url) && !string.IsNullOrEmpty(message.Icon) && !string.IsNullOrEmpty(message.FileName) && fromStaff != null && fromStaff.Uid == this.sessionService.Uid)
            {
                System.IO.FileInfo file = new System.IO.FileInfo(message.FileName);
                this.MessageContent.Document.Blocks.Add(this.GetNameInfo(this.sessionService.Name, message.CreateTime, true));
                this.imgHead.Source = this.sessionService.HeaderImage;
                OpenFileControl openFile = new OpenFileControl(new FileItem(file)
                {
                    FileName   = message.Url + message.FileName,
                    IconBase64 = message.Icon
                }, true);
                if (openFile != null && !string.IsNullOrEmpty(this.sessionService.Name))
                {
                    Paragraph    p   = new Paragraph();
                    FlowDocument doc = this.MessageContent.Document;
                    p.Inlines.Add(openFile);
                    doc.Blocks.Add(p);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(message.Url) && !string.IsNullOrEmpty(message.Icon) && !string.IsNullOrEmpty(message.FileName) && fromStaff == null)
                {
                    System.IO.FileInfo file = new System.IO.FileInfo(message.FileName);
                    this.MessageContent.Document.Blocks.Add(this.GetNameInfo("此人已离职", message.CreateTime, true));
                    this.imgHead.Source = this.imageService.GetHeader(ImageTypeHeader.Gary48);
                    OpenFileControl openFile = new OpenFileControl(new FileItem(file)
                    {
                        FileName   = message.Url + message.FileName,
                        IconBase64 = message.Icon
                    }, true);
                    if (openFile != null && !string.IsNullOrEmpty(this.sessionService.Name))
                    {
                        Paragraph    p   = new Paragraph();
                        FlowDocument doc = this.MessageContent.Document;
                        p.Inlines.Add(openFile);
                        doc.Blocks.Add(p);
                    }
                }
                else
                {
                    if ((long)int.Parse(message.FromJid.Substring(0, message.FromJid.IndexOf("@"))) == this.sessionService.Uid)
                    {
                        this.MessageContent.Document.Blocks.Add(this.GetNameInfo(this.sessionService.Name, message.CreateTime, true));
                        this.imgHead.Source = this.sessionService.HeaderImage;
                    }
                    else
                    {
                        if (fromStaff != null)
                        {
                            this.MessageContent.Document.Blocks.Add(this.GetNameInfo(fromStaff.Name, message.CreateTime, false));
                            this.imgHead.Source = fromStaff.HeaderImageOnline;
                        }
                        else
                        {
                            this.MessageContent.Document.Blocks.Add(this.GetNameInfo("此人已离职", message.CreateTime, false));
                            this.imgHead.Source = this.imageService.GetHeader(ImageTypeHeader.Gary48);
                        }
                    }
                    Block[] messageBlocks = message.MessageBlocks;
                    for (int i = 0; i < messageBlocks.Length; i++)
                    {
                        Paragraph block = (Paragraph)messageBlocks[i];
                        this.SetParagraphStyle(block, message.Style);
                        this.MessageContent.Document.Blocks.Add(block);
                    }
                }
            }
            this.message    = message;
            this.group      = gp;
            this.MouseEvent = true;
            this.InitUI();
        }
Пример #54
0
 //internal Image imgHead;
 //internal FlowDocumentScrollViewer MessageContent;
 //internal Image imgIsMarked;
 //private bool _contentLoaded;
 public MsgRecordItem(Message message, EntGroup gp)
 {
     this.InitializeComponent();
     Staff fromStaff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid)));
     if (!string.IsNullOrEmpty(message.Url) && !string.IsNullOrEmpty(message.Icon) && !string.IsNullOrEmpty(message.FileName) && fromStaff != null && fromStaff.Uid == this.sessionService.Uid)
     {
         System.IO.FileInfo file = new System.IO.FileInfo(message.FileName);
         this.MessageContent.Document.Blocks.Add(this.GetNameInfo(this.sessionService.Name, message.CreateTime, true));
         this.imgHead.Source = this.sessionService.HeaderImage;
         OpenFileControl openFile = new OpenFileControl(new FileItem(file)
         {
             FileName = message.Url + message.FileName,
             IconBase64 = message.Icon
         }, true);
         if (openFile != null && !string.IsNullOrEmpty(this.sessionService.Name))
         {
             Paragraph p = new Paragraph();
             FlowDocument doc = this.MessageContent.Document;
             p.Inlines.Add(openFile);
             doc.Blocks.Add(p);
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(message.Url) && !string.IsNullOrEmpty(message.Icon) && !string.IsNullOrEmpty(message.FileName) && fromStaff == null)
         {
             System.IO.FileInfo file = new System.IO.FileInfo(message.FileName);
             this.MessageContent.Document.Blocks.Add(this.GetNameInfo("此人已离职", message.CreateTime, true));
             this.imgHead.Source = this.imageService.GetHeader(ImageTypeHeader.Gary48);
             OpenFileControl openFile = new OpenFileControl(new FileItem(file)
             {
                 FileName = message.Url + message.FileName,
                 IconBase64 = message.Icon
             }, true);
             if (openFile != null && !string.IsNullOrEmpty(this.sessionService.Name))
             {
                 Paragraph p = new Paragraph();
                 FlowDocument doc = this.MessageContent.Document;
                 p.Inlines.Add(openFile);
                 doc.Blocks.Add(p);
             }
         }
         else
         {
             if ((long)int.Parse(message.FromJid.Substring(0, message.FromJid.IndexOf("@"))) == this.sessionService.Uid)
             {
                 this.MessageContent.Document.Blocks.Add(this.GetNameInfo(this.sessionService.Name, message.CreateTime, true));
                 this.imgHead.Source = this.sessionService.HeaderImage;
             }
             else
             {
                 if (fromStaff != null)
                 {
                     this.MessageContent.Document.Blocks.Add(this.GetNameInfo(fromStaff.Name, message.CreateTime, false));
                     this.imgHead.Source = fromStaff.HeaderImageOnline;
                 }
                 else
                 {
                     this.MessageContent.Document.Blocks.Add(this.GetNameInfo("此人已离职", message.CreateTime, false));
                     this.imgHead.Source = this.imageService.GetHeader(ImageTypeHeader.Gary48);
                 }
             }
             Block[] messageBlocks = message.MessageBlocks;
             for (int i = 0; i < messageBlocks.Length; i++)
             {
                 Paragraph block = (Paragraph)messageBlocks[i];
                 this.SetParagraphStyle(block, message.Style);
                 this.MessageContent.Document.Blocks.Add(block);
             }
         }
     }
     this.message = message;
     this.group = gp;
     this.MouseEvent = true;
     this.InitUI();
 }