public void StartChat(string id, int type)
 {
     startChatParams             = new ChatSimpleInfo();
     startChatParams.id          = id;
     startChatParams.type        = type;
     SplitViewMenu.SelectedIndex = 0;
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter != null)
            {
                ChatSimpleInfo info = JsonConvert.DeserializeObject <ChatSimpleInfo>(e.Parameter as string);
                switch (info.type)
                {
                case 0:
                    int s = -1;
                    for (int i = 0; i < ChatVM.Chats.Count; ++i)
                    {
                        if (ChatVM.Chats[i].ReceiverId == info.id)
                        {
                            s = i;
                            break;
                        }
                    }
                    if (s == -1)
                    {
                        ChatVM.Chats.Insert(0, new ChatModel(info.id, 0, App.AppVM.ContactVM.FindUser(info.id).Nickname));
                        s = 0;
                    }
                    UIVM.SelectedIndex = s;
                    break;

                default:
                    break;
                }
            }
        }
        private void MainPaneMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int selectedIndex = MainPageUIVM.MenuItems.IndexOf(MainPageUIVM.SelectedMenuItem);

            switch (selectedIndex)
            {
            case 0:
                MainFrame.Navigate(typeof(ChatPage), startChatParams != null ? JsonConvert.SerializeObject(startChatParams) : null);
                startChatParams = null;
                MainPageUIVM.MenuItems[0].Unread = 0;
                break;

            case 1:
                MainFrame.Navigate(typeof(ContactsPage));
                break;

            default:
                break;
            }
            MainSplitView.IsPaneOpen = false;
        }