Hello,
I use the following code to Invoke and access properties on my from from a different thread.
public static void PFA(Action<frmain> action)
{
var form = Form.ActiveForm as frmain;
if (form != null)
{
form.PerformAction(action);
}
}
public void PerformAction(Action<frmain> action)
{
if (InvokeRequired)
Invoke(action, this);
else
action(this);
}
My Question:
If I call PFA(form => form.Richbox1.Text = "Test")
- I want PFA() to check if the action is (Richbox1.Text) and if so then Add "\n" to the text("Test").
The Idea is to call
PFA(form => form.Richbox1.Text = "Test");
instead of
PFA(form => form.Richbox1.Text = "Test\n");
In other words I want to add a new line automaticly if the action is "Richbox1.Text ="
How I do that? I never worked with actions before.