Esempio n. 1
0
        public frmMain()
        {
            InitializeComponent();
#if USE_AHEAD_VOIP
            gb_ailink.Height = 70;
            gb_agents.Top    = 107;

            ocx = new AxALINKVOIPOCXLib.AxAlinkVoipOCX();
            ((System.ComponentModel.ISupportInitialize)(ocx)).BeginInit();
            ocx.Enabled  = true;
            ocx.Location = new System.Drawing.Point(-10, -10);
            ocx.Name     = "axAlinkVoipOCX1";
            //ocx.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAlinkVoipOCX1.OcxState")));
            ocx.Size     = new System.Drawing.Size(5, 5);
            ocx.TabIndex = 13;
            this.Controls.Add(ocx);
            ((System.ComponentModel.ISupportInitialize)(ocx)).EndInit();
#else
            gb_ailink.Height = 100;
            gb_agents.Top    = 136;
            this.Controls.Remove(ivAnswer);
            this.Controls.Remove(ivHangup);
            gb_agents.BringToFront();
#endif
            _server = new LXHttpServer(httpActionHandler, Properties.Settings.Default.HttpActionPort);
        }
Esempio n. 2
0
        private void tsmi_exit_Click(object sender, EventArgs e)
        {
            string tips = m_isRunning ? "退出系统后将无法实现电话接入及弹屏等操作!\r\n\r\n确认要退出本系统吗?" : "确认要退出本系统吗?";

            if (MessageBox.Show(tips, "Ailink提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
            {
                return;
            }

            //断开连接
            Logout();
#if USE_AHEAD_VOIP
            try
            {
                if (ocx != null)
                {
                    var iRet = ocx.LXSipUnregister();
                    ocx.OnLXVoipMsg -= Ocx_OnLXVoipMsg;
                    this.Controls.Remove(ocx);
                    ocx.Dispose();
                    ocx = null;
                }
                //
                foreach (var f in Directory.GetFiles(Environment.CurrentDirectory, "SipLog*.txt"))
                {
                    File.Delete(f);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Write("EnvironmentExit", ex.Message);
            }
#endif
            //清理图标内容
            notifyIcon1.Dispose();
            try
            {
                int hwnd = NativeMethods.FindWindow("Shell_TrayWnd", null);
                NativeMethods.UpdateWindow(hwnd);
                hwnd = NativeMethods.FindWindowEx(hwnd, 0, "TrayNotifyWnd", null);
                NativeMethods.UpdateWindow(hwnd);
            }
            catch { }
            //终止程序
            try
            {
                this.Close();
                Application.Exit();
                // Environment.Exit(0);
            }
            catch { }
        }
Esempio n. 3
0
        void Logout()
        {
            try
            {
#if USE_AHEAD_VOIP
                if (ocx != null)
                {
                    ocx.LXSipUnregister();
                    ocx = null;
                }
#else
                if (m_connection != null)
                {
                    m_connection.Send("103/{0}/|", m_agent); //退出登录
                    m_connection.Dispose();
                    m_connection = null;
                    //清理现场  //add by niwz 2018.03.13
                    if (frmDialup != null)
                    {
                        frmDialup.Dispose();
                        frmDialup = null;
                    }
                    //
                    if (frmWay != null)
                    {
                        frmWay.Dispose();
                        frmWay = null;
                    }
                    m_cur_joincaller   = string.Empty;
                    m_caller_muted     = false;
                    m_joincaller_muted = false;
                }
#endif
                //
                TuneControl(false);
            }
            catch { }
        }