void ReleaseDesignerOutlets() { if (ClickButton != null) { ClickButton.Dispose(); ClickButton = null; } if (ClickCountLabel != null) { ClickCountLabel.Dispose(); ClickCountLabel = null; } if (ClickLabel != null) { ClickLabel.Dispose(); ClickLabel = null; } if (ContainerView != null) { ContainerView.Dispose(); ContainerView = null; } if (DescriptionLabel != null) { DescriptionLabel.Dispose(); DescriptionLabel = null; } if (EnableLabel != null) { EnableLabel.Dispose(); EnableLabel = null; } if (EnableSwitch != null) { EnableSwitch.Dispose(); EnableSwitch = null; } }
void ReleaseDesignerOutlets() { if (ClickButton != null) { ClickButton.Dispose(); ClickButton = null; } if (ClickCountLabel != null) { ClickCountLabel.Dispose(); ClickCountLabel = null; } if (ClickLabel != null) { ClickLabel.Dispose(); ClickLabel = null; } if (ContainerView != null) { ContainerView.Dispose(); ContainerView = null; } if (DescriptionLabel != null) { DescriptionLabel.Dispose(); DescriptionLabel = null; } if (LongClickCountLabel != null) { LongClickCountLabel.Dispose(); LongClickCountLabel = null; } if (LongClickLabel != null) { LongClickLabel.Dispose(); LongClickLabel = null; } }
/// <summary> /// Initializes a new instance of the <see cref="PluginEntry"/> class. /// </summary> /// <param name="plugin">The plugin.</param> /// <param name="category">The category.</param> /// <param name="desc">Plugin description</param> public PluginEntry(Plugin plugin, CategoryEntry category, ref PluginDescription desc) { Plugin = plugin; Category = category; float margin = 4; float iconSize = 64; var iconImage = new Image { Brush = new SpriteBrush(Editor.Instance.Icons.Plugin64), Parent = this, Bounds = new Rectangle(margin, margin, iconSize, iconSize), }; var icon = PluginUtils.TryGetPluginIcon(plugin); if (icon) { iconImage.Brush = new TextureBrush(icon); } Size = new Vector2(300, 100); float tmp1 = iconImage.Right + margin; var nameLabel = new Label { HorizontalAlignment = TextAlignment.Near, AnchorPreset = AnchorPresets.HorizontalStretchTop, Text = desc.Name, Font = new FontReference(Style.Current.FontLarge), Parent = this, Bounds = new Rectangle(tmp1, margin, Width - tmp1 - margin, 28), }; tmp1 = nameLabel.Bottom + margin + 8; var descLabel = new Label { HorizontalAlignment = TextAlignment.Near, VerticalAlignment = TextAlignment.Near, Wrapping = TextWrapping.WrapWords, AnchorPreset = AnchorPresets.HorizontalStretchTop, Text = desc.Description, Parent = this, Bounds = new Rectangle(nameLabel.X, tmp1, nameLabel.Width, Height - tmp1 - margin), }; string versionString = string.Empty; if (desc.IsAlpha) { versionString = "ALPHA "; } else if (desc.IsBeta) { versionString = "BETA "; } versionString += "Version "; versionString += desc.Version != null?desc.Version.ToString() : "1.0"; var versionLabel = new Label { HorizontalAlignment = TextAlignment.Far, VerticalAlignment = TextAlignment.Center, AnchorPreset = AnchorPresets.TopRight, Text = versionString, Parent = this, Bounds = new Rectangle(Width - 140 - margin, margin, 140, 14), }; string url = null; if (!string.IsNullOrEmpty(desc.AuthorUrl)) { url = desc.AuthorUrl; } else if (!string.IsNullOrEmpty(desc.HomepageUrl)) { url = desc.HomepageUrl; } else if (!string.IsNullOrEmpty(desc.RepositoryUrl)) { url = desc.RepositoryUrl; } versionLabel.Font.Font.WaitForLoaded(); var font = versionLabel.Font.GetFont(); var authorWidth = font.MeasureText(desc.Author).X + 8; var authorLabel = new ClickLabel { HorizontalAlignment = TextAlignment.Far, VerticalAlignment = TextAlignment.Center, AnchorPreset = AnchorPresets.TopRight, Text = desc.Author, Parent = this, Bounds = new Rectangle(Width - authorWidth - margin, versionLabel.Bottom + margin, authorWidth, 14), }; if (url != null) { authorLabel.TextColorHighlighted = Style.Current.BackgroundSelected; authorLabel.DoubleClick = () => Platform.OpenUrl(url); } }