Beispiel #1
0
        public async Task BlockDevice(string IpAddress, string MacAddress)
        {
            try
            {
                var ListDevice = DeviceList.Objects.Cast <Device>().FirstOrDefault(d => d.MAC.Equals(PhysicalAddress.Parse(MacAddress)));

                if (ListDevice != null && !(ListDevice.IsGateway || ListDevice.IsLocalDevice) && !(ListDevice.Blocked || ListDevice.Redirected))
                {
                    //6 is the index of the blocking column
                    if (await SubItemCheckingHandler(CheckState.Unchecked, CheckState.Checked, 6, ListDevice))
                    {
                        DeviceList.CheckSubItem(ListDevice, olvColumn6);
                    }
                }
            }
            catch
            {
                MetroMessageBox.Show(this, "Operation failed!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }