Exemplo n.º 1
0
        public UpdateHandler(MainWindow newParent)
        {
            parent = newParent;

            detectPIDthread = new Thread(SyncPhotos);
            detectPIDthread.SetApartmentState(ApartmentState.STA);
            uploadThread = new Thread(UploadPhotos);
            uploadThread.SetApartmentState(ApartmentState.STA);
            downloadThread = new Thread(DownloadPhotos);
            downloadThread.SetApartmentState(ApartmentState.STA);
        }
Exemplo n.º 2
0
        public UpPhotoGUI(MainWindow newParent)
        {
            Application.EnableVisualStyles();

            parent = newParent;

            UpPhotoTrayMenu = new ContextMenuStrip(components);
            UpPhotoTrayMenu.SuspendLayout();

            UpPhotoTrayMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[]
            {
                AboutItem,
                ViewItem,
                ExitItem,
                DownloadPhotosItem
            });

            AboutItem.Text = "About UpPhoto";
            AboutItem.Click += (x, y) => { Process.Start(@"http://www.upphoto.ca/instructions.php"); };

            ViewItem.Text = "View UpPhoto folder";
            ViewItem.Click += ViewItem_Click;

            ExitItem.Text = "Exit";
            ExitItem.Click += ExitItem_Click;

            DownloadPhotosItem.Text = "Download my photos from Facebook";
            DownloadPhotosItem.CheckOnClick = true;
            DownloadPhotosItem.Checked = false;

            UpPhotoIcon = new NotifyIcon(components);
            UpPhotoIcon.ContextMenuStrip = UpPhotoTrayMenu;
            UpPhotoIcon.Text = "UpPhoto";
            UpPhotoIcon.Visible = true;
            UpPhotoIcon.MouseClick += TrayIcon_Click;
            UpPhotoIcon.DoubleClick += ViewItem_Click;

            UpPhotoIcon.BalloonTipTitle = "Thank you for using UpPhoto!";
            UpPhotoIcon.BalloonTipText = "Click on this icon to view your UpPhoto folder. Put photos in the folder, and they will be uploaded to Facebook.";

            UpPhotoTrayMenu.ResumeLayout(true);
        }
Exemplo n.º 3
0
        public WatchedFolder(string path, MainWindow newParent)
        {
            parent = newParent;
            handler = parent.updateHandler;

            watcher = new FileSystemWatcher(path);
            watcher.Filter = "*.*";
            watcher.IncludeSubdirectories = true;
            watcher.NotifyFilter = NotifyFilters.FileName |
                                   NotifyFilters.DirectoryName |
                                   NotifyFilters.LastAccess;

            watcher.SynchronizingObject = parent.gui;

            watcher.Changed += FileChangedEvent;
            watcher.Created += FileCreatedEvent;

            watcher.InternalBufferSize = 64000;
            watcher.EnableRaisingEvents = true;
        }