private void searchBtn_Click(object sender, RoutedEventArgs e) { //Если пользователь ищет сам себя, просто перенаправляем его на страницу своего профиля. if (textBox.Text == Evennote.user.username) { Evennote.contextUser = Evennote.user; ((Application.Current.MainWindow as MainWindow).mainframe.Content as menu_page).frame.Source = new Uri("profile_page.xaml", UriKind.Relative); return; } Evennote.contextUser = Evennote.GetUserData(textBox.Text); if (Evennote.contextUser == null) { MessageBox.Show("User " + textBox.Text + " not exist!"); return; } ((Application.Current.MainWindow as MainWindow).mainframe.Content as menu_page).frame.Source = new Uri("profile_page.xaml", UriKind.Relative); }