Autor Beitrag
Cäptin Pommes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 142
Erhaltene Danke: 2



BeitragVerfasst: Do 08.03.12 17:58 
hi,

ich wollte mit
ausblenden C#-Quelltext
1:
workBench.Invoke(new System.Windows.Forms.MethodInvoker(workBench.SetProgressMax), new Object[] {newDirs.Count - previewCount});					

die Methode aufrufen und die Parameter übergeben ... so ist auch das beispiel in der MSDN
ich bekomm aber die Meldung das keine Überladung der SetProgressMax Methode übereinstimmt :/
die Methode verlangt einfach nur nen int als Parameter
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19341
Erhaltene Danke: 1752

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 08.03.12 18:19 
Also bei mir sieht das Beispiel "ein wenig" anders aus. :gruebel:
msdn.microsoft.com/d...s.methodinvoker.aspx hat folgendes geschrieben:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
public partial class Form1 : Form
{
    public Form1()
    {
        // Create a timer that will call the ShowTime method every second.
        var timer = new System.Threading.Timer(ShowTime, null01000);           
    }

    private void ShowTime(object x)
    {
        // Don't do anything if the form's handle hasn't been created 
        // or the form has been disposed.
        if (!this.IsHandleCreated && !this.IsDisposed) return;

        // Invoke an anonymous method on the thread of the form.
        this.Invoke((MethodInvoker) delegate
        {
            // Show the current time in the form's title bar.
            this.Text = DateTime.Now.ToLongTimeString();
        });

    }
}
Cäptin Pommes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 142
Erhaltene Danke: 2



BeitragVerfasst: Do 08.03.12 18:43 
ähh ja hab grad selbst gemaerkt ^^ ... ich hab da sachen durcheinander gebracht sry ... habs aber auch grad so hinbekommen :)