Exemplo n.º 1
0
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     _backupAndRestorePosition.Dispose();
     _backupAndRestorePosition = null;
     (DataContext as IDisposable)?.Dispose();
     DataContext = null;
 }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            var bus = new NotificationBus();

            DataContext = new MainViewModel(bus);

            var systemEvents = BackupEventTypeCreator.CreateFromSystemEvents(bus);

            systemEvents = Observable.Timer(TimeSpan.Zero, TimeSpan.FromMinutes(1))
                           .Select(_ => BackupAndRestorePosition.EventType.Backup)
                           .Merge(systemEvents);

            var collector = new PositionWindowsByProcessCollector();

            var excludedProcesses = LoadExcludedProcesses();


            _backupAndRestorePosition = new BackupAndRestorePosition(systemEvents, collector, new PostionRestoreOperator(bus),
                                                                     excludedProcesses, bus);
        }