Beispiel #1
0
        public MediaWatcher(PhoenixDBAL connection) : base()
        {
            _conn         = connection;
            this.Renamed += OnFileRenamed;
            this.Created += OnFileCreated;
            this.Deleted += OnFileDeleted;
            this.Changed += OnFileChanged;

            IncludeSubdirectories = true;
            this.Filter           = "*.*";
            this.NotifyFilter     = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.Size |
                                    NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.CreationTime |
                                    NotifyFilters.Attributes;
        }
        public MainWindow()
        {
            this._mediaDir = ConfigurationManager.AppSettings["MediaDir"];
            this.Closed   += (s, e) => Application.Current.Shutdown();

            _conn = new PhoenixDBAL(ConfigurationManager.ConnectionStrings["PhoenixDBAL"].ConnectionString);

            _watcher = new MediaWatcher(_conn)
            {
                Path = _mediaDir, EnableRaisingEvents = true
            };

            _overwatch = new MediaGTWOF(_mediaDir)
                         .AttachWatcher(_watcher);
            //.SetRaisingEvents(true);

            InitializeComponent();

            Entry();
        }