示例#1
0
        public async Task TryLogin(bool force_login = false)
        {
            try
            {
                if (!force_login && File.Exists("./cache.auth"))
                {
                    API.ApplyAuth("5d79baff-c3fd-4023-a1ab-502eb1b95725", File.ReadAllText("./cache.auth"));
                }
                else
                {
                    await API.Login("5d79baff-c3fd-4023-a1ab-502eb1b95725", "8397121f-8fa4-495e-85b9-e2b023f6b285");

                    File.WriteAllText("./cache.auth", API.Token);
                }
            }
            catch (LayestaWebAPIException ex)
            {
                ErrorWindow.ShowException(ex, true);
            }
            catch (Exception ex)
            {
                ErrorWindow.ShowException(ex, true);
            }
        }