TLSharp icon indicating copy to clipboard operation
TLSharp copied to clipboard

How I can keep login after close my windows app?

Open ahmedibrahimsaadmostafa opened this issue 3 years ago • 1 comments

How I can login after registration? I want login after close my windows app. By which method I can check in session file? this is my code

ahmedibrahimsaadmostafa avatar Jul 01 '21 22:07 ahmedibrahimsaadmostafa

I solved this problem like this:

var store = new FileSessionStore();
client = new TelegramClient(123456, "xxxxxxxxxxhhaasshhxxxxxxxxx", store);
await client.ConnectAsync();

if (!client.IsUserAuthorized())
{
     hash = await client.SendCodeRequestAsync(userNumber);
     CodeFromTG.IsEnabled = true;    //Button with a text box for entering a code
     AuthButton.IsEnabled = true;      //The button has its own click handler, it calls MakeAuthAsync where the third parameter is the code from the text box
}

asvdvl avatar Jul 05 '21 10:07 asvdvl