怎么用WPF实现微信公众号多客服功能

这篇文章给大家分享的是有关怎么用WPF实现微信公众号多客服功能的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

目前创新互联建站已为成百上千的企业提供了网站建设、域名、网络空间、网站改版维护、企业网站设计、宝鸡网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

原文标题:用WPF实现微信公众号多客服功能

简介:

这是利用WPF作为前端技术,实现桌面版微信多客服系统。项目采用Prism作为前端框架,采用MVVM模式极好的对UI和逻辑代码分离,使用MefBootstrapper集成的MEF IOC容器,解耦各模块对象。合理利用 IEventAggregator 实现事件和交互。文章在介绍对应功能时候会给出相关实现的参考,读者可以参考改进,引入到自己的项目中。

程序运行界面及功能预览:

怎么用WPF实现微信公众号多客服功能

一、登陆:

功能:支持记住用户和用户设置,可选择记住用户密码。

怎么用WPF实现微信公众号多客服功能

实现相关:

自定义登陆窗口,引入Microsoft.Windows.Shell。可参考 WPF Custom Chrome Library 和  MSDN WindowChrome Class 有相关自定义窗口实现。

最小化、最大化、关闭按钮功能实现可参考上面的例子。

登陆按钮,自定义Style,重写Button的Template,参考代码如下:

怎么用WPF实现微信公众号多客服功能怎么用WPF实现微信公众号多客服功能

 
        
            
                
                    
                        
                        
                        
                    
                    
                        
                            
                            
                        
                        
                            
                            
                        
                    
                
            
        
    

View Code

记住密码,采用 XmlSerializer 把用户信息序列化到本地xml配置文件中,程序启动时加载该xml配置文件。用法 MSDN XmlSerializer

二、聊天窗口,信息发送

功能:文字发送,表情发送,图片发送,屏幕截图,快捷回复

怎么用WPF实现微信公众号多客服功能

RichTextBox 相关实现:文字,表情,图片所有输入都是在富文本框 里实现,因此针对 TextChanged 事件对输入进行一系列处理。

文字:不用做任何处理。

表情:文本框里输入的是表情的转义符号,然后根据转义符号找到对应表情图片进行替换。InlineUIContainer

Gif 动态图:WPF中不支持Gif,所以要编写自定义用户控件作为用来显示gif表情。参考 周银辉 [WPF疑难]在WPF中显示动态GIF

怎么用WPF实现微信公众号多客服功能

截图功能:源码在网上找到的,是Winform的一个截图。做了小许修改引进到项目。

参考:C# 实现完整功能的截图控件(4)-完整版 http://www.php.cn/

三、客户列表

控件为 TabControl,重写了TabControl 的Style 和 TabItem的Style

怎么用WPF实现微信公众号多客服功能怎么用WPF实现微信公众号多客服功能

    
        
        
        
        
        
        
            
                
                    
                        
                            
                            
                        
                        
                            
                            
                        
                        
                        
                            
                        
                    
                    
                        
                            
                        
                    
                
            
        
    

    
        
        
        
        
        
        
        
            
                
                    
                        
                            
                                
                                
                                    
                                
                            
                        
                    
                    
                        
                            
                        
                        
                            
                            
                            
                            
                        
                        
                            
                                
                                
                            
                            
                        

                    
                
            
        
    

View Code

怎么用WPF实现微信公众号多客服功能

四、快捷回复面板

应用 TreeView 加 HierarchicalDataTemplate 实现树形列表。

怎么用WPF实现微信公众号多客服功能

五、转接客户

自定义转接客户窗口,样式Xaml代码如下:

怎么用WPF实现微信公众号多客服功能怎么用WPF实现微信公众号多客服功能


                        
                        
                        
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                                
                                                    
                                                    
                                                
                                            
                                            
                                                
                                                
                                                    
                                                    
                                                        
                                                    
                                                
                                            
                                        

                                        
                                            
                                                
                                            
                                        
                                    
                                
                            
                        
                    

View Code

转接客户列表,样式Xaml代码如下:

怎么用WPF实现微信公众号多客服功能怎么用WPF实现微信公众号多客服功能

    
        
        
        
        
        
        
        
        
        
            
                
                    
                        
                            
                                
                                    
                                        
                                        
                                        
                                    
                                    状态
                                    工号
                                    昵称
                                
                            
                            
                                
                            
                        
                    
                    
                        
                            
                        
                    
                
            
        
    
    
        
        
        
        
        
            
                
                    
                        
                            
                                
                                
                                
                            

                            
                                
                                    
                                        
                                        
                                    
                                
                                
                            
                            
                                
                            
                            
                                
                            
                        
                    
                    
                        
                            
                            
                        
                        
                            
                                
                                
                            
                            
                        
                        
                            
                        
                    
                
            
        
    

View Code

怎么用WPF实现微信公众号多客服功能

关于以上控件的事件与命令,引进System.Windows.Interactivity.

在Xmal中导入命名控件 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

使用代码如下:

怎么用WPF实现微信公众号多客服功能怎么用WPF实现微信公众号多客服功能

                
                    
                        
                            
                        
                    
                

View Code

系统运行截图:

怎么用WPF实现微信公众号多客服功能

感谢各位的阅读!关于“怎么用WPF实现微信公众号多客服功能”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!


新闻名称:怎么用WPF实现微信公众号多客服功能
链接地址:http://scyanting.com/article/ppjjoe.html