示例#1
0
            // Again, we could now opt for using Action<T...>
            //public event Action<int> PercentageComplete;

            // Passing our percentage value as a parameter almost seems backwards as we are
            // kind of trying to return values to the code that called us, but remember that
            // we're staying within our control flow and calling back to them, rather than
            // returning. The term Callback may be one that you recognise.

            public void Go()
            {
                for (int i = 0; i < 100; i++)
                {
                    if (i % 10 == 0)
                    {
                        // fire the event every 10 iterations
                        PercentageComplete.Invoke(i);
                    }
                }
            }
        protected virtual void UpdatePercentageCompleteDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            ImageView achivementImage;
            TextView  caption;
            TextView  description;
            TextView  percentageComplete;

            DroidResources.DecodeAchievementsElementLayout(Context, cell, out caption, out description, out percentageComplete, out achivementImage);

            if (percentageComplete != null)
            {
                percentageComplete.Text = PercentageComplete.ToString(CultureInfo.InvariantCulture);
            }
        }
示例#3
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            View view = DroidResources.LoadAchievementsElementLayout(context, convertView, parent, LayoutId, out _caption, out _description, out _percentageComplete, out _achivementImage);

            if (view != null)
            {
                _caption.Text            = Caption;
                _description.Text        = Description;
                _percentageComplete.Text = PercentageComplete.ToString();
                if (AchievementImage != null)
                {
                    _achivementImage.SetImageBitmap(AchievementImage);
                }
            }
            else
            {
                Android.Util.Log.Error("AchievementElement", "GetView failed to load template view");
            }
            return(view);
        }
示例#4
0
        internal override List <ComponentLine> BuildLines()
        {
            List <ComponentLine> lines = new List <ComponentLine>
            {
                new ComponentLine("DTSTAMP:", DateTime.Now, true),
                new ComponentLine("SEQUENCE:", Sequence),
                new ComponentLine("UID:", $"{Code}@icalendar-API"),
                new ComponentLine("TRIGGER:", TriggerDate, true),
                new ComponentLine("ACTION:", ActionType),
                new ComponentLine("REPEAT:", MathExt.Max <int>(Repeat, 1)),
                new ComponentLine("DURATION:", Duration.ToString()),
                new ComponentLine("DUE:", DueDate, true),
                new ComponentLine("PERCENT-COMPLETE:", PercentageComplete.ForceToRange(0, 100)),
                new ComponentLine("PRIORITY:", Priority.ForceToRange(0, 9)),
                new ComponentLine("COMPLETED:", Completed.Coalesce(DateTime.Today.AddDays(1)), true)
            };

            lines.AddRange(Attachments.Select(a => a.BuildLine()));

            return(BuildComponent(lines));
        }
        protected virtual void UpdateDescriptionDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            ImageView achivementImage;
            TextView  caption;
            TextView  description;
            TextView  percentageComplete;

            DroidResources.DecodeAchievementsElementLayout(Context, cell, out caption, out description, out percentageComplete, out achivementImage);

            // TODO - this is slow for things which don't need complete rebinding...
            caption.Text            = Caption;
            description.Text        = Description;
            percentageComplete.Text = PercentageComplete.ToString(CultureInfo.InvariantCulture);
            if (AchievementImage != null)
            {
                achivementImage.SetImageBitmap(AchievementImage);
            }
        }
 public bool IsDuplicate(ProjectUpdateItem update)
 {
     return(update != null &&
            IsDuplicate(RAGStatus, update.RAGStatus) &&
            IsDuplicate(OnHoldStatus, update.OnHoldStatus) &&
            IsDuplicate(Phase, update.Phase) &&
            ((PercentageComplete == null && update.PercentageComplete == null) || (PercentageComplete.HasValue && PercentageComplete.Equals(update.PercentageComplete))) &&
            Budget.Equals(update.Budget) &&
            Spent.Equals(update.Spent) &&
            ((ExpectedCurrentPhaseEnd?.Date == null && update.ExpectedCurrentPhaseEnd.Date == null) || (ExpectedCurrentPhaseEnd?.Date != null && ExpectedCurrentPhaseEnd.Date.Equals(update.ExpectedCurrentPhaseEnd.Date))) &&
            (string.IsNullOrWhiteSpace(Text) || string.Equals(Text, update.Text, StringComparison.OrdinalIgnoreCase))
            );
 }