Exemplo n.º 1
0
		public EmailDetailsViewModel()
		{
			SelectZonesCommand = new RelayCommand(OnSelectZonesCommand);
			StateTypes = new ObservableCollection<StateTypeViewModel>();
			foreach (StateType stateType in Enum.GetValues(typeof(StateType)))
			{
				StateTypes.Add(new StateTypeViewModel(stateType));
			}
			Title = "Создать получателя";
			EmailViewModel = new EmailViewModel();
		}
Exemplo n.º 2
0
		public EmailDetailsViewModel(Email email)
		{
			SelectZonesCommand = new RelayCommand(OnSelectZonesCommand);
			StateTypes = new ObservableCollection<StateTypeViewModel>();
			foreach (StateType stateType in Enum.GetValues(typeof(StateType)))
			{
				StateTypes.Add(new StateTypeViewModel(stateType));
			}
			Title = "Редактировать получателя";
			EmailViewModel = new EmailViewModel(email);
			StateTypes.Where(
				eventViewModel => email.States.Any(
					x => x == eventViewModel.StateType)).All(x => x.IsChecked = true);
		}
Exemplo n.º 3
0
		public void Initialize()
		{
			Emails = new ObservableCollection<EmailViewModel>();

			if (FiresecManager.SystemConfiguration.EmailData.Emails == null ||
				FiresecManager.SystemConfiguration.EmailData.Emails.Count == 0)
			{
				FiresecManager.SystemConfiguration.EmailData.Emails = new List<Email>();
				AddSampleEmail();
			}

			foreach (var email in FiresecManager.SystemConfiguration.EmailData.Emails)
			{
				var emailViewModel = new EmailViewModel(email);
				Emails.Add(emailViewModel);
			}

			SelectedEmail = Emails.FirstOrDefault();
		}
Exemplo n.º 4
0
		private void OnAdd()
		{
			var emailDetailsViewModel = new EmailDetailsViewModel();
			if (DialogService.ShowModalWindow(emailDetailsViewModel))
			{
				FiresecManager.SystemConfiguration.EmailData.Emails.Add(emailDetailsViewModel.EmailViewModel.Email);
				var emailViewModel = new EmailViewModel(emailDetailsViewModel.EmailViewModel.Email);
				Emails.Add(emailViewModel);
				SelectedEmail = emailViewModel;
				ServiceFactory.SaveService.EmailsChanged = true;
			}
		}