-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInBoxViewCell.cs
More file actions
65 lines (56 loc) · 1.56 KB
/
InBoxViewCell.cs
File metadata and controls
65 lines (56 loc) · 1.56 KB
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
63
64
65
using Foundation;
using System;
using UIKit;
using AccengageSDK;
namespace Xamarin_SDK_Sample.iOS
{
public partial class InBoxViewCell : UITableViewCell
{
public int index;
public InBoxViewCell (IntPtr handle) : base (handle)
{
}
public void setMessage(AccengageInboxMessage msg)
{
Subject.Text = msg.Title;
Content.Text = msg.Text;
Date.Text = InBoxTools.labelTextForDate(msg.Date);
string categorie = msg.Category;
Category.Text = (categorie != null) ? categorie : "";
Category.BackgroundColor = InBoxTools.colorForCategory(Category.Text);
if (msg.Read)
{
Subject.TextColor = UIColor.FromWhiteAlpha(0.4f, 1.0f);
Content.TextColor = UIColor.FromWhiteAlpha(0.4f, 1.0f);
StatusMessage.BackgroundColor = UIColor.White;
}
else
{
Subject.TextColor = UIColor.Black;
Content.TextColor = UIColor.Black;
StatusMessage.BackgroundColor = UIColor.FromRGB(0, 121, 255);
}
if (msg.Archived)
StatusMessage.BackgroundColor = UIColor.Red;
string iconUrl = msg.IconUrl;
if (iconUrl.Length > 0)
{
IconMsg.Hidden = false;
var request = NSUrlRequest.FromUrl(new NSUrl(iconUrl));
NSUrlConnection.SendAsynchronousRequest(request, NSOperationQueue.MainQueue,
(response, data, error) =>
{
if (error == null)
IconMsg.Image = UIImage.LoadFromData(data);
});
}
else
IconMsg.Hidden = true;
}
public void setLoading()
{
Subject.Text = "";
Content.Text = "";
}
}
}