Exemple #1
0
        public void SecretFailTest()
        {
            client = new PinboardClient("xafdsafdsfdsfasdfasd", "hogehoge");
            var completion = new ManualResetEvent(false);

            client.GetUserSecret().Subscribe(result =>
            {
                Assert.IsNull(result);
                completion.Set();
            });

            completion.WaitOne();
        }
Exemple #2
0
 public IObservable <bool> Login(string account, string password)
 {
     client = new PinboardClient(account, password);
     return(client.GetUserSecret()
            .Select(secret =>
     {
         if (string.IsNullOrEmpty(secret))
         {
             return false;
         }
         else
         {
             SettingsService.SaveAccountInfo(account, password, secret);
             return true;
         }
     }));
 }
Exemple #3
0
        public void SecretTest()
        {
            InitializeClient();
            var completion = new ManualResetEvent(false);

            client.GetUserSecret().
            Subscribe(result =>
            {
                Assert.IsNotNull(result);
                client = new PinboardClient("aaa", "bakdajflajf");
                client.GetUserSecret()
                .Subscribe(aaa =>
                {
                    Assert.IsNull(aaa);
                    completion.Set();
                }, () => Console.WriteLine("comp2"));
            }, () => Console.WriteLine("comp1"));

            completion.WaitOne();
        }
Exemple #4
0
        public IObservable <bool> IsLogin()
        {
            if (!SettingsService.Contains(Consts.AccountKey) || !SettingsService.Contains(Consts.PasswordKey))
            {
                return(new BehaviorSubject <bool>(false));
            }

            client = new PinboardClient(SettingsService.LoadSettingOrDefault <string>(Consts.AccountKey),
                                        SettingsService.LoadSettingOrDefault <string>(Consts.PasswordKey));
            return(client.GetUserSecret()
                   .Select(s =>
            {
                if (string.IsNullOrEmpty(s))
                {
                    return false;
                }
                else
                {
                    SettingsService.SaveSetting(Consts.SecretKey, s);
                    return true;
                }
            }));
        }
Exemple #5
0
 private void InitializeClient()
 {
     client = new PinboardClient("monoXi", "hogehoge");
 }