Example #1
0
        private async Task ConnectUserRoom(string roomId, CallUser user)
        {
            if (!IsValidRoom(roomId))
            {
                throw new Exception("Invalid room");
            }

            if (!IsValidUser(user))
            {
                throw new Exception("Invalid user");
            }

            if (!Rooms.TryGetValue(roomId, out var users))
            {
                Rooms.Add(roomId, new List <CallUser>());
            }

            if (Rooms[roomId].Contains(user))
            {
                throw new Exception("user is already logged in the room");
            }

            Rooms[roomId].Add(user);

            if (Rooms[roomId].Any(x => x.CallId != user.CallId))
            {
                await Clients.Clients(Rooms[roomId].Select(x => x.ConnectionId).ToList())
                .SendAsync("CallUserConnectRoom", user.CallId, roomId, false, Rooms[roomId].Count, Rooms[roomId].FindAll(x => x.ConnectionId != Context.ConnectionId));
            }
        }
Example #2
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CallUser = null;
            frmLogIn fofo = new frmLogIn();

            fofo.ShowDialog();
            this.Close();
        }
Example #3
0
        public override async Task OnConnectedAsync()
        {
            var callId   = Context.GetHttpContext().Request.Query["callId"].ToString();
            var roomId   = Context.GetHttpContext().Request.Query["roomId"].ToString();
            var callUser = new CallUser(callId, Context.ConnectionId);

            await ConnectUserRoom(roomId, callUser);

            await base.OnConnectedAsync();
        }
Example #4
0
        public Form1(CallUser user)
        {
            InitializeComponent();

            CustomerNumberTxt.TextChanged += (s, a) =>
            {
                if (CustomerNumberTxt.Text.Length >= 6)
                {
                    using (DataContext _context = new DataContext())
                    {
                        ChecKCustomer(_context, true);
                    }
                }
            };

            hoursCB.SelectedIndex = 0;
            minCB.SelectedIndex   = 0;
            //    daysCB.SelectedIndex = 0;

            isWait.CheckedChanged += (sender, e) =>
            {
                if (isWait.Checked)
                {
                    hoursCB.Enabled = true;
                    minCB.Enabled   = true;
                    //    daysCB.Enabled = true;
                }
                else
                {
                    hoursCB.Enabled = false;
                    minCB.Enabled   = false;
                    //   daysCB.Enabled = false;
                }
            };


            int sss = DateTime.Now.Day;
            var s1  = sss + 1;
            var s2  = sss + 2;

            using (DataContext _context = new DataContext())
            {
                gridControl1.DataSource = _context.Orders.Where(s => s.Date.Day == DateTime.Now.Day && s.Date.Year == DateTime.Now.Year && s.Date.Month == DateTime.Now.Month).ToList();
            }
            CallUser = user;
            gridView1.OptionsView.ShowGroupPanel = false;
        }
Example #5
0
 private bool IsValidUser(CallUser user)
 {
     return(user.CallId != null);
 }
Example #6
0
 public void OnCallUser(ConnectionDelegateArgs args)
 {
     CallUser?.Invoke(this, args);
 }