예제 #1
0
        //呼叫
        private void BtnCall_Click(object sender, EventArgs e)
        {
            Device Device;

            if (OnCall) // 通话中
            {
                return;
            }
            if (textBox.Text == "") // 未输入欲通话设备的地址
            {
                MessageBox.Show(strings.CantBeNull);
                return;
            }
            Address = DevicesAddressConverter.ChStrToRo(textBox.Text);
            Device  = ICMDBContext.GetDeviceByAddress(Address);
            if (Device == null)
            {
                MessageBox.Show(strings.RoNotExist);    // 房号不存在
                return;
            }

            StringBuilder ip      = new StringBuilder(Device.ip.ToString());
            StringBuilder address = new StringBuilder(Device.roomid.Replace("-", ""));

            try
            {
                NativeMethods.Dll_DataOut(1, ip, address);
                OnCall     = true;
                CurIpAddr  = ip.ToString();
                CurAddress = address.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }