-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rater.cs
62 lines (55 loc) · 1.29 KB
/
Rater.cs
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
60
61
62
using System;
using System.Threading.Tasks;
namespace ShishaBacon
{
public class Rater
{
public const string DefaultName = "Unknown";
private string name;
public string Name
{
get
{
return name;
}
set
{
name = value.Trim();
}
}
public Rater(string name)
{
Name = name;
}
public override bool Equals(object obj)
{
if (obj.GetType() != GetType())
{
return false;
}
return ((Rater)obj).Name == Name;
}
}
static class RaterSaved
{
private static Rater raterr = new Rater(Rater.DefaultName);
public async static void Init(Action callback)
{
var ret = await Storage.GetRater();
if (ret != null)
{
raterr = ret;
}
callback?.Invoke();
}
public static Rater GetRater()
{
return raterr;
}
public static void SetRater(Rater rater)
{
raterr = rater;
Storage.SetRater(raterr);
}
}
}