⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 welcome.cs

📁 对接入电脑的电话modem监听。电话录音
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TAPI3Lib;
using TERMMGRLib;

namespace telListener
{
    public partial class welcome : Form
    {
        private Confctl conf;
        public welcome()
        {
            conf = new Confctl();
            InitializeComponent();
        }
        private void welcome_Load(object sender, EventArgs e)
        {
            basePath = Application.StartupPath;
            
            webBrowser1.Navigate(basePath + "\\html\\welcome.html");
        }
        
        private void button1_Click(object sender, EventArgs e)
        {

            login lg = new login();
            lg.ShowDialog();
            string accountStr="";

            if (lg.Tag != null)
            {
                this.loginName = login.loginName;
                this.password = login.password;
                
                accountStr = lg.Tag.ToString();
                webBrowser1.Navigate(conf.getLoginUrl() + accountStr);
            }
        }


        
        private void button2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否切换到录音模式?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                webBrowser1.Navigate(basePath + "\\html\\tape.html");
            }
            else
            {
                webBrowser1.Navigate(basePath + "\\html\\welcome.html");
            }
            button1.Enabled = true;
            button2.Enabled = false;
            this.Close();
        }

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            string strtmp = "file:///" + basePath + "/html/tape.html";
            strtmp = strtmp.Replace("\\","/");
            if (webBrowser1.Url.ToString().Equals(conf.getLoginSuccessUrl()))
            {
                button1.Enabled = false;
                button2.Enabled = true;
                this.notifyIcon1.Text = "电话热线受理模式运行中……";
                state = "1";//电话受理模式
                notifyIcon1.Icon = new Icon(basePath + "\\html\\tel.ico");
                telDisposeToolStripMenuItem.Checked = true;
                telTapeToolStripMenuItem.Checked = false;
            }
            else if (webBrowser1.Url.ToString().Equals(strtmp))
            {
                button1.Enabled = true;
                button2.Enabled = false;
                this.notifyIcon1.Text = "录音模式运行中……";
                notifyIcon1.Icon = new Icon(basePath + "\\html\\tape.ico");
                state = "2";//夜间录音模式
                telDisposeToolStripMenuItem.Checked = false;
                telTapeToolStripMenuItem.Checked = true;
            }
            else
            {
                button1.Enabled = true;
                button2.Enabled = false;
                this.notifyIcon1.Text = "空闲状态";
                state = "0";//夜间录音模式
                notifyIcon1.Icon = new Icon(basePath + "\\html\\free.ico");
                telDisposeToolStripMenuItem.Checked = false;
                telTapeToolStripMenuItem.Checked = false;
            }
        }

        private void welcome_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true; // 取消关闭窗体
            this.Hide();
            this.ShowInTaskbar = false;
            this.notifyIcon1.Visible = true;//显示托盘图标
        }
        //托盘图标双击
        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.Show();
            if (this.WindowState == FormWindowState.Minimized)
                this.WindowState = FormWindowState.Normal;
            this.Activate();
        }
        //退出
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("您确定要退出吗?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                this.notifyIcon1.Visible = false;
                this.Dispose();
                this.Close();
                Application.Exit();
            }
        }
        //电话受理模式
        private void telDisposeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            login lg = new login();
            lg.ShowDialog();
            string accountStr = "";

            if (lg.Tag != null)
            {
                accountStr = lg.Tag.ToString();
                webBrowser1.Navigate(conf.getLoginUrl() + accountStr);
            }
            this.Show();
            if (this.WindowState == FormWindowState.Minimized)
                this.WindowState = FormWindowState.Normal;
            this.Activate();
            
        }
        //录音模式
        private void telTapeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(basePath+"\\html\\tape.html");
        }
        //最小化时托盘显示
        private void welcome_Resize(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.Hide();
                this.ShowInTaskbar = false;
                this.notifyIcon1.Visible = true;//显示托盘图标
            }
        }
        //打开
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Show();
            if (this.WindowState == FormWindowState.Minimized)
                this.WindowState = FormWindowState.Normal;
            this.Activate();
        }

        //来电处理事件
        private void telEvents(TAPI3Lib.TAPI_EVENT te, object eobj)
        {

            TerminalManager a = new TerminalManager();
            //TERMMGRLib.TerminalManagerClass b = new TerminalManagerClass();
            
            MessageBox.Show("ok");
            if (this.state.Equals("1"))
            {
                MessageBox.Show("IE");
                if (te.Equals(TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION))
                {

                    //ITBasicCallControl itbasiccallctrl;
                    
                    TAPI3Lib.ITCallNotificationEvent itcallnotificationevent = (TAPI3Lib.ITCallNotificationEvent)eobj;
                    TAPI3Lib.ITCallInfo itcallinfo = itcallnotificationevent.Call;
                    try
                    {
                        //得到电话号码
                        string tel = "";
                        System.Diagnostics.Process.Start("IEXPLORE.EXE", conf.getOpenUrl()+"?tel="+tel+"&autologin=csAutoLogin");
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message);
                    }
                }
            }
            else if (this.state.Equals("2"))
            {
                //录音
            }
        }

        private void settingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            config conf = new config();
            conf.ShowDialog();

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -