public FormChat(IClient client, ChatDataModel.Account account, IAudioCall phoneCall)
        {
            InitializeComponent();
            _client = client;
            _user   = account;
            Stream imageMe, imageFriend;
            string myName = "";

            lock (this)
            {
                imageMe = GoogleDriveFilesRepository.DownloadFile(Util.Instance.CurrentUser.AvatarDriveID);
                myName  = Util.Instance.CurrentUser.Name;
            }
            imageFriend                = GoogleDriveFilesRepository.DownloadFile(_user.AvatarDriveID);
            _ptbFriendsAvatar.Image    = Image.FromStream(imageFriend);
            _ptbFriendsAvatar.SizeMode = PictureBoxSizeMode.StretchImage;
            _lbFriendsName.Text        = _user.Name;
            authorMe          = new Author(Image.FromStream(imageMe), myName);
            authorFriend      = new Author(Image.FromStream(imageFriend), _user.Name);
            _rcChatlog.Author = authorMe;
            //gửi yêu cầu lấy lịch sử chat
            _client.RequestGetHistory(Util.Instance.CurrentUser.Email, _user.Email);
            _rcChatlog.ChatElement.ShowToolbarButtonElement.Click += ShowToolbarButtonElement_Click;
            _rcChatlog.ChatElement.SendButtonElement.Click        += SendButtonElement_Click;
            _rcChatlog.CardActionClicked += _rcChatlog_CardActionClicked;
            _rcChatlog.ChatElement.MessagesViewElement.BackColor = Color.White;
            _rcChatlog.AutoScroll = false;

            _phoneCall = phoneCall;
            _phoneCall.CallStateChange += _phoneCall_CallStateChange;
        }
        private void RegisPhoneLine()
        {
            Thread thread = new Thread(delegate()
            {
                _call = new OzekiAudioCall();
                _call.RegisterGroup(_group);
                _call.InitializeConferenceRoom();
                _call.CallStateChange += _call_CallStateChange;
            });

            thread.Start();
        }
Esempio n. 3
0
        public CallForm(IAudioCall call)
        {
            InitializeComponent();
            _call = call;
            _call.ModifyCallStyle(MyCallStyle.AudioVideo);
            _call.StartCamera();
            _call.ConnectMedia();
            CallView callView = new CallView();

            this.Controls.Add(callView);
            this.Size = callView.Size;
            callView.SetRemoteProvider(_call.GetRemoteProvider());
            callView.SetLocalProvider(_call.GetLocalProvider());
        }
Esempio n. 4
0
        private void RegisPhoneLine()
        {
            Thread thread = new Thread(delegate()
            {
                _call = new OzekiAudioCall();
                _call.RegisterAccount(_account);
                //_call.ConnectMedia();
                _call.SoftPhoneInComingCall += _call_SoftPhoneInComingCall;
                _call.CallStateChange       += _call_CallStateChange;
                _call.FormVideoCallClose    += _call_FormVideoCallClose;
            });

            thread.Start();
        }
        public FormInComingCall(IAudioCall call, string caller)
        {
            InitializeComponent();
            _call = call;

            _lbCaller.Text = caller + " đang gọi cho bạn!";
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"D:\ThucTap\ChatApplication\ChatApplication\Asset\telephone-ring-01a.wav");

            Thread thread = new Thread(delegate()
            {
                radWaitingBar1.StartWaiting();
                player.Play();
                player.PlayLooping();
            });

            thread.Start();

            this.FormClosed += delegate {
                player.Stop();
                thread.Abort();
            };
        }
Esempio n. 6
0
        public FormInCall(IAudioCall phoneCall, Account account)
        {
            InitializeComponent();
            _phoneCall          = phoneCall;
            _account            = account;
            _lbName.Text        = _account.Name;
            _ptbAvatar.SizeMode = PictureBoxSizeMode.StretchImage;

            _timerThoiLuongCuocGoi.Interval = 1000;
            _timerThoiLuongCuocGoi.Start();
            _timerThoiLuongCuocGoi.Tick += _timerThoiLuongCuocGoi_Tick;

            Thread thread = new Thread(delegate()
            {
                var image = Image.FromStream(GoogleDriveFilesRepository.DownloadFile((_account.AvatarDriveID)));
                _ptbAvatar.Invoke(new MethodInvoker(delegate()
                {
                    _ptbAvatar.Image = ImageConverter.ImageResize.ResizeImageCircle(image, 70);
                }));
            });

            thread.Start();
        }
        public FormCall(IAudioCall phoneCall, Account account)
        {
            InitializeComponent();
            _account   = account;
            _phoneCall = phoneCall;

            _lbCallTo.Text = "Bạn đang gọi cho " + _account.Name;

            System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"D:\ThucTap\ChatApplication\ChatApplication\Asset\phone-calling-1.wav");

            Thread thread = new Thread(delegate()
            {
                player.Play();
                player.PlayLooping();
            });

            thread.Start();

            this.FormClosed += delegate
            {
                player.Stop();
                thread.Abort();
            };
        }