Пример #1
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            //Заасинхронить это дело
            AccountViewModel  AccountVM  = new AccountViewModel();
            SettingsViewModel SettingsVM = new SettingsViewModel();

            AccountVM.SetSession(AccountVM.Authorize(LoginField.Text, PasswordField.Password));

            PasswordField.Password = "";

            if (globalCurrentAccount == null)
            {
                return;
            }

            UsernameHolder.Content = globalCurrentAccount.UserName;

            SettingsVM.ActivateSettingsProfile(SettingsVM.GetSelectedProfile(globalCurrentAccount));

            ProfilesList.ItemsSource   = SettingsVM.GetProfilesList();
            ProfilesList.SelectedIndex = ProfilesList.Items.IndexOf(globalCurrentSettingsProfile);

            MessageBox.Show(ProfilesList.Items.IndexOf(globalCurrentSettingsProfile).ToString());

            //Выбор в зависимости от профиля


            LoginGrid.Visibility     = Visibility.Collapsed;
            SavedProfiles.Visibility = Visibility.Visible;
        }
Пример #2
0
        private void ProfilesList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (ProfilesList.IsDropDownOpen)
            {
                SettingsViewModel SettingsVM = new SettingsViewModel();

                SettingsVM.SetSelectedProfile((SettingsProfile)ProfilesList.SelectedItem);
                SettingsVM.ActivateSettingsProfile((SettingsProfile)ProfilesList.SelectedItem);

                ProfilesList.IsDropDownOpen = false;
            }
        }