コード例 #1
0
 private void BeginRefresh(View viewToUpdate,
                           IRefreshListener refreshAction)
 {
     ViewGroup.LayoutParams layoutParams = viewToUpdate.LayoutParameters;
     layoutParams.Height           = (int)PullElementStandbyHeight;
     viewToUpdate.LayoutParameters = layoutParams;
     //UITrace.Trace("PullDown:refreshing");
     State = new RefreshingState();
     ThreadPool.QueueUserWorkItem((ignored) =>
     {
         try
         {
             //var start = DateTime.UtcNow;
             refreshAction.DoRefresh();
             //var finish = DateTime.UtcNow;
             //long difference = finish - start;
             //try
             //{
             //    Thread.Sleep(Math.Max(difference, 1500));
             //}
             //catch (InterruptedException e)
             //{
             //}
         }
         catch (RuntimeException e)
         {
             //UITrace.Trace("Error: {0}", e.ToLongString());
             throw e;
         }
         finally
         {
             RunOnUiThread(() => RefreshFinished(refreshAction));
         }
     });
 }
コード例 #2
0
 private void BeginRefresh(View viewToUpdate,
                           IRefreshListener refreshAction)
 {
     ViewGroup.LayoutParams layoutParams = viewToUpdate.LayoutParameters;
     layoutParams.Height = (int) PullElementStandbyHeight;
     viewToUpdate.LayoutParameters = layoutParams;
     //UITrace.Trace("PullDown:refreshing");
     State = new RefreshingState();
     ThreadPool.QueueUserWorkItem((ignored) =>
                                      {
                                          try
                                          {
                                              //var start = DateTime.UtcNow;
                                              refreshAction.DoRefresh();
                                              //var finish = DateTime.UtcNow;
                                              //long difference = finish - start;
                                              //try
                                              //{
                                              //    Thread.Sleep(Math.Max(difference, 1500));
                                              //}
                                              //catch (InterruptedException e)
                                              //{
                                              //}
                                          }
                                          catch (RuntimeException e)
                                          {
                                              //UITrace.Trace("Error: {0}", e.ToLongString());
                                              throw e;
                                          }
                                          finally
                                          {
                                              RunOnUiThread(() => RefreshFinished(refreshAction));
                                          }
                                      });
 }
コード例 #3
0
 public void RefreshFinished(IRefreshListener refreshAction)
 {
     //UITrace.Trace("PullDown: ready");
     State = new PullToRefreshState();
     InitializeYsHistory();
     RunOnUiThread(() =>
     {
         float dp = new Pixel(0, _listView.Resources).ToDp();
         SetUpperButtonHeight(dp);
         SetLowerButtonHeight(dp);
         refreshAction.RefreshFinished();
     });
 }
コード例 #4
0
 private void Initialize()
 {
     State            = new PullToRefreshState();
     _listView.Touch += (sender, args) =>
     {
         MotionEvent motionEvent = args.Event;
         if (motionEvent.Action == MotionEventActions.Up)
         {
             InitializeYsHistory();
             State.TouchStopped(motionEvent, this);
         }
         else if (motionEvent.Action == MotionEventActions.Move)
         {
             args.Handled = State.HandleMovement(motionEvent, this);
         }
         args.Handled = false;
     };
 }
コード例 #5
0
 private void Initialize()
 {
     State = new PullToRefreshState();
     _listView.Touch += (sender, args) =>
                           {
                               MotionEvent motionEvent = args.Event;
                               if (motionEvent.Action == MotionEventActions.Up)
                               {
                                   InitializeYsHistory();
                                   State.TouchStopped(motionEvent, this);
                               }
                               else if (motionEvent.Action == MotionEventActions.Move)
                               {
                                   args.Handled = State.HandleMovement(motionEvent, this);
                               }
                               args.Handled = false;
                           };
 }
コード例 #6
0
 public void SetPullingUp(MotionEvent motionEvent)
 {
     //UITrace.Trace("PullDown pulling up");
     State = new PullingUpState(motionEvent);
 }
コード例 #7
0
        /**************************************************************/
        // State Change
        /**************************************************************/

        public void SetPullingDown(MotionEvent motionEvent)
        {
            //UITrace.Trace("PullDown pulling down");
            State = new PullingDownState(motionEvent);
        }
コード例 #8
0
 public void SetPullingUp(MotionEvent motionEvent)
 {
     //UITrace.Trace("PullDown pulling up");
     State = new PullingUpState(motionEvent);
 }
コード例 #9
0
        /**************************************************************/
        // State Change
        /**************************************************************/

        public void SetPullingDown(MotionEvent motionEvent)
        {
            //UITrace.Trace("PullDown pulling down");
            State = new PullingDownState(motionEvent);
        }
コード例 #10
0
 public void RefreshFinished(IRefreshListener refreshAction)
 {
     //UITrace.Trace("PullDown: ready");
     State = new PullToRefreshState();
     InitializeYsHistory();
     RunOnUiThread(() =>
                       {
                           float dp = new Pixel(0, _listView.Resources).ToDp();
                           SetUpperButtonHeight(dp);
                           SetLowerButtonHeight(dp);
                           refreshAction.RefreshFinished();
                       });
 }