Exemplo n.º 1
0
        private void listViewDetails_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ListViewItem itm = this.listViewDetails.Items[e.Index];

            // Do not allow checking if there are no updates or it is set to ignore.
            if (itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.NoUpdateAvailable).ToString()) ||
                itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.UpdateIgnored).ToString()) ||
                itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.Disabled).ToString()))
            {
                e.NewValue = CheckState.Unchecked;
            }

            iUpgradeable file = MainForm.Instance.UpdateHandler.UpdateData.FindByName(itm.Name);

            if (e.NewValue == CheckState.Checked)
            {
                file.DownloadChecked = file.AllowUpdate = true;
            }
            else
            {
                file.DownloadChecked = false;
            }

            if (e.NewValue == CheckState.Unchecked &&
                itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.Reinstall).ToString()))
            {
                ProgramSettings pSettings = UpdateCacher.GetPackage(itm.Name);
                if (pSettings != null && !pSettings.UpdateAllowed())
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.Disabled).ToString();
                }
                else if (!file.isAvailable())
                {
                    e.NewValue           = CheckState.Checked;
                    file.DownloadChecked = file.AllowUpdate = true;
                }
                else if (!file.AllowUpdate && file.HasAvailableVersion)
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateIgnored).ToString();
                }
                else if (file.HasAvailableVersion)
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateAvailable).ToString();
                }
                else
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.NoUpdateAvailable).ToString();
                }
            }
        }
Exemplo n.º 2
0
        private void setIgnoreValue_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem ts = (ToolStripMenuItem)sender;

            foreach (ListViewItem item in listViewDetails.SelectedItems)
            {
                ProgramSettings pSettings = UpdateCacher.GetPackage(item.Name);
                iUpgradeable    file      = MainForm.Instance.UpdateHandler.UpdateData.FindByName(item.Name);
                Version         latest    = file.AvailableVersion;
                file.AllowUpdate = !(ts.Checked);

                if (pSettings != null && !pSettings.UpdateAllowed())
                {
                    item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.Disabled).ToString();
                    item.Checked = false;
                }
                else if (!file.isAvailable())
                {
                    item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.Reinstall).ToString();
                    item.Checked     = true;
                    file.AllowUpdate = true;
                }
                else if (latest != null && file.CurrentVersion == null || latest.CompareTo(file.CurrentVersion) != 0)
                {
                    if (!file.AllowUpdate)
                    {
                        item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateIgnored).ToString();
                        item.Checked = false;
                    }
                    else
                    {
                        item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateAvailable).ToString();
                        item.Checked = true;
                    }
                }
                else
                {
                    item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.NoUpdateAvailable).ToString();
                    item.Checked = false;
                }
            }
        }
Exemplo n.º 3
0
        private void listViewDetails_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right || listViewDetails.SelectedItems.Count != 1)
            {
                return;
            }

            // get the program settings
            ProgramSettings pSettings = UpdateCacher.GetPackage(listViewDetails.SelectedItems[0].Name);
            iUpgradeable    file      = MainForm.Instance.UpdateHandler.UpdateData.FindByName(listViewDetails.SelectedItems[0].Name);

            // set the enable package value
            ToolStripMenuItem ts = (ToolStripMenuItem)statusToolStrip.Items[0];

            if (pSettings == null)
            {
                ts.Checked = true;
                ts.Enabled = false;
            }
            else
            {
                ts.Checked = pSettings.UpdateAllowed();
                ts.Enabled = !pSettings.Required;
            }

            // set the ignore update data value
            ts = (ToolStripMenuItem)statusToolStrip.Items[1];
            if (pSettings != null && !pSettings.UpdateAllowed())
            {
                ts.Checked = true;
                ts.Enabled = false;
            }
            else if (!file.isAvailable())
            {
                ts.Checked = false;
                ts.Enabled = false;
            }
            else
            {
                ts.Checked = !file.AllowUpdate;
                ts.Enabled = true;
            }

            // set the force reinstall data value
            ts = (ToolStripMenuItem)statusToolStrip.Items[2];
            if (pSettings != null && !pSettings.UpdateAllowed())
            {
                ts.Checked = false;
                ts.Enabled = false;
            }
            else if (!file.isAvailable())
            {
                ts.Checked = true;
                ts.Enabled = false;
            }
            else
            {
                ts.Checked = file.DownloadChecked;
                ts.Enabled = true;
            }

            if (file.HasAvailableVersion)
            {
                ts.Text = "Install";
            }
            else
            {
                ts.Text = "Force reinstall";
            }

            statusToolStrip.Show(Cursor.Position);
        }