// Override the Clone method so that the Enabled property is copied.
        public override object Clone()
        {
            DataGridViewDisableButtonCell cell = (DataGridViewDisableButtonCell)base.Clone();

            cell.Enabled = this.Enabled;
            return(cell);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Check if user pressed the uninstall button and if not uninstalled > uninstall the program
 /// </summary>
 /// <param name="sender">The uninstall button in the column</param>
 private void Uninstall_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         if (e.RowIndex >= 0)
         {
             DataGridViewDisableButtonCell button = uninstall_app_list.Rows[e.RowIndex].Cells[0] as DataGridViewDisableButtonCell;
             if (button.Enabled)
             {
                 if (uninstall_apps[e.RowIndex].UninstallProgram())
                 {
                     button.Enabled = false;
                     MessageBox.Show("The windows app is now uninstalled!");
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Set the buttons status when they get visible for the first time otherwise they have wrong "enabled" status
 /// </summary>
 private void SetUninstallButtonsStatus(object sender, EventArgs e)
 {
     if (!uninstall_button_init_status)
     {
         for (int i = uninstall_app_list.Rows.Count - 1; i >= 0; --i)
         {
             UninstallAppAbstract obj = (UninstallAppAbstract)uninstall_app_list.Rows[i].DataBoundItem;
             if (!obj.Installed)
             {
                 DataGridViewRow row = uninstall_app_list.Rows[i];
                 DataGridViewDisableButtonCell button = row.Cells[0] as DataGridViewDisableButtonCell;
                 if (button != null)
                 {
                     button.Enabled = false;
                 }
             }
         }
         uninstall_button_init_status = true;
     }
 }