public MainWindow()
        {
            InitializeComponent();

            Keeper.Load();
            entitiesControl.Load();
            typesControl.Load();

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.RollingFile("logs/log.txt", retainedFileCountLimit: 7, restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Verbose)
                         .WriteTo.Sink(new PopupEventSink(this), restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Warning)
                         .CreateLogger();

            Log.Information("Started");

            fromDatePicker.SelectedDate = DateTime.Now.AddMonths(-1);
            toDatePicker.SelectedDate   = DateTime.Now;



            foreach (TabItem p in pagesTabControl.Items)
            {
                if (p.Content is IUpdatableControl)
                {
                    (p.Content as IUpdatableControl).Changed += (x, y) =>
                    {
                        writeDBButton.IsEnabled = true;
                    };
                }
            }



            #region Filter

            var selectAll = new MenuItem()
            {
                Header = "Select/Deselect all"
            };
            TypeFilter.Items.Add(selectAll);

            selectAll.IsChecked        = true;
            selectAll.StaysOpenOnClick = true;

            selectAll.Click += (x, y) =>
            {
                bool sel = !selectAll.IsChecked;

                foreach (MenuItem t in TypeFilter.Items)
                {
                    t.IsChecked = sel;
                }

                ApplyTypeFilter();
            };

            List <OperationType> types = new List <OperationType>();

            types.AddRange(DAL.GetOperationTypes());
            types.Add(OperationType.Empty);

            foreach (var t in types)
            {
                var tf = new TypeFilterMenuItem(t);
                tf.IsChecked        = true;
                tf.StaysOpenOnClick = true;
                tf.Click           += (x, y) => tf.IsChecked = !tf.IsChecked;
                tf.Click           += (x, y) => ApplyTypeFilter();

                TypeFilter.Items.Add(tf);
            }

            ApplyTypeFilter();

            #endregion
        }