Exemplo n.º 1
0
        public ButtonInfo GetButtonInfo()
        {
            if (Info == null)
            {
                return(new ButtonInfo {
                    Text = ">", Type = PMButtonType.UpdatePackages, PackageName = Name
                });
            }

            if (Status == null)
            {
                return(new ButtonInfo {
                    Text = "Download", Type = PMButtonType.StartPackageDownload, PackageName = Name, PackageId = Info.PackageId
                });
            }

            ButtonInfo info = new ButtonInfo();

            info.PackageId = Info.PackageId;

            if (Status.CurrentAction == PackageAction.PackageActionReady)
            {
                info.Text = "Remove";
                info.Type = PMButtonType.StartRemovePackage;
            }
            else if (Status.CurrentAction == PackageAction.PackageActionWaiting)
            {
                info.Text = "Cancel";
                info.Type = PMButtonType.CancelPackageTasks;
            }
            else
            {
                if (Status.Paused)
                {
                    info.Text          = "Resume";
                    info.Type          = PMButtonType.SetPackagePriority;
                    info.PriorityIndex = 0;
                }
                else
                {
                    info.Text          = "Pause";
                    info.Type          = PMButtonType.SetPackagePriority;
                    info.PriorityIndex = -1;
                }
            }
            return(info);
        }
Exemplo n.º 2
0
        public void Update(ButtonInfo info)
        {
            Text = info.Text;

            PackageId = info.PackageId;
            PackageName = info.PackageName;
            PriorityIndex = info.PriorityIndex;
            Type = info.Type;

            if (Type == PMButtonType.UpdatePackages)
            {
                Typeface = Typeface.Create("Helvetica Neue", TypefaceStyle.Bold);
                SetTextSize(Android.Util.ComplexUnitType.Dip, 20);
            }
            else {
                Typeface = Typeface.Create("Helvetica Neue", TypefaceStyle.Normal);
                SetTextSize(Android.Util.ComplexUnitType.Dip, 15);
            }
        }
Exemplo n.º 3
0
        public ButtonInfo GetButtonInfo()
        {
            if (Info == null)
            {
                return new ButtonInfo { Text = ">", Type = PMButtonType.UpdatePackages, PackageName = Name };
            }

            if (Status == null)
            {
                return new ButtonInfo { Text = "Download", Type = PMButtonType.StartPackageDownload, PackageName = Name, PackageId = Info.PackageId };
            }

            ButtonInfo info = new ButtonInfo();
            info.PackageId = Info.PackageId;

            if (Status.CurrentAction == PackageAction.PackageActionReady)
            {
                info.Text = "Remove";
                info.Type = PMButtonType.StartRemovePackage;
            }
            else if (Status.CurrentAction == PackageAction.PackageActionWaiting)
            {
                info.Text = "Cancel";
                info.Type = PMButtonType.CancelPackageTasks;
            }
            else {

                if (Status.Paused)
                {
                    info.Text = "Resume";
                    info.Type = PMButtonType.SetPackagePriority;
                    info.PriorityIndex = 0;
                }
                else {
                    info.Text = "Pause";
                    info.Type = PMButtonType.SetPackagePriority;
                    info.PriorityIndex = -1;
                }
            }
            return info;
        }