Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Security.Credentials;
namespace SmartCharging.Common
{
class CredentialStorage
{
private string key = "SmartChargingKey";
public void SaveCredential(String username, string password)
{
var vault = new Windows.Security.Credentials.PasswordVault();
vault.Add(new Windows.Security.Credentials.PasswordCredential(
key, username, password));
}
public PasswordCredential GetCredential()
{
Windows.Security.Credentials.PasswordCredential credential = null;
try
{
var vault = new Windows.Security.Credentials.PasswordVault();
var credentialList = vault.FindAllByResource(key);
if (credentialList.Count >= 1)
{
credential = credentialList[0];
}
}
catch { }
return credential;
}
public void RemoveCredentials()
{
try
{
var vault = new Windows.Security.Credentials.PasswordVault();
var storedCreds = vault.FindAllByResource(key);
foreach (PasswordCredential pc in storedCreds)
{
vault.Remove(pc);
}
}
catch
{
}
}
}
}
|
Revision |
Author |
Commited |
Message |
660
|
JMBauan
|
Thu 03 Sep, 2015 08:14:10 +0000 |
|