コード例 #1
0
        public RemoteAccessViewModel(RemoteAccess remoteAccess)
        {
            AddCommand = new RelayCommand(OnAdd);
            RemoveCommand = new RelayCommand(OnRemove, CanRemove);

            ServiceFactory.Events.GetEvent<RemoteAccessTypeChecked>().Unsubscribe(OnRemoteAccessTypeChecked);
            ServiceFactory.Events.GetEvent<RemoteAccessTypeChecked>().Subscribe(OnRemoteAccessTypeChecked);

            RemoteAccessTypes = new List<RemoteAccessTypeViewModel>();
            foreach (RemoteAccessType remoteAccessType in Enum.GetValues(typeof(RemoteAccessType)))
            {
                RemoteAccessTypes.Add(new RemoteAccessTypeViewModel(remoteAccessType));
            }
            RemoteAccessTypes.Find(x => x.RemoteAccessType == remoteAccess.RemoteAccessType).IsActive = true;

            HostNameOrAddressList = new ObservableCollection<string>(remoteAccess.HostNameOrAddressList);
            SelectedHostNameOrAddress = HostNameOrAddressList.FirstOrDefault();
        }
コード例 #2
0
        public RemoteAccess GetModel()
        {
            var remoteAccess = new RemoteAccess();
            remoteAccess.RemoteAccessType = RemoteAccessTypes.Find(x => x.IsActive).RemoteAccessType;
            if (remoteAccess.RemoteAccessType == RemoteAccessType.SelectivelyAllowed)
                remoteAccess.HostNameOrAddressList = new List<string>(HostNameOrAddressList.ToList());

            return remoteAccess;
        }