Ejemplo n.º 1
0
        public void Edit(IFilter filter)
        {
            Debug.Assert(filter != null, "Filter must be supplied to allow editing.");

            var window = new AddEditFilterWindow();
            var data   = new AddEditFilter(window, true);

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

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

            var dialogResult = window.ShowDialog();

            if (dialogResult != null && (bool)dialogResult)
            {
                filter.Name    = data.Name;
                filter.Pattern = data.Pattern;
                filter.Mode    = data.Mode;
                filter.Field   = data.Field;
            }
        }
Ejemplo n.º 2
0
 public void Add()
 {
     var filterWindow = new AddEditFilterWindow();
     using (var data = new AddEditFilter(filterWindow, false))
     {
         filterWindow.DataContext = data;
         filterWindow.Owner = Application.Current.MainWindow;
         var dialogResult = filterWindow.ShowDialog();
         if (dialogResult != null && (bool)dialogResult)
         {
             var filter = Construct(data);
             if (filter != null)
             {
                 var service = ServiceLocator.Instance.Get<IFilteringService<IFilter>>();
                 service?.Filters.Add(filter);
             }
         }
     }
 }
Ejemplo n.º 3
0
 public void Add()
 {
     var filterWindow = new AddEditFilterWindow();
     using (var data = new AddEditFilter(filterWindow, false))
     {
         filterWindow.DataContext = data;
         filterWindow.Owner = Application.Current.MainWindow;
         var dialogResult = filterWindow.ShowDialog();
         if (dialogResult != null && (bool)dialogResult)
         {
             var filter = Construct(data);
             if (filter != null)
             {
                 var service = ServiceLocator.Instance.Get<IFilteringService<IFilter>>();
                 service?.Filters.Add(filter);
             }
         }
     }
 }
Ejemplo n.º 4
0
        public void Edit(IFilter filter)
        {
            Debug.Assert(filter != null, "Filter must be supplied to allow editing.");

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

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

            bool? dialogResult = window.ShowDialog();

            if (dialogResult != null && (bool)dialogResult)
            {
                filter.Name = data.Name;
                filter.Pattern = data.Pattern;
                filter.Mode = data.Mode;
                filter.Field = data.Field;
            }
        }