public override bool FinishedLaunching(UIApplication app, NSDictionary options) { var window = new AppWindow(); // create and start the main view controller. window.Start(new ConnectView(window)); return(true); }
public MessageListView(AppWindow window) : base(new RootElement("Select"), true) { _window = window; CopyMessages(); ListMessages(); }
public MessageDetailsView(AppWindow window, string fileName) : base(new RootElement(fileName == null ? "New Message" : fileName), true) { try { _window = window; MailMessage msg = fileName == null ? null : new MailMessage(Path.Combine(MessageListView.MyMailsDir, fileName)); _date = new ReadonlyTextElement("Date", msg == null || msg.Date == null ? DateTime.Now.ToString() : msg.Date.ToString()); _from = new EntryElement("From", "Enter from email-address", msg == null ? "" : msg.From.ToString()); _to = new EntryElement("To", "Enter recipient email-addresses", msg == null ? "" : msg.To.ToString()); _subject = new EntryElement("Subject", "Enter subject", msg == null ? "" : msg.Subject); Section header = new Section("Header") { _date, _from, _to, _subject }; Root.Add(header); Section bodySection = new Section("Body"); _body = new UITextView(new CoreGraphics.CGRect(3, 0, _window.Bounds.Width - 26, 80)); bodySection.Add(_body); if (msg != null) { _body.Text = msg.BodyText; } Root.Add(bodySection); UIButton connectButton = UIButton.FromType(UIButtonType.System); connectButton.SetTitle("Configure SMTP and Send", UIControlState.Normal); connectButton.Frame = new CoreGraphics.CGRect(0, 0, _window.Screen.Bounds.Width - 20, 40); connectButton.TouchUpInside += Send; Section buttonSection = new Section(); buttonSection.Add(connectButton); Root.Add(buttonSection); } catch (Exception ex) { Util.ShowException(ex); } }
/// <summary> /// Initializes a new instance of the view class. /// </summary> /// <param name="siteName">The remote site name.</param> /// <param name="navigation">AppWindow.</param> public ConnectView(AppWindow window) : base(new RootElement("Get POP3 Mailbox Stat"), true) { // Initialize controller's elements _window = window; _serverName = new EntryElement("Hostname: ", "Enter server address", "pop.gmail.com"); Util.DisableAutoCorrectionAndAutoCapitalization(_serverName); var noneRadio = new RadioElement("None", "mode"); var implicitRadio = new RadioElement("Implicit", "mode"); var explicitRadio = new RadioElement("Explicit", "mode"); // automatically update port number to SSL mode default noneRadio.Tapped += () => { ServerPort = Pop3.DefaultPort; }; explicitRadio.Tapped += () => { ServerPort = Pop3.DefaultPort; }; implicitRadio.Tapped += () => { ServerPort = Pop3.DefaultImplicitSslPort; }; _sslModes = new RadioGroup("mode", 1); _mode = new RootElement("TLS/SSL mode:", _sslModes) { new Section() { noneRadio, implicitRadio, explicitRadio } }; string defaultPort = "995"; _serverPort = new EntryElement("Port: ", "Enter port", defaultPort); _serverPort.KeyboardType = UIKit.UIKeyboardType.NumberPad; _username = new EntryElement("Username: "******"Enter username", ""); Util.DisableAutoCorrectionAndAutoCapitalization(_username); _password = new EntryElement("Password: "******"Enter password", "", true); Util.DisableAutoCorrectionAndAutoCapitalization(_password); _propertiesSection = new Section() { _serverName, _mode, _serverPort, _username, _password }; Root.Add(_propertiesSection); _connectButton = UIButton.FromType(UIButtonType.System); _connectButton.SetTitle("Get Mailbox Info", UIControlState.Normal); _connectButton.Frame = new CoreGraphics.CGRect(0, 0, _window.Screen.Bounds.Width - 20, 40); _connectButton.TouchUpInside += Connect; Section buttonSection = new Section(); buttonSection.Add(_connectButton); Root.Add(buttonSection); }