Beispiel #1
0
        public IndexingPolicyViewModel(IndexingPolicy policy)
        {
            _isCreating = true;

            // deep clone the indexing policy
            var json = JsonConvert.SerializeObject(policy);

            Policy = JsonConvert.DeserializeObject <IndexingPolicy>(json);

            _isCreating = false;

            IncludedPaths.ListChanged += (s, e) =>
            {
                if (IncludedPaths.All(ip => !ip.HasErrors))
                {
                    RaisePropertyChanged(nameof(IncludedPaths));
                }
            };

            ExcludedPaths.ListChanged += (s, e) =>
            {
                if (ExcludedPaths.All(ep => !ep.HasErrors))
                {
                    RaisePropertyChanged(nameof(ExcludedPaths));
                }
            };

            PropertyChanged += (s, e) =>
            {
                if (e.PropertyName != nameof(IsValid))
                {
                    RaisePropertyChanged(nameof(IsValid));
                }
            };
        }