Alpha-Stadium

The project is currently in alpha-stadium. This means, the current main-work is targetting the basic infrastructure-components.

Important

A project which adds a reference to cfThreadingTools needs to have references to System.Windows.Forms.dll and PresentationFramework.dll!

Overview

The library uses reflection for parsing the control-objects for properties and methods. All the main-logic is centralized in a class named BaseTools. This class provides 4 static methods which are public:
  • SetPropertyValue
  • SetSubPropertyValue
  • InvokeMethod
  • InvokeSubMethod
SetPropertyValue and InvokeMethod are designed for those situations where the property or method is member of the control itself. For instance the Enabled-property is part of a ListView where Items.Count is not, because it demands the object Items which is a member of ListView. For the Items.Count-setter the SetSubPropertyValue-method was implemented.

Beside this whery rudimentary base class a set of extension classes is built in. The goal is to implement an extension for each control in the default System.Windows.Forms namespace. These extensions will be worked out during the next releases.

Examples

Setting the Enabled-state of a control

using de.codingfreaks.libs.cfThreadingTools;
void SomeMethod()
{
    BaseTools.SetPropertyValue(textBox1, 'Enabled', true);
}

Adding a ListViewItem to a ListView with Clear before add

using de.codingfreaks.libs.cfThreadingTools;
void SomeMethod()
{
    BaseTools.SetInvokeSubMethod(listView1, listView.Items, 'Clear');
    BaseTools.SetInvokeSubMethod(listView1, listView.Items, 'Add', new ListViewItem('Hello));
}

Setting the Enabled-state of a TextBox using extensions

using de.codingfreaks.libs.cfThreadingTools;
void SomeMethod()
{
    textBox1.EnableThreadSafe();
}

Last edited May 3, 2010 at 2:58 PM by sprinter252, version 2

Comments

No comments yet.