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");
 }
 public WatchThreadManager Deserialize()
 {
     if (!File.Exists(this.serializeFilePath)) {
     throw new Exception("File Not Found on deserialize");
       }
       this.watchThreadManager = new WatchThreadManager();
       try {
     XmlSerializer serializer = new XmlSerializer(typeof(WatchThreadManager));
     TextReader textReader = new StreamReader(this.serializeFilePath);
     this.watchThreadManager = (WatchThreadManager)serializer.Deserialize(textReader);
     textReader.Close();
     this.watchThreadManager.DeleteAllHiddenThreads();
     this.watchThreadManager.RefreshListViewCallback = this.RefreshListViewCallback;
     this.watchThreadManager.RegisterWatchThreadViewCollection(this.watchThreadViewCollection);
     this.watchThreadManager.RegisterDownloadManager(this.downloadManager);
     this.watchThreadManager.RegisterDebugLog(this.debugLogText);
     this.watchThreadManager.SetupAfterDeSerialize();
       } catch (Exception exception) {
     throw new Exception("Error in WatchThreadSerializer Deserialize.\r\n" + exception.Message);
       }
       return this.watchThreadManager;
 }
        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 {
              }
        }
 private void menuLoadWatchList_Click(object sender, RoutedEventArgs e)
 {
     try {
     this.theWatchManager = this.wts.Deserialize();
       } catch (Exception exception) {
     System.Windows.MessageBox.Show("Error Loading Watch List.\r\n" + exception.Message);
       }
 }
Example #6
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 #7
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;
       }
 }