Ejemplo n.º 1
0
        private void AddHolds(GridViewSelectedRowsCollection selectedRows)
        {
            string holdId = InputDialog.Show("Enter Hold Id:", "Add Machine Hold");

            if (string.IsNullOrWhiteSpace(holdId))
            {
                // User cancelled
                return;
            }

            var hostNames = selectedRows.Select(n => n.Cells[GridColumns.NAME_GRID_COLUMN].Value.ToString());

            try
            {
                this.Cursor = Cursors.WaitCursor;
                VMInventoryManager.AddHold(hostNames, holdId);

                foreach (var row in selectedRows)
                {
                    row.Cells[GridColumns.HOLDID_GRID_COLUMN].Value = holdId;
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        private void SetUsage(GridViewSelectedRowsCollection selectedRows, VMUsageState state)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                var hostNames = selectedRows.Select(n => n.Cells[GridColumns.NAME_GRID_COLUMN].Value.ToString());
                VMInventoryManager.SetUsageState(hostNames, state);

                RefreshGrid();
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 3
0
        private void RemoveHolds(GridViewSelectedRowsCollection selectedRows)
        {
            var hostNames = selectedRows.Select(n => n.Cells[GridColumns.NAME_GRID_COLUMN].Value.ToString());

            try
            {
                this.Cursor = Cursors.WaitCursor;
                VMInventoryManager.RemoveHold(hostNames);

                foreach (var row in selectedRows)
                {
                    row.Cells[GridColumns.HOLDID_GRID_COLUMN].Value = null;
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }