public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            if (!IsNetEnable())
            {
                return;
            }

            System.Threading.ThreadPool.QueueUserWorkItem(delegate
            {
                ShowLoadingView(Constants.MSG_LOADING_EVENT_DETAIL);

                selectedEvent     = GetEventDetail(selectedEvent._id);
                selectedEvent._id = eventID;
                eventTotal        = GetEventTotals(selectedEvent._id);
                var eventComment  = GetComments(selectedEvent._id);

                InvokeOnMainThread(() =>
                {
                    InitBindingEventData();
                    InitBindingEventTotal();
                    InitBindingEventComments(eventComment);
                });

                HideLoadingView();
            });
        }
        void InitUISettings(GoHejaEvent selectedEvent)
        {
            lblPDistance = FindViewById <TextView>(Resource.Id.lblPDistance);
            lblPDuration = FindViewById <TextView>(Resource.Id.lblPDuration);
            lblPLoad     = FindViewById <TextView>(Resource.Id.lblPLoad);
            lblPHB       = FindViewById <TextView>(Resource.Id.lblPHB);

            lblPDistance.SetTextColor(GROUP_COLOR);
            lblPDuration.SetTextColor(GROUP_COLOR);
            lblPLoad.SetTextColor(GROUP_COLOR);
            lblPHB.SetTextColor(GROUP_COLOR);

            FindViewById <TextView>(Resource.Id.lblAvgSpeed).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblTotalDistance).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblElapsedTime).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblTotalAcent).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblAvgHR).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblTotalCalories).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblAvgPower).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblLoad).SetTextColor(GROUP_COLOR);
            FindViewById <TextView>(Resource.Id.lblLeveledPower).SetTextColor(GROUP_COLOR);

            lblTDistance = FindViewById <TextView>(Resource.Id.lblTotalDistance);
            lblTDuration = FindViewById <TextView>(Resource.Id.lblElapsedTime);
            lblTload     = FindViewById <TextView>(Resource.Id.lblLoad);

            FindViewById(Resource.Id.btnBack).Click += delegate(object sender, EventArgs e) {
                var activity = new Intent();
                SetResult(Result.Canceled, activity);
                Finish();
            };
            FindViewById(Resource.Id.ActionLocation).Click += delegate(object sender, EventArgs e)
            {
                var activity = new Intent(this, typeof(LocationActivity));
                StartActivityForResult(activity, 1);
            };
            FindViewById(Resource.Id.ActionAdjustTrainning).Click += delegate(object sender, EventArgs e)
            {
                var activity = new Intent(this, typeof(AdjustTrainningActivity));
                StartActivityForResult(activity, 1);
            };
            FindViewById(Resource.Id.ActionAdjustTrainning).SetBackgroundColor(GROUP_COLOR);

            FindViewById(Resource.Id.ActionAddComment).Click += delegate(object sender, EventArgs e) {
                var activity = new Intent(this, typeof(AddCommentActivity));
                StartActivityForResult(activity, 1);
            };
            FindViewById(Resource.Id.ActionAddComment).SetBackgroundColor(GROUP_COLOR);

            if (DateTime.Compare(selectedEvent.StartDateTime(), DateTime.Now) > 0)
            {
                FindViewById(Resource.Id.ActionAdjustTrainning).Visibility = ViewStates.Gone;
            }
            else
            {
                FindViewById(Resource.Id.ActionAdjustTrainning).Visibility = ViewStates.Visible;
            }
        }
Exemplo n.º 3
0
        public void SetCell(GoHejaEvent goHejaEvent)
        {
            var strTitle = goHejaEvent.title;
            var strTime  = String.Format("{0:t}", goHejaEvent.StartDateTime());

            lblTitle.Text     = strTitle;
            lblEventTime.Text = strTime;

            if (goHejaEvent.attended == "0" && goHejaEvent.StartDateTime().DayOfYear <= DateTime.Now.DayOfYear)
            {
                var attrTitle = new NSAttributedString(lblTitle.Text, strikethroughStyle: NSUnderlineStyle.Single);
                var attrTime  = new NSAttributedString(lblEventTime.Text, strikethroughStyle: NSUnderlineStyle.Single);
                lblTitle.AttributedText     = attrTitle;
                lblEventTime.AttributedText = attrTime;
                lblTitle.TextColor          = UIColor.FromRGB(112, 112, 112);
                lblEventTime.TextColor      = UIColor.FromRGB(112, 112, 112);
            }
            else
            {
                var attrTitle = new NSAttributedString(lblTitle.Text, strikethroughStyle: NSUnderlineStyle.None);
                var attrTime  = new NSAttributedString(lblEventTime.Text, strikethroughStyle: NSUnderlineStyle.None);
                lblTitle.AttributedText     = attrTitle;
                lblEventTime.AttributedText = attrTime;
                lblTitle.TextColor          = UIColor.White;
                lblEventTime.TextColor      = UIColor.White;
            }

            switch (goHejaEvent.type)
            {
            case "0":
                imgType.Image = UIImage.FromFile("icon_triathlon.png");
                break;

            case "1":
                imgType.Image = UIImage.FromFile("icon_bike.png");
                break;

            case "2":
                imgType.Image = UIImage.FromFile("icon_run.png");
                break;

            case "3":
                imgType.Image = UIImage.FromFile("icon_swim.png");
                break;

            case "4":
                imgType.Image = UIImage.FromFile("icon_triathlon.png");
                break;

            case "5":
                imgType.Image = UIImage.FromFile("icon_other.png");
                break;
            }
        }
Exemplo n.º 4
0
        public List <GoHejaEvent> CastGoHejaEvents(JArray events)
        {
            var returnEvents = new List <GoHejaEvent>();

            if (events == null)
            {
                return(returnEvents);
            }

            foreach (var eventJson in events)
            {
                GoHejaEvent goHejaEvent = JsonConvert.DeserializeObject <GoHejaEvent>(eventJson.ToString());
                returnEvents.Add(goHejaEvent);
            }
            return(returnEvents);
        }
        void InitBindingEventData(GoHejaEvent selectedEvent)
        {
            try
            {
                var startDateFormats = String.Format("{0:f}", selectedEvent.StartDateTime());                //selectedEvent.StartDateTime().GetDateTimeFormats();
                FindViewById <TextView>(Resource.Id.lblTitle).Text     = selectedEvent.title;
                FindViewById <TextView>(Resource.Id.lblStartDate).Text = startDateFormats;
                FindViewById <TextView>(Resource.Id.lblData).Text      = selectedEvent.eventData;

                var strDistance = selectedEvent.distance;
                fDistance = strDistance == "" || strDistance == null ? 0 : float.Parse(strDistance);
                var b = Math.Truncate(fDistance * 100);
                var c = b / 100;
                var formattedDistance = c.ToString("F2");

                lblPDistance.Text = formattedDistance + " KM";

                var durMin = selectedEvent.durMin == "" ? 0 : int.Parse(selectedEvent.durMin);
                var durHrs = selectedEvent.durHrs == "" ? 0 : int.Parse(selectedEvent.durHrs);
                var pHrs   = durMin / 60;
                fDuration = (durHrs * 60 + durMin) * 60;
                durHrs    = durHrs + pHrs;
                durMin    = durMin % 60;
                var strDuration = durHrs.ToString() + ":" + durMin.ToString("D2");

                fLoad = selectedEvent.tss == "" ? 0 : float.Parse(selectedEvent.tss);

                lblPDuration.Text = strDuration;
                lblPLoad.Text     = selectedEvent.tss;
                lblPHB.Text       = selectedEvent.hb;

                var imgType = FindViewById <ImageView>(Resource.Id.imgType);
                switch (selectedEvent.type)
                {
                case "0":
                    imgType.SetImageResource(Resource.Drawable.icon_triathlon);
                    break;

                case "1":
                    imgType.SetImageResource(Resource.Drawable.icon_bike);
                    break;

                case "2":
                    imgType.SetImageResource(Resource.Drawable.icon_run);
                    break;

                case "3":
                    imgType.SetImageResource(Resource.Drawable.icon_swim);
                    break;

                case "4":
                    imgType.SetImageResource(Resource.Drawable.icon_triathlon);
                    break;

                case "5":
                    imgType.SetImageResource(Resource.Drawable.icon_other);
                    break;
                }
            }
            catch (Exception err)
            {
                Toast.MakeText(this, err.ToString(), ToastLength.Long).Show();
            }
        }