Пример #1
0
 private void LedcontrolFiles_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 1 && e.RowIndex.IsBetween(0, LedcontrolFiles.Rows.Count - 1))
     {
         if (!LastDirectory.IsNullOrWhiteSpace())
         {
             SelectLedcontrolFile.InitialDirectory = LastDirectory;
         }
         else
         {
             SelectLedcontrolFile.InitialDirectory = Assembly.GetExecutingAssembly().Location;
         };
         if (SelectLedcontrolFile.ShowDialog(this) == DialogResult.OK)
         {
             FileInfo F = new FileInfo(SelectLedcontrolFile.FileName);
             LastDirectory = F.Directory.FullName;
             if (!LedcontrolFiles.IsCurrentCellInEditMode)
             {
                 LedcontrolFiles.BeginEdit(true);
             }
             ;
             LedcontrolFiles.EditingControl.Text = F.FullName;
             LedcontrolFiles.CommitEdit(DataGridViewDataErrorContexts.Commit);
             LedcontrolFiles.Refresh();
         }
     }
 }
Пример #2
0
        private void LoadLedcontrolFiles(GlobalConfig Config)
        {
            foreach (LedControlIniFile LCF in Config.LedControlIniFiles)
            {
                int RowIndex = LedcontrolFiles.Rows.Add();

                LedcontrolFiles[0, RowIndex].Value = LCF.LedWizNumber.ToString();
                LedcontrolFiles[1, RowIndex].Value = LCF.Filename;
                LedcontrolFiles[2, RowIndex].Value = LCF.Status;
            }
            LedcontrolFiles.ClearSelection();
            LedcontrolFiles.Refresh();
        }
Пример #3
0
        private void LedcontrolFiles_UserAddedRow(object sender, DataGridViewRowEventArgs e)
        {
            if (LedcontrolFiles.Rows.Count > 16)
            {
                LedcontrolFiles.AllowUserToAddRows = false;

                while (LedcontrolFiles.Rows.Count > 17)
                {
                    LedcontrolFiles.Rows.RemoveAt(LedcontrolFiles.Rows.Count - 1);
                    LedcontrolFiles.Refresh();
                }
            }
            else
            {
                LedcontrolFiles.AllowUserToAddRows = true;
            }
        }