/// <summary> /// Shows current color values. /// </summary> private void ShowCurrentColor() { // Get the active color var color = (SelectedGradient == null) ? KimonoColor.Black : SelectedGradient.SelectedColor; // Update color selector PointColor.Color = NSColor.FromRgba(color.Red / 255f, color.Green / 255f, color.Blue / 255f, color.Alpha / 255f); OpacitySlider.IntValue = color.Alpha; OpacityValue.StringValue = $"{(int)((OpacitySlider.IntValue / 255f) * 100f)}%"; // Populate the list of colors LinkedColorDropdown.RemoveAllItems(); LinkedColorDropdown.AddItem("None"); var n = 0; foreach (KimonoColor namedColor in Portfolio.Colors) { // Add color LinkedColorDropdown.AddItem(namedColor.Name); ++n; // Currently selected color? if (SelectedGradient.SelectedHandle?.LinkedColor == namedColor) { // Yes, highlight it LinkedColorDropdown.SelectItem(n); } } // Is a gradient selected? if (SelectedGradient.SelectedHandle == null || SelectedGradient.SelectedHandle.HandleType == KimonoHandleType.GradientPosition) { LinkedColorDropdown.Enabled = false; AddColorButton.Hidden = true; PointColor.Enabled = false; OpacitySlider.Enabled = false; OpacityValue.Enabled = false; DeletePointButton.Enabled = false; DuplicatePointButton.Enabled = false; } else { LinkedColorDropdown.Enabled = true; DuplicatePointButton.Enabled = true; AddColorButton.Hidden = (SelectedGradient.SelectedHandle.LinkedColor != null); PointColor.Enabled = (SelectedGradient.SelectedHandle.LinkedColor == null); OpacitySlider.Enabled = PointColor.Enabled; OpacityValue.Enabled = PointColor.Enabled; DeletePointButton.Enabled = (SelectedGradient.SelectedHandle.Constraint != KimonoHandleConstraint.Locked); } }
void ReleaseDesignerOutlets() { if (DesignPreview != null) { DesignPreview.Dispose(); DesignPreview = null; } if (AddColorButton != null) { AddColorButton.Dispose(); AddColorButton = null; } if (AddPointButton != null) { AddPointButton.Dispose(); AddPointButton = null; } if (BackButton != null) { BackButton.Dispose(); BackButton = null; } if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } if (DeletePointButton != null) { DeletePointButton.Dispose(); DeletePointButton = null; } if (DesignBar != null) { DesignBar.Dispose(); DesignBar = null; } if (DuplicateButton != null) { DuplicateButton.Dispose(); DuplicateButton = null; } if (DuplicatePointButton != null) { DuplicatePointButton.Dispose(); DuplicatePointButton = null; } if (GradientName != null) { GradientName.Dispose(); GradientName = null; } if (LinkedColorDropdown != null) { LinkedColorDropdown.Dispose(); LinkedColorDropdown = null; } if (OpacitySlider != null) { OpacitySlider.Dispose(); OpacitySlider = null; } if (OpacityValue != null) { OpacityValue.Dispose(); OpacityValue = null; } if (PointColor != null) { PointColor.Dispose(); PointColor = null; } if (SelectedColorTitle != null) { SelectedColorTitle.Dispose(); SelectedColorTitle = null; } if (TileDropdown != null) { TileDropdown.Dispose(); TileDropdown = null; } if (TypeDropdown != null) { TypeDropdown.Dispose(); TypeDropdown = null; } if (RadiusSlider != null) { RadiusSlider.Dispose(); RadiusSlider = null; } if (RadiusValue != null) { RadiusValue.Dispose(); RadiusValue = null; } }