private void Enable() { Debug.Assert(layer != null, "We cannot decide whether the form is enabled without layer!"); var enabled = layer.IsRequestedIndividually() && supportedCrs.SelectedIndex != -1; supportedCrs.Enabled = enabled; downloadOneImage.Enabled = enabled && !layer.IsLeaf(); autoUpdate.Enabled = enabled; imageFormats.Enabled = enabled; Debug.Assert(!enabled || imageFormats.SelectedIndex != -1, "At least one image format must be selected!"); transparent.Enabled = enabled && Wms.AbleToBeTransparent(layer.ImageFormat); transparentColor.Enabled = enabled; imageAddress.Enabled = enabled; }
public void Refresh(Layer newLayer) { layer = newLayer; if (newLayer != null) { FillCrsComboBox(); layerTitle.Text = newLayer.Title; layerDescription.Text = newLayer.Description; downloadOneImage.Checked = newLayer.DownloadOneImage; autoUpdate.Checked = newLayer.AutoUpdate; FillImageFormatsComboBox(); transparent.Checked = newLayer.IsTransparent && Wms.AbleToBeTransparent(newLayer.ImageFormat); transparentColor.Text = ColorTranslator.ToHtml(newLayer.BgColor); transparentColor.ForeColor = GetContrastColor(newLayer.BgColor); transparentColor.BackColor = newLayer.BgColor; Enabled = true; Enable(); } else { Enabled = false; supportedCrs.Items.Clear(); layerTitle.Text = string.Empty; layerDescription.Text = string.Empty; downloadOneImage.Checked = true; autoUpdate.Checked = true; imageFormats.Items.Clear(); transparent.Checked = true; transparentColor.Text = string.Empty; transparentColor.ForeColor = SystemColors.WindowText; transparentColor.BackColor = SystemColors.Control; } RefreshImageAddress(); }