It is an odd announcement that causes me to hijack my daughters Kindle Fire and Laptop. But I really wanted a sense of how this felt. After downloading the Send to Kindle desktop application onto the laptop and configuring it to use her Amazon account a print option 'Send to Kindle" appears in most applications. The most interesting place is in Word.
In many ways this functions in a manner similar to 'Save as PDF'. The format of what is printed is converted to a format that Kindle can display. The next step is the file is forwarded to Amazons cloud and then forwarded on to the kindle. But this all happens without the user comprehending or needing to comprehending how it occurs.
The result is the document appears on her Kindle. Which means she is now in a position to develop content for the Kindle with minimal effort. Furthermore, this will expand. The end goal is her Kindle becomes the most import device. And it has taken on the role of presenter of her cloud based Amazon account which starts to position itself as the ITunes of information stores.
Sunday, January 15, 2012
Friday, January 13, 2012
Winform Background Thread
The easiest way to implement a background worker thread for a form in a Winform application is to use the BackgroundWorker from the System.ComponentModel namespace.
To summarize the changes imagine you have a form were you dropped a button with the default name 'button1'.
- From the toolbox open the component section.
- Select BackgroundWorker and drag it onto the form.
- The default name will be 'backgroundWorker1'.
- Select the backgroundWorker object and inspect its properties.
- Select the Events (it looks like a lightning bolt)
- Doubleclick in the space next to 'DoWork'
- Keep default name: backgroundWorker1_DoWork
- Doubleclick in the space next to 'ProgressChanged'
- Keep default name: backgroundWorker1_ProgressChanged
- Doubleclick in the space next to 'RunWorkerCompleted'
- backgroundWorker1_RunWorkerCompleted
- Button Click Code Handlerprivate void button1_Click(object sender, EventArgs e)
{
this.backgroundWorker1.RunWorkerAsync("From Form");button1.Enabled = false;}
- Background DoWork Handlerprivate void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
Thread.Sleep(1000);string comment = (string) e.Argument;backgroundWorker1.ReportProgress(12, comment + " From Background");Thread.Sleep(10000);}
- ProgressChanged Handler
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
string report = (string)e.UserState;listBox1.Items.Add("From Progress Change Hander");listBox1.Items.Add(report);}
- RunWorkerCompleted Handler
{
button1.Enabled = true;}
Implementation Versions: This code was developed and tested with Visual Studio 2010, C# 4.0 and the .Net Framework 4 Client Profile.
Subscribe to:
Posts (Atom)