public void Execute(object parameter)
        {
            App.CurrentUser = App.UserModel.Users.SingleOrDefault(x => x.Email == LoginViewModel.Email);
            if (App.CurrentUser.Id == 1)
            {
                App.NetworkHelper.User_Id = 0;
            }
            else
            {
                App.NetworkHelper.User_Id = 1;
            }
            if (App.CurrentUser != null)
            {
                Task.Run(() =>
                {
                    App.NetworkHelper.ConnectToServer();
                });
                LoginViewModel.MyGrid.Children.Clear();
                FirstChatViewModel firstChatViewModel = new FirstChatViewModel();
                firstChatViewModel.IsClickedToChat = true;
                FirstChatUserControl firstChatUserControl = new FirstChatUserControl(firstChatViewModel);
                LoginViewModel.MyGrid.Children.Add(firstChatUserControl);
                var           allchats      = App.CurrentUser.AllConversations;
                ChatViewModel chatViewModel = new ChatViewModel();
                chatViewModel.AllChats           = new ObservableCollection <Chat>();
                chatViewModel.FirstChatViewModel = firstChatViewModel;
                var count = App.UserModel.Users.Count;
                App.CurrentUser.AllConversations = new List <Conversation>();
                for (int i = 0; i < count; i++)
                {
                    Conversation conversation = new Conversation();
                    conversation.User        = App.UserModel.Users[i];
                    conversation.AllMessages = new ObservableCollection <Message>();
                    App.CurrentUser.AllConversations.Add(conversation);
                    Chat chat = new Chat()
                    {
                        Id          = i + 1,
                        ImageSource = @"/Images\personWhiteSmoke.png",
                        User        = App.CurrentUser.AllConversations[i].User,
                        Message     = new Message() //App.CurrentUser.AllConversations[i].AllMessages[App.CurrentUser.AllConversations[i].AllMessages.Count - 1]
                    };

                    chatViewModel.AllChats.Add(chat);
                }
                ChatUserControl chatUserControl = new ChatUserControl(chatViewModel);
                firstChatViewModel.MyChatGrid.Children.Clear();
                firstChatViewModel.MyChatGrid.Children.Add(chatUserControl);
            }
        }
        public void Execute(object parameter)
        {
            ContactViewModel.MyGrid.Children.Clear();
            FirstChatViewModel firstChatViewModel = new FirstChatViewModel();

            firstChatViewModel.IsClickedToChat = true;
            FirstChatUserControl firstChatUserControl = new FirstChatUserControl(firstChatViewModel);

            ContactViewModel.MyGrid.Children.Add(firstChatUserControl);
            var           allchats      = App.CurrentUser.AllConversations;
            ChatViewModel chatViewModel = new ChatViewModel();

            chatViewModel.AllChats           = new ObservableCollection <Chat>();
            chatViewModel.FirstChatViewModel = firstChatViewModel;
            var count = App.UserModel.Users.Count;

            App.CurrentUser.AllConversations = new List <Conversation>();
            for (int i = 0; i < count; i++)
            {
                Conversation conversation = new Conversation();
                conversation.User        = App.UserModel.Users[i];
                conversation.AllMessages = new ObservableCollection <Message>();
                App.CurrentUser.AllConversations.Add(conversation);
                Chat chat = new Chat()
                {
                    Id          = i + 1,
                    ImageSource = @"/Images\personWhiteSmoke.png",
                    User        = App.CurrentUser.AllConversations[i].User,
                    Message     = App.CurrentUser.AllConversations[i].AllMessages[App.CurrentUser.AllConversations[i].AllMessages.Count - 1]
                };

                chatViewModel.AllChats.Add(chat);
            }

            ChatUserControl chatUserControl = new ChatUserControl(chatViewModel);

            firstChatViewModel.MyChatGrid.Children.Clear();
            firstChatViewModel.MyChatGrid.Children.Add(chatUserControl);
        }
        public void Execute(object parameter)
        {
            var correctCode = VerificationViewModel.VerificationCode;
            var userCode    = VerificationViewModel.Code;

            if (correctCode == userCode)
            {
                App.UserModel.Users.Add(VerificationViewModel.NewUser);
                App.Config.Users = App.UserModel.Users;
                App.Config.SeriailizeWordsToJson();
                VerificationViewModel.Notification = "You completed registriation successfully";
                VerificationViewModel.MyGrid.Children.Clear();
                FirstChatViewModel firstChatViewModel = new FirstChatViewModel();
                firstChatViewModel.IsClickedToChat = true;
                FirstChatUserControl firstChatUserControl = new FirstChatUserControl(firstChatViewModel);
                VerificationViewModel.MyGrid.Children.Add(firstChatUserControl);
                ChatViewModel chatViewModel = new ChatViewModel();
                chatViewModel.AllChats = new ObservableCollection <Chat>()
                {
                    new Chat()
                    {
                        Id = 1
                        ,
                        User = new User()
                        {
                            Id         = 1,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 1,
                            Content  = "Salam brat",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = true
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    },
                    new Chat()
                    {
                        Id   = 2,
                        User = new User()
                        {
                            Id         = 1,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 2,
                            Content  = "sag ol qaqa sen necesen ?",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = true
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    }
                    ,
                    new Chat()
                    {
                        Id = 3
                        ,
                        User = new User()
                        {
                            Id         = 2,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 3,
                            Content  = "oldu qaqa",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = false
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    }
                    ,
                    new Chat()
                    {
                        Id = 1
                        ,
                        User = new User()
                        {
                            Id         = 1,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 1,
                            Content  = "Salam brat",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = true
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    },
                    new Chat()
                    {
                        Id   = 2,
                        User = new User()
                        {
                            Id         = 1,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 2,
                            Content  = "sag ol qaqa sen necesen ?",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = true
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    }
                    ,
                    new Chat()
                    {
                        Id = 3
                        ,
                        User = new User()
                        {
                            Id         = 2,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 3,
                            Content  = "oldu qaqa",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = false
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    },
                    new Chat()
                    {
                        Id = 1
                        ,
                        User = new User()
                        {
                            Id         = 1,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 1,
                            Content  = "Salam brat",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = true
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    },
                    new Chat()
                    {
                        Id   = 2,
                        User = new User()
                        {
                            Id         = 1,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 2,
                            Content  = "sag ol qaqa sen necesen ?",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = true
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    }
                    ,
                    new Chat()
                    {
                        Id = 3
                        ,
                        User = new User()
                        {
                            Id         = 2,
                            Email      = ""
                            , Username = "******"
                        },
                        Message = new Message()
                        {
                            Id       = 3,
                            Content  = "oldu qaqa",
                            DateTime = DateTime.Now.ToShortTimeString(),
                            IsRed    = false
                        },
                        ImageSource = @"/Images\personWhiteSmoke.png"
                    }
                };
                chatViewModel.FirstChatViewModel = firstChatViewModel;
                ChatUserControl chatUserControl = new ChatUserControl(chatViewModel);
                firstChatViewModel.MyChatGrid.Children.Clear();
                firstChatViewModel.MyChatGrid.Children.Add(chatUserControl);
            }
            else
            {
                VerificationViewModel.Notification = "You verification code is not right  please try again";
            }
        }