Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Tuesday, 14 February 2012
( WPF )

image

A button, with code behind and a textbox…. familiar!

image

 

http://stackoverflow.com/questions/617939/wpf-frame-control  - scripts in page.

image

problem with scripts failing and causing an error.  So posted on SO to see if any solutions.

image

Solved here using reflection: http://www.brentlamborn.com/post/WPF-Web-Browser-ScriptErrorsSupressed.aspx

Responsive UI (BackgroundWorker)

So I can update my UI in real time, while the spider is off doing its thing, am testing out BackgroundWorker:

public partial class MainWindow : Window
    {
        BackgroundWorker worker = new BackgroundWorker();

        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            worker.DoWork += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            worker.RunWorkerAsync("http://www.stuff.co.nz");
            textBox1.Text = "done";
        }

        public void worker_DoWork(object sender, DoWorkEventArgs args)
        {
            string uri = (string)args.Argument;
            System.Threading.Thread.Sleep(4000);
            args.Result = 5;
        }

        public void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs args)
        {
            object result = args.Result;
        }

this keeps the UI responsive.

Adding to Source

git init

git add .

git commit –m ‘initial commit’

image

should probably work on another branch.

TODO – put in rest of presentation notes

| | #