コード例 #1
0
 public ListContact()
 {
     InitializeComponent();
     ListContactViewModel vm = new ListContactViewModel();
     vm.View = this;
     DataContext = vm;
     if (Settings.Default.Roles == Roles.Admin)
     {
         addBtn.Visibility = Visibility.Visible;
         delBtn.Visibility = Visibility.Visible;
     }
 }
コード例 #2
0
 public RepositoryManagerViewModel(IRepository<Contact> currentRepository, ListContactViewModel parrentViewModel, List<IRepository<Contact>> memoryRepositories)
     : this()
 {
     _parentViewModel = parrentViewModel;
     _memoryRepositories = memoryRepositories;
     if (!ReferenceEquals(currentRepository, null))
     {
         CurrentTypeRepository = currentRepository.Type;
         if (currentRepository.Type == RepositoryType.XML)
         {
             foreach (IRepository<Contact> item in _xmlRepositories)
             {
                 if (item.Name == currentRepository.Name)
                 {
                     SelectedCurrentRepository = item;
                     break;
                 }
             }
         }
         else if (currentRepository.Type == RepositoryType.Memory)
         {
             foreach (IRepository<Contact> item in _memoryRepositories)
             {
                 if (item.Name == currentRepository.Name)
                 {
                     SelectedCurrentRepository = item;
                     break;
                 }
             }
         }
     }
     else
         SelectedCurrentRepository = currentRepository;
 }
コード例 #3
0
 public InformationViewModel(Contact contact, ListContactViewModel model)
     : this(contact)
 {
     _mainVindowModel = model;
 }