Пример #1
0
 private void SelectProfil(ProfilViewModel profil)
 {
     if (profil != CurrentProfile && CheckModifications(true))
     {
         foreach (ProfilViewModel otherProfile in Profils)
         {
             otherProfile.Selected = false;
         }
         if (profil != null)
         {
             profil.Selected = true;
             CurrentProfile  = profil;
         }
     }
 }
Пример #2
0
        private void CreateProfil()
        {
            var newProfil           = new ProfilViewModel();
            AddProfileDialog dialog = new AddProfileDialog
            {
                DataContext = newProfil,
                Owner       = Application.Current.MainWindow
            };
            var resDialog = dialog.ShowDialog();

            if (resDialog.HasValue && resDialog.Value)
            {
                newProfil.Command = new RelayCommand(o => SelectProfil((ProfilViewModel)o));
                Profils.Add(newProfil);
                SelectProfil(newProfil);
            }
        }