Beispiel #1
0
        /// <summary>
        /// Views the did load.
        /// </summary>
        /// <returns>The did load.</returns>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            UIBarButtonItem backButton = new UIBarButtonItem("< Back", UIBarButtonItemStyle.Bordered, HandleSignout);

            NavigationItem.SetLeftBarButtonItem(backButton, false);

            View.BackgroundColor = UIColor.White;

            _presenter.SetView(this);

            var width  = View.Bounds.Width;
            var height = View.Bounds.Height;

            Title = "Clients";

            var titleLabel = new UILabel()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text          = "Connected Clients",
                Font          = UIFont.FromName("Helvetica-Bold", 22),
                TextAlignment = UITextAlignment.Center
            };

            var descriptionLabel = new UILabel()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text          = "Select a client you would like to chat with",
                Font          = UIFont.FromName("Helvetica", 18),
                TextAlignment = UITextAlignment.Center
            };

            _tableView = new UITableView(new CGRect(0, 0, width, height))
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _tableView.AutoresizingMask = UIViewAutoresizing.All;
            _tableView.Source           = _source;

            Add(titleLabel);
            Add(descriptionLabel);
            Add(_tableView);

            var views = new DictionaryViews()
            {
                { "titleLabel", titleLabel },
                { "descriptionLabel", descriptionLabel },
                { "tableView", _tableView },
            };

            View.AddConstraints(
                NSLayoutConstraint.FromVisualFormat("V:|-100-[titleLabel(30)]-[descriptionLabel(30)]-[tableView]|", NSLayoutFormatOptions.DirectionLeftToRight, null, views)
                .Concat(NSLayoutConstraint.FromVisualFormat("H:|[tableView]|", NSLayoutFormatOptions.AlignAllTop, null, views))
                .Concat(NSLayoutConstraint.FromVisualFormat("H:|-10-[titleLabel]-10-|", NSLayoutFormatOptions.AlignAllTop, null, views))
                .Concat(NSLayoutConstraint.FromVisualFormat("H:|-10-[descriptionLabel]-10-|", NSLayoutFormatOptions.AlignAllTop, null, views))
                .ToArray());
        }
Beispiel #2
0
        /// <summary>
        /// Ons the resume.
        /// </summary>
        /// <returns>The resume.</returns>
        protected override void OnResume()
        {
            base.OnResume();

            var app = ChatApplication.GetApplication(this);

            app.CurrentActivity = this;

            if (_presenter != null)
            {
                _presenter.SetView(this);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Ons the create.
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ListView.SetBackgroundColor(Color.White);

            var app = ChatApplication.GetApplication(this);

            app.CurrentActivity = this;

            _presenter = app.Presenter as ClientsListPresenter;
            _presenter.SetView(this);

            _adapter    = new ClientsListAdapter(this);
            ListAdapter = _adapter;
        }