public void Serialize(WatchThreadManager argWatchThreadManager, DownloadManager argDownloadManager)
 {
     try {
     XmlSerializer serializer = new XmlSerializer(typeof(WatchThreadManager));
     TextWriter textWriter = new StreamWriter(this.serializeFilePath);
     serializer.Serialize(textWriter, argWatchThreadManager);
     textWriter.Close();
       } catch (Exception exception) {
     MessageBox.Show("Error in WatchThreadSerializer Serialize.\r\n" + exception.Message);
       }
 }
 public WatchThreadSerializer(WatchThreadManager argWatchThreadManager, DownloadManager argDownloadManager, DispatchedObservableCollection<WatchThreadViewItem> argwatchThreadViewCollection)
 {
     this.debugLogText = new DebugLog();
       this.watchThreadManager = argWatchThreadManager;
       this.downloadManager = argDownloadManager;
       this.watchThreadViewCollection = argwatchThreadViewCollection;
       string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString(), "InBefore404");
       try {
     Directory.CreateDirectory(path);
       } catch {
       }
       this.serializeFilePath = Path.Combine(path, "WatchThreadList.xml");
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try {
            System.Windows.Data.Binding binding = new System.Windows.Data.Binding("TheLog")
            {
              Source = this.debugLogText
            };
            this.txtDebug.SetBinding(System.Windows.Controls.TextBox.TextProperty, binding);
            this.theWatchManager = new WatchThreadManager();
            this.theDownloadManager = new DownloadManager();
            this.theDownloadManager.RegisterDebugLog(ref this.debugLogText);
            this.theDownloadManager.RegisterDownloadTaskViewCollection(this.DownloadTaskViewCollection);
            this.theDownloadManager.RefreshDownloadListViewCallback = new RefreshDownloadListDelegate(this.RefreshDownloadsListView);
            this.theWatchManager.RegisterDebugLog(this.debugLogText);
            this.theWatchManager.RegisterDownloadManager(this.theDownloadManager);
            this.theWatchManager.RegisterWatchThreadViewCollection(this.WatchThreadViewCollection);
            this.theWatchManager.RefreshListViewCallback = new RefreshWatchListDelegate(this.RefreshWatchThreadsListView);
            this.wts = new WatchThreadSerializer(this.theWatchManager, this.theDownloadManager, this.WatchThreadViewCollection);
            this.wts.RefreshListViewCallback = this.theWatchManager.RefreshListViewCallback;
            this.wts.debugLogText = this.debugLogText;

            lvWatchList.ItemsSource = WatchThreadViewCollection;
            lvDownloadManager.ItemsSource = DownloadTaskViewCollection;

            if (Properties.Settings.Default.AutoLoadWatchList) {
              try {
            this.theWatchManager = this.wts.Deserialize();
              } catch {
              }
            }
            if (Properties.Settings.Default.MinimizeToTray) {
              this.CreateNotifyIcon();
            }
              } catch (Exception exception) {
            System.Windows.MessageBox.Show("Error Creating Watch Manager\r\n" + exception.Message);
            System.Windows.Application.Current.Shutdown();
              }
              try {
            this.txtURL.Focus();
              } catch {
              }
        }
Example #4
0
 public DownloaderTask(DownloadItem argDownloadItem, DownloadManager argDownloadManager, Mutex argMutex)
 {
     mutexNotify          = argMutex;
     this.downloadItem    = argDownloadItem;
     this.downloadManager = argDownloadManager;
 }
 public DownloaderTask(DownloadItem argDownloadItem, DownloadManager argDownloadManager, Mutex argMutex)
 {
     mutexNotify = argMutex;
       this.downloadItem = argDownloadItem;
       this.downloadManager = argDownloadManager;
 }
 public void RegisterDownloadManager(DownloadManager argDownloadManager)
 {
     this.theDownloadManager = argDownloadManager;
 }
 public void RegisterDownloadManager(DownloadManager argDownloadManager)
 {
     this.theDownloadManager = argDownloadManager;
 }
Example #8
0
 public void SetupAfterDeSerialize(DownloadManager argDLManager, WatchThreadManager argWatchThreadManager, RefreshWatchListDelegate argRefreshListViewCallback)
 {
     try {
     this.threadStatus = 2;
     this.thread404d = false;
     this.updatingHtml = false;
     this.checkLocalFiles = true;
     this.isRunning = false;
     this.RefreshListViewCallback = argRefreshListViewCallback;
     this.downloadManager = argDLManager;
     this.watchThreadManager = argWatchThreadManager;
     this.threadURI = new Uri(this.threadURL);
     this.RegisterDebugLog(argWatchThreadManager.debugLogText);
     this.SetupViewItem();
     this.StartRunning();
       } catch (Exception exception) {
     MessageBox.Show("Error in SetupAfterDeSerialize.\r\n" + exception.Message);
       }
 }
Example #9
0
 public WatchThread(DownloadManager argDLManager, WatchThreadManager argWatchThreadManager)
     : this()
 {
     try {
     this.downloadManager = argDLManager;
     this.watchThreadManager = argWatchThreadManager;
       } catch (Exception exception) {
     MessageBox.Show("Error in WatchThread constructor, throwing.\r\n" + exception.Message);
     throw exception;
       }
 }