Exemplo n.º 1
0
 private void bnReplaceRemove_Click(object sender, System.EventArgs e)
 {
     // multiselection is off, so we can cheat...
     int[] rowsIndex = this.ReplacementsGrid.Selection.GetSelectionRegion().GetRowsIndex();
     if (rowsIndex.Length > 0)
     {
         // don't delete compulsory items
         int    n    = rowsIndex[0];
         string from = (string)(this.ReplacementsGrid[n, 0].Value);
         if (string.IsNullOrEmpty(from) || (TVSettings.CompulsoryReplacements().IndexOf(from) == -1))
         {
             this.ReplacementsGrid.Rows.Remove(n);
         }
     }
 }
Exemplo n.º 2
0
        private void AddNewReplacementRow(string from, string to, bool ins)
        {
            SourceGrid.Cells.Views.Cell roModel = new SourceGrid.Cells.Views.Cell {
                ForeColor = Color.Gray
            };

            int r = this.ReplacementsGrid.RowsCount;

            this.ReplacementsGrid.RowsCount = r + 1;
            this.ReplacementsGrid[r, 0]     = new SourceGrid.Cells.Cell(from, typeof(string));
            this.ReplacementsGrid[r, 1]     = new SourceGrid.Cells.Cell(to, typeof(string));
            this.ReplacementsGrid[r, 2]     = new SourceGrid.Cells.CheckBox(null, ins);
            if (!string.IsNullOrEmpty(from) && (TVSettings.CompulsoryReplacements().IndexOf(from) != -1))
            {
                this.ReplacementsGrid[r, 0].Editor.EnableEdit = false;
                this.ReplacementsGrid[r, 0].View = roModel;
            }
        }