-
Notifications
You must be signed in to change notification settings - Fork 3
/
CloudConnectViewController.cs
87 lines (77 loc) · 2.77 KB
/
CloudConnectViewController.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MPfm.iOS.Classes.Controllers.Base;
using MPfm.MVP.Views;
using MPfm.MVP.Models;
using MPfm.MVP.Bootstrap;
using MPfm.MVP.Navigation;
namespace MPfm.iOS
{
public partial class CloudConnectViewController : BaseViewController, ICloudConnectView
{
public CloudConnectViewController()
: base (UserInterfaceIdiomIsPhone ? "CloudConnectViewController_iPhone" : "CloudConnectViewController_iPad", null)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
activityIndicator.StartAnimating();
btnOK.TitleLabel.Text = "Cancel";
btnOK.SetImage(UIImage.FromBundle("Images/Buttons/cancel"));
viewPanel.Layer.CornerRadius = 8;
var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
navigationManager.BindCloudConnectView(this);
}
partial void actionOK(NSObject sender)
{
WillMoveToParentViewController(null);
UIView.Animate(0.2f, () => {
this.View.Alpha = 0;
}, () => {
View.RemoveFromSuperview();
RemoveFromParentViewController();
});
}
#region ICloudConnectView implementation
public Action OnCheckIfAccountIsLinked { get; set; }
public void CloudConnectError(Exception ex)
{
ShowErrorDialog(ex);
}
public void RefreshStatus(CloudConnectEntity entity)
{
InvokeOnMainThread(() =>
{
if(entity.HasAuthenticationFailed)
{
lblStatus.Hidden = true;
lblStatusCenter.Hidden = false;
lblStatusCenter.Text = "Authentication failed.";
btnOK.TitleLabel.Text = "OK";
btnOK.SetImage(UIImage.FromBundle("Images/Buttons/select"));
btnOK.UpdateLayout();
activityIndicator.Hidden = true;
}
else if(entity.IsAuthenticated)
{
lblStatus.Hidden = true;
lblStatusCenter.Hidden = false;
lblStatusCenter.Text = "Authentication successful!";
btnOK.TitleLabel.Text = "OK";
btnOK.SetImage(UIImage.FromBundle("Images/Buttons/select"));
btnOK.UpdateLayout();
activityIndicator.Hidden = true;
}
else
{
lblStatus.Hidden = false;
lblStatusCenter.Hidden = true;
}
});
}
#endregion
}
}