Calling a function from the main thread and working in parallel with a function in the main thread (part 2)

thnx for all your repeats. i tried your options and i want to ask if this is correct and if there are 2 threads working in parallel or not.

and here is my code:

// in Form.Load ()

        Timer1.Enabled = true;
        Timer1.Start();

        if (InvokeRequired)
        {
            Invoke(new GetFromServerHandler(GetFromServer));
            Invoke(new GetFromPCHandler(GetFromPC));
        }
        else
        {
            ServerQuranTreeView.Nodes.Clear();
            GetFromServer();
            GetFromPC();
        }

      

// other 2 functions that are delegate and function (GetFromServer) and (GetFromPC)

    private delegate void GetFromServerHandler(); 
    private void GetFromServer()
    {
    }

    private delegate void GetFromPCHandler(); 
    private void GetFromPC()
    {
    }

      

// now it takes a few seconds for the app to start (and I explained that this time it took data from the server)

is this correct or am I missing anything?

thnx in advance

-1


source to share


1 answer


I really don't understand what you are trying to do here: S Please clarify. At least I can tell that you usually don't need to reference the Form_Load handler.

And you really need to fix your post tags, they need to be descriptive for your question, i.e. something like C # threading invoke.



You have to help us help you. And by the way, if you already asked a question on this topic, you could post a link to that question.

+1


source







All Articles