public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var backgroundImage = UIImage.FromBundle(@"images/appview/bg");
            //this.View.BackgroundColor = UIColor.FromPatternImage(backgroundImage);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView (" Downloading Sessions", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            //			_client.GetFullConference("CodeMash-2012", conference => {
            //				var connectionString = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "conferences.db");
            //				var localDatabase = new LocalDatabase(connectionString);
            //				localDatabase.CreateDatabase();
            //
            //				var conferenceMapper = new ConferenceDtoToConferenceEntityMapper();
            //				var conferenceEntity = conferenceMapper.Map(conference);
            //
            //				var sessionMapper = new SessionDtoToSessionEntityMapper();
            //				var sessions = sessionMapper.MapAll(conferenceEntity.Id, conference.sessions.AsEnumerable());
            //				//localDatabase.SaveSessions(sessions);
            //
            //				var speakersMapper = new SessionDtoToSessionEntityMapper();
            //				var speakerEntities = speakersMapper.MapAll(conferenceEntity.Id, conference.speakers.AsEnumerable());
            //				localDatabase.SaveConference(conferenceEntity, sessions, speakers);
            //
            //			});
            _client.GetSessions ("CodeMash-2012", sessions =>
            {
                InvokeOnMainThread (() =>
                {
                    TableView.Source = new SessionsTableViewSource (this, sessions);
                    TableView.ReloadData ();
                    loading.DismissWithClickedButtonIndex (0, true);
                });
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            if (!UserInterfaceIdiomIsPhone)
                this.TableView.SelectRow (
                    NSIndexPath.FromRowSection (0, 0),
                    false,
                    UITableViewScrollPosition.Middle
                );
        }
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView ("Downloading Session", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            _client.GetSession ("CodeMash-2012", this.SessionSlug, session =>
            {
                InvokeOnMainThread (() =>
                {
                    //new UIAlertView ("Session", session.title, null, "Ok", null).Show ();
                    this.sessionTitleLabel.Text = session.title;
                    this.sessionEndLabel.Text = session.end.ToString ();
                    this.sessionStartLabel.Text = session.start.ToString();
                    this.sessionTwitterHashTagLabel.Text = session.twitterHashTag;
                    loading.DismissWithClickedButtonIndex (0, true);
                }
                );
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            //			if (!UserInterfaceIdiomIsPhone) {
            //				this.TableView.SelectRow (
            //					NSIndexPath.FromRowSection (0, 0),
            //					false,
            //					UITableViewScrollPosition.Middle
            //				);
            //			}
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var backgroundImage = UIImage.FromBundle(@"images/appview/bg");
            //this.View.BackgroundColor = UIColor.FromPatternImage(backgroundImage);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView (" Downloading Speakers", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            _client.GetSpeakers ("CodeMash-2012", speakers =>
            {
                InvokeOnMainThread (() =>
                {
                    TableView.Source = new SpeakersTableViewSource (this, speakers);
                    TableView.ReloadData ();
                    loading.DismissWithClickedButtonIndex (0, true);
                }
                );
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            if (!UserInterfaceIdiomIsPhone)
                this.TableView.SelectRow (
                    NSIndexPath.FromRowSection (0, 0),
                    false,
                    UITableViewScrollPosition.Middle
                );
        }
Esempio n. 4
0
        void GetLatestFullConference()
        {
            _client = new RemoteDataRepository (_baseUrl);
            _client.GetFullConference ("CodeMash-2012", conference =>
            {

                var x = conference;

                var json = JsonSerializer.SerializeToString(conference);
                string path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
                string filePath = Path.Combine(path, "fullConference.json");
                File.WriteAllText(filePath, json);
            });
        }