コード例 #1
0
ファイル: SessionTests.cs プロジェクト: akeresztesgh/tekconf
        public void GetSession()
        {
            RemoteDataRepository remoteData = new RemoteDataRepository(_baseUrl);
              SessionDto session = null;
              string conferenceSlug = "CodeMash-2013";
              string slug = "Android-Pro-Tips";
              remoteData.GetSession(conferenceSlug, slug, s =>
                                                    {
                                                      session = s;
                                                    });

              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
              bool gotData = false;
              while (session == null && stopwatch.ElapsedMilliseconds < 10000)
              {
            if (session != null)
            {
              session.slug.ShouldEqual(slug);
              gotData = true;
            }
              }

              gotData.ShouldBeTrue();
              session.ShouldNotBeNull();
        }
コード例 #2
0
ファイル: SessionTests.cs プロジェクト: akeresztesgh/tekconf
        public void GetSessions()
        {
            var slug = "Android-Pro-Tips";
              var conferenceSlug = "CodeMash-2013";
              RemoteDataRepository remoteData = new RemoteDataRepository(_baseUrl);
              IList<SessionsDto> sessions = null;
              remoteData.GetSessions(conferenceSlug, s =>
                                               {
                                                 sessions = s;
                                               });

              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
              bool gotData = false;
              while (sessions == null && stopwatch.ElapsedMilliseconds < 3000)
              {
            if (sessions != null)
            {
              sessions.Count.ShouldEqual(1);
              sessions.FirstOrDefault().slug.ShouldEqual(slug);
              gotData = true;
            }
              }

              gotData.ShouldBeTrue();
              sessions.ShouldNotBeNull();
        }
コード例 #3
0
        public void GetConferences()
        {
            RemoteDataRepository remoteData = new RemoteDataRepository(_baseUrl);
              IList<ConferencesDto> conferences = null;
              remoteData.GetConferences(c =>
                                     {
                                       conferences = c;
                                     });

              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
              bool gotData = false;
              while(conferences == null && stopwatch.ElapsedMilliseconds < 3000)
              {
            if (conferences != null)
            {
              conferences.Count.ShouldEqual(1);
              conferences.FirstOrDefault().slug.ShouldEqual("CodeMash-2013");
              gotData = true;
            }
              }

              gotData.ShouldBeTrue();
              conferences.ShouldNotBeNull();
        }
コード例 #4
0
ファイル: Activity1.cs プロジェクト: akeresztesgh/tekconf
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            string baseUrl = "http://api.tekconf.com/v1/";
            //string baseUrl = "http://localhost:25825/v1/";
            var client = new RemoteDataRepository(baseUrl);
            var loading = ProgressDialog.Show(this, "Downloading Sessions", "Please wait...", true);
            client.GetSessions("CodeMash-2012", sessions =>
            {
                RunOnUiThread(() =>
                  {
                      var contactsAdapter = new SessionsListAdapter(this, sessions);
                      var contactsListView = FindViewById<ListView>(Resource.Id.sessionsListView);
                      contactsListView.Adapter = contactsAdapter;

                      contactsListView.ItemClick += (sender, args) =>
                                                      {
                                                          var selectedSession = sessions[args.Position];
                                                          new AlertDialog.Builder(this)
                                                            .SetTitle("Full Session")
                                                            .SetMessage(selectedSession.title)
                                                            .SetPositiveButton("Ok", delegate { })
                                                            .Show();
                                                      };

                      loading.Hide();

                  }
                );
            });
        }
コード例 #5
0
        public void GetConference()
        {
            RemoteDataRepository remoteData = new RemoteDataRepository(_baseUrl);
              ConferenceDto conference = null;
              string slug = "CodeMash-2013";
              remoteData.GetConference(slug, c =>
              {
            conference = c;
              });

              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
              bool gotData = false;
              while (conference == null && stopwatch.ElapsedMilliseconds < 3000)
              {
            if (conference != null)
            {
              conference.slug.ShouldEqual(slug);
              gotData = true;
            }
              }

              gotData.ShouldBeTrue();
              conference.ShouldNotBeNull();
        }
コード例 #6
0
ファイル: SpeakerTests.cs プロジェクト: akeresztesgh/tekconf
        public void GetSpeaker()
        {
            RemoteDataRepository remoteData = new RemoteDataRepository(_baseUrl);
              SpeakerDto speaker = null;
              string conferenceSlug = "CodeMash-2013";
              string slug = "Speaker-Slug2";
              remoteData.GetSpeaker(conferenceSlug, slug, s =>
                                                    {
                                                      speaker = s;
                                                    });

              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
              bool gotData = false;
              while (speaker == null && stopwatch.ElapsedMilliseconds < 10000)
              {
            if (speaker != null)
            {
              speaker.slug.ShouldEqual(slug);
              gotData = true;
            }
              }

              gotData.ShouldBeTrue();
              speaker.ShouldNotBeNull();
        }
コード例 #7
0
 public void DetailAsync(string conferenceSlug, string sessionSlug)
 {
     var remoteData = new RemoteDataRepository(BaseUrl());
       AsyncManager.OutstandingOperations.Increment();
       remoteData.GetSession(conferenceSlug, sessionSlug, session =>
       {
     AsyncManager.Parameters["session"] = session;
     AsyncManager.OutstandingOperations.Decrement();
       });
 }
コード例 #8
0
 public void CreateAsync(SessionDto session)
 {
     var remoteData = new RemoteDataRepository(BaseUrl());
       AsyncManager.OutstandingOperations.Increment();
       //remoteData.AddSession(session, b =>
       //{
     //AsyncManager.Parameters["conference"] = conference;
     AsyncManager.OutstandingOperations.Decrement();
       //});
 }
コード例 #9
0
ファイル: MainPage.xaml.cs プロジェクト: akeresztesgh/tekconf
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
              string baseUrl = "http://api.tekconf.com/v1/";
              var client = new RemoteDataRepository(baseUrl);

              client.GetSessions("CodeMash-2012", sessions =>
                           {
                             Deployment.Current.Dispatcher.BeginInvoke(() =>
                             {
                               DataContext = sessions;
                               Loading.Visibility = Visibility.Collapsed;
                             });
                           });
        }
コード例 #10
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

              var conferenceSlug = NavigationContext.QueryString["conferenceSlug"];
              var sessionSlug = NavigationContext.QueryString["sessionSlug"];

              string baseUrl = "http://api.tekconf.com/v1/";
              var client = new RemoteDataRepository(baseUrl);

              client.GetSession("CodeMash-2012", sessionSlug, session =>
              {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
              DataContext = session;
              Loading.Visibility = Visibility.Collapsed;
            });
              });

              this.ApplicationTitle.Text = "CodeMash";
        }