Ejemplo n.º 1
0
        public ChatViewModel()
        {
            selectedString      = "";
            socket              = SocketAPI.GetInstance().GetSocket();
            SendCommand         = new DelegateCommand(SendMessege);
            ChangeWindowCommand = new DelegateCommand(ChangeWindow);
            ItemSelectedCommand = new DelegateCommand <ChatModel>(HandleSelectedItem);

            listChatModel = new ListChatModel();

            // Some sample instances
            listChatModel.Add(new ChatModel()
            {
                Name = "Name 1", Content = "Test content 1"
            });
            listChatModel.Add(new ChatModel()
            {
                Name = "Name 2", Content = "Test content 2"
            });
            listChatModel.Add(new ChatModel()
            {
                Name = "Name 3", Content = "Test content 3"
            });
            listChatModel.Add(new ChatModel()
            {
                Name = "Name 4", Content = "Test content 4"
            });
            listChatModel.Add(new ChatModel()
            {
                Name = "Name 5", Content = "Test content 5"
            });

            RecieveMessege();
        }
Ejemplo n.º 2
0
 public static SocketAPI GetInstance()
 {
     if (instance == null)
     {
         instance = new SocketAPI();
     }
     return(instance);
 }
Ejemplo n.º 3
0
        public ChatMessegeModel()
        {
            currMessege = new MessegeModel();
            list        = new List <MessegeModel>();
            socket      = SocketAPI.GetInstance().GetSocket();

            socket.On("dotnet_new_message", (message) =>
            {
                list.Add((MessegeModel)message);
            });
        }
Ejemplo n.º 4
0
 public ChatModel()
 {
     Name    = "";
     Content = "";
     socket  = SocketAPI.GetInstance().GetSocket();
 }
Ejemplo n.º 5
0
 public MainWindow()
 {
     InitializeComponent();
     socket = SocketAPI.GetInstance().GetSocket();
     //DataContext = new ChatViewModel();
 }