Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Which session triggered the event?

I’m trying to use 2 sessions.

If I understood the FAQ correctly, I should do it like this.

    static async Task Main(string[] _)
    {
        Helpers.Log = (l, s) => Debug.WriteLine(s);
        Clients.Add(new Client(what => Config(what, "session1")));
        Clients.Add(new Client(what => Config(what, "session2")));

        for (int i = 0; i < Clients.Count; i++)
        {
            Clients[i].OnUpdate += Client_OnUpdate;
            MyUsers.Add(new User());
            MyUsers[i] = await Clients[i].LoginUserIfNeeded();
            var dialogs = await Clients[i].Messages_GetAllDialogs();
            dialogs.CollectUsersChats(Users, Chats);
        }

        Console.ReadKey();
    }

But I can’t figure out which session I’m getting the message from. How can I understand this ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In IObject arg I could not find this information, because I do not have enough knowledge(

Client_OnUpdate(IObject arg)

>Solution :

modify your Client_OnUpdate to take an extra i argument, and register it like that:

Clients[i].OnUpdate += updates => Client_OnUpdate(updates, i)

You might want to learn more about lambda expressions…

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading