Exemplo n.º 1
0
        public void Edit(IExtractor extractor)
        {
            Debug.Assert(extractor != null, "Extractor must be supplied to allow editing.");

            var window = new AddEditExtractorWindow();
            var data   = new AddEditExtractor(window, true);

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

            data.Name    = extractor.Name;
            data.Field   = extractor.Field;
            data.Pattern = extractor.Pattern;
            data.Mode    = extractor.Mode;

            bool?dialogResult = window.ShowDialog();

            if (dialogResult != null && (bool)dialogResult)
            {
                extractor.Name    = data.Name;
                extractor.Pattern = data.Pattern;
                extractor.Mode    = data.Mode;
                extractor.Field   = data.Field;
            }
        }
Exemplo n.º 2
0
        public void Add()
        {
            var extractorWindow = new AddEditExtractorWindow();

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

                var dialogResult = extractorWindow.ShowDialog();
                if (dialogResult == null || !(bool)dialogResult)
                {
                    return;
                }

                var extractor = Construct(data);
                if (extractor == null)
                {
                    return;
                }

                var service = ServiceLocator.Instance.Get <IExtractingService <IExtractor> >();
                service?.Extractors.Add(extractor);
            }
        }
Exemplo n.º 3
0
 public void Add()
 {
     AddEditExtractorWindow extractorWindow = new AddEditExtractorWindow();
     using (AddEditExtractor data = new AddEditExtractor(extractorWindow, false))
     {
         extractorWindow.DataContext = data;
         extractorWindow.Owner = Application.Current.MainWindow;
         bool? dialogResult = extractorWindow.ShowDialog();
         if (dialogResult != null && (bool)dialogResult)
         {
             Extractor extractor = Construct(data);
             if (extractor != null)
             {
                 var service = ServiceLocator.Instance.Get<IExtractingService<IExtractor>>();
                 if (service != null)
                 {
                     service.Extractors.Add(extractor);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        public void Add()
        {
            AddEditExtractorWindow extractorWindow = new AddEditExtractorWindow();

            using (AddEditExtractor data = new AddEditExtractor(extractorWindow, false))
            {
                extractorWindow.DataContext = data;
                extractorWindow.Owner       = Application.Current.MainWindow;
                bool?dialogResult = extractorWindow.ShowDialog();
                if (dialogResult != null && (bool)dialogResult)
                {
                    Extractor extractor = Construct(data);
                    if (extractor != null)
                    {
                        var service = ServiceLocator.Instance.Get <IExtractingService <IExtractor> >();
                        if (service != null)
                        {
                            service.Extractors.Add(extractor);
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void Edit(IExtractor extractor)
        {
            Debug.Assert(extractor != null, "Extractor must be supplied to allow editing.");

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

            data.Name = extractor.Name;
            data.Field = extractor.Field;
            data.Pattern = extractor.Pattern;
            data.Mode = extractor.Mode;

            var dialogResult = window.ShowDialog();

            if (dialogResult != null && (bool)dialogResult)
            {
                extractor.Name = data.Name;
                extractor.Pattern = data.Pattern;
                extractor.Mode = data.Mode;
                extractor.Field = data.Field;
            }
        }
Exemplo n.º 6
0
        public void Add()
        {
            var extractorWindow = new AddEditExtractorWindow();
            using (var data = new AddEditExtractor(extractorWindow, false))
            {
                extractorWindow.DataContext = data;
                extractorWindow.Owner = Application.Current.MainWindow;

                var dialogResult = extractorWindow.ShowDialog();
                if (dialogResult == null || !(bool)dialogResult)
                {
                    return;
                }

                var extractor = Construct(data);
                if (extractor == null)
                {
                    return;
                }

                var service = ServiceLocator.Instance.Get<IExtractingService<IExtractor>>();
                service?.Extractors.Add(extractor);
            }
        }