/// <summary> /// When each folder is backed up, some progress is reported. This method will get called each time. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { // The item we get passed in is the actual ListBoxItem // (contains the StackPanel and label for the folder name) ListBoxItem lbi = e.UserState as ListBoxItem; if (lbi != null) { // Get the stack panel so we can get to it's contents StackPanel sp = lbi.Content as StackPanel; if (sp != null) { // Get the image control and set our checked state. Image img = sp.Children[0] as Image; if (img != null) { img.Source = StarBackupHelper.ConvertGDI_To_WPF(Properties.Resources.Check); } } // Select the item and make sure its in view. This will give good feedback to the user // as we are going down the list and performing some operation on the items. listBox1.SelectedItem = lbi; listBox1.ScrollIntoView(lbi); } }
public StarBackupMain() { InitializeComponent(); // Images for the command link buttons BitmapSource backupBitmapSource = StarBackupHelper.ConvertGDI_To_WPF(Properties.Resources.Backup); BitmapSource restoreBitmapSource = StarBackupHelper.ConvertGDI_To_WPF(Properties.Resources.Restore); commandLink1.Icon = StarBackupHelper.CreateResizedImage(backupBitmapSource, 32, 32); commandLink2.Icon = StarBackupHelper.CreateResizedImage(restoreBitmapSource, 32, 32); }