Exemplo n.º 1
0
 public MakingCallViewModel() : base()
 {
     socket        = SocketAPI.GetInstance().GetSocket();
     currentRoom   = new RoomModel();
     callingModel  = CallingModel.GetInstace();
     HangupCommand = new DelegateCommand(Hangup);
     HandleSocket();
 }
Exemplo n.º 2
0
 private void HandleSocket()
 {
     socket.On("end_call", () =>
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             Exit();
             CallingModel.GetInstace().State = CallingState.FREE;
         });
     });
 }
Exemplo n.º 3
0
        public CallingViewModel()
        {
            socket            = SocketAPI.GetInstance().GetSocket();
            currentRoom       = new RoomModel();
            callingModel      = CallingModel.GetInstace(currentRoom);
            RoomChangeCommand = new DelegateCommand <RoomModel>(OnRoomChange);
            LoadCommand       = new DelegateCommand(OnLoad);

            ShowVoiceCallCommand = new DelegateCommand(ShowVoiceCall);

            HandleSocket();
        }
Exemplo n.º 4
0
        private void Exit()
        {
            CallingModel.GetInstace().State = CallingState.FREE;

            foreach (Window window in Application.Current.Windows)
            {
                if (window.Title == "ReceiveCallWindow")
                {
                    window.Close();
                }
            }
        }
Exemplo n.º 5
0
        private void AcceptCall()
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                // emit to server accept call
                var data = new JObject();
                data.Add("room_id", currentRoom.ID);
                data.Add("user", JObject.FromObject(UserInfo.GetInstance()));
                socket.Emit("accept_call", data);

                CallingModel.GetInstace().State = CallingState.BUSY;
                navigate.Invoke("OnGoingCallViewModel", new object[] { currentRoom });
            });
        }
 public OnGoingCallViewModel(Action <object, object[]> navigate, params object[] parameters) : this()
 {
     this.navigate = navigate;
     currentRoom   = (RoomModel)parameters[0];
     callingModel  = CallingModel.GetInstace(currentRoom);
 }