Пример #1
0
        public void Edit(IClassifier classifier)
        {
            Debug.Assert(classifier != null, "Extractor must be supplied to allow editing.");

            var window = new AddEditClassifierWindow();
            var data   = new AddEditClassifier(window, true);

            window.DataContext = data;
            window.Owner       = Application.Current.MainWindow;

            data.Name    = classifier.Name;
            data.Field   = classifier.Field;
            data.Pattern = classifier.Pattern;
            data.Mode    = classifier.Mode;
            data.Type    = classifier.Type;

            var dialogResult = window.ShowDialog();

            if (dialogResult != null && (bool)dialogResult)
            {
                classifier.Name    = data.Name;
                classifier.Pattern = data.Pattern;
                classifier.Mode    = data.Mode;
                classifier.Field   = data.Field;
                classifier.Type    = data.Type;
            }
        }
Пример #2
0
        public void Edit(IClassifier classifier)
        {
            Debug.Assert(classifier != null, "Extractor must be supplied to allow editing.");

            var window = new AddEditClassifierWindow();
            var data = new AddEditClassifier(window, true);
            window.DataContext = data;
            window.Owner = Application.Current.MainWindow;

            data.Name = classifier.Name;
            data.Field = classifier.Field;
            data.Pattern = classifier.Pattern;
            data.Mode = classifier.Mode;
            data.Type = classifier.Type;

            bool? dialogResult = window.ShowDialog();

            if (dialogResult != null && (bool)dialogResult)
            {
                classifier.Name = data.Name;
                classifier.Pattern = data.Pattern;
                classifier.Mode = data.Mode;
                classifier.Field = data.Field;
                classifier.Type = data.Type;
            }
        }
Пример #3
0
        public void Add()
        {
            var classifierWindow = new AddEditClassifierWindow();
            using (var data = new AddEditClassifier(classifierWindow, false))
            {
                classifierWindow.DataContext = data;
                classifierWindow.Owner = Application.Current.MainWindow;

                var dialogResult = classifierWindow.ShowDialog();
                if (dialogResult != null && (bool)dialogResult)
                {
                    var classifier = Construct(data);
                    if (classifier != null)
                    {
                        var service = ServiceLocator.Instance.Get<IClassifyingService<IClassifier>>();
                        service?.Classifiers.Add(classifier);
                    }
                }
            }
        }
        public void Add()
        {
            var classifierWindow = new AddEditClassifierWindow();

            using (var data = new AddEditClassifier(classifierWindow, false))
            {
                classifierWindow.DataContext = data;
                classifierWindow.Owner       = Application.Current.MainWindow;

                var dialogResult = classifierWindow.ShowDialog();
                if (dialogResult != null && (bool)dialogResult)
                {
                    var classifier = Construct(data);
                    if (classifier != null)
                    {
                        var service = ServiceLocator.Instance.Get <IClassifyingService <IClassifier> >();
                        service?.Classifiers.Add(classifier);
                    }
                }
            }
        }