Beispiel #1
0
        private void initializeFileWatch()
        {
            if (!checkTOU())
            {
                return;
            }

            var downloads = KnownFoldersNativeMethods.GetDownloadPath();

            if (downloads == null)
            {
                this.updateStatus("oops, can't find the `Downloads` folder");
                return;
            }

            this.watcher                     = new FileSystemWatcher(downloads);
            this.watcher.Renamed            += (sender, e) => this.handleFileEvent(e);
            this.watcher.Created            += (sender, e) => this.handleFileEvent(e);
            this.watcher.EnableRaisingEvents = true;

            this.waitingForHexFileStatus();
        }
        public MainWindow()
        {
            InitializeComponent();
            this.DeleteOnFlash = true;
            this.updateStatus("loading...");
            var downloads = KnownFoldersNativeMethods.GetDownloadPath();

            if (downloads == null)
            {
                this.updateStatus("oops, can't find the Downloads folder");
                return;
            }

            var watcher = new FileSystemWatcher(downloads);

            watcher.Renamed            += (sender, e) => handleFileEvent(e);
            watcher.Created            += (sender, e) => handleFileEvent(e);
            watcher.EnableRaisingEvents = true;

            this.updateStatus("Waiting for .hex file...");
            this.handleActivation();
        }