private void Deltete_Click(object sender, EventArgs e) { if (MessageBox.Show("选择的设备将被删除,是否继续?", "警告", MessageBoxButtons.YesNo) == DialogResult.No) { return; } IList <TaskDevice> sor = this.TaskDevices; int[] s; if (GridCtl.MainView is DevExpress.XtraGrid.Views.Grid.GridView) { DevExpress.XtraGrid.Views.Grid.GridView grid = GridCtl.MainView as DevExpress.XtraGrid.Views.Grid.GridView; s = grid.GetSelectedRows(); } else { DevExpress.XtraGrid.Views.Tile.TileView tile = GridCtl.MainView as DevExpress.XtraGrid.Views.Tile.TileView; s = tile.GetSelectedRows(); } for (int index = s.Length - 1; index >= 0; index--) { sor.RemoveAt(s[index]); } this.IniDeviceItem(sor); this.GridCtl.RefreshDataSource(); }
private void DeleteTask_Click(object sender, EventArgs e) { if (MessageBox.Show("选择的任务将被删除,是否继续?", "警告", MessageBoxButtons.YesNo) == DialogResult.No) { return; } IList <FilterItem> sor = this.FilterItems; int[] s; if (GridCtlFilter.MainView is DevExpress.XtraGrid.Views.Tile.TileView) { DevExpress.XtraGrid.Views.Tile.TileView tile = GridCtlFilter.MainView as DevExpress.XtraGrid.Views.Tile.TileView; s = tile.GetSelectedRows(); for (int index = s.Length - 1; index >= 0; index--) { if (Common.DeleteTaskFiles(sor[s[index]].Name)) { sor.RemoveAt(s[index]); if (s[index] != sor.Count) { tile.ViewCaption = sor[s[index]].Name; this.SelectedItem = sor[s[index]]; } } } } this.IniFilterItem(sor); this.GridCtlFilter.RefreshDataSource(); }