<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace AeroSuite.Controls
{
    /// <summary>
    /// A simple Back/Forward Button drawn by Windows via Visual Styles if available.
    /// </summary>
    /// <remarks>
    /// The button is drawn with Visual Styles (Navigation > BackButton/ForwardButton). If running on XP or another OS, the button is drawn manually (in a kinda-Metro-Style)
    /// </remarks>
    [DesignerCategory("Code")]
    [DisplayName("Aero LinkLabel")]
    [Description("A simple Back/Forward Button drawn by Windows via Visual Styles if available.")]
    [ToolboxItem(true)]
    [ToolboxBitmap(typeof(Button))]
    public class NavigationButton
        : Control
    {
        /// <summary>
        /// Returns the default size.
        /// </summary>
        /// <value>
        /// The default size.
        /// </value>
        protected override Size DefaultSize
        {
            get
            {
                return new Size(30, 30);
            }
        }

        private NavigationButtonType type { get; set; } = NavigationButtonType.Back;
        /// <summary>
        /// Indicates the type.
        /// </summary>
        /// <value>
        /// The type.
        /// </value>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //[DefaultValue(NavigationButtonType.Back)]
        [RefreshProperties(RefreshProperties.All)]
        [Description("Indicates the type.")]
        [Category("Appearance")]
        public NavigationButtonType Type
        {
            get
            {
                return this.type;
            }
            set
            {
                this.type = value;
                this.Invalidate();
            }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationButton"/> class.
        /// </summary>
        public NavigationButton()
        {
            this.type = NavigationButtonType.Back;
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
            this.UpdateStyles();
        }

        /// <summary>
        /// Raises the <see cref="E:Paint" /> event.
        /// </summary>
        /// <param name="e">The <see cref="PaintEventArgs"/> instance containing the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            if (PlatformHelper.VistaOrHigher && PlatformHelper.VisualStylesEnabled)
            {<commit_msg>Update NavigationButton.CS<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace AeroSuite.Controls
{
    /// <summary>
    /// A simple Back/Forward Button drawn by Windows via Visual Styles if available.
    /// </summary>
    /// <remarks>
    /// The button is drawn with Visual Styles (Navigation > BackButton/ForwardButton). If running on XP or another OS, the button is drawn manually (in a kinda-Metro-Style)
    /// </remarks>
    [DesignerCategory("Code")]
    [DisplayName("Aero LinkLabel")]
    [Description("A simple Back/Forward Button drawn by Windows via Visual Styles if available.")]
    [ToolboxItem(true)]
    [ToolboxBitmap(typeof(Button))]
    public class NavigationButton
        : Control
    {
        /// <summary>
        /// Returns the default size.
        /// </summary>
        /// <value>
        /// The default size.
        /// </value>
        protected override Size DefaultSize
        {
            get
            {
                return new Size(30, 30);
            }
        }

        private NavigationButtonType type { get; set; } = NavigationButtonType.Back;
        /// <summary>
        /// Indicates the type.
        /// </summary>
        /// <value>
        /// The type.
        /// </value>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //[DefaultValue(NavigationButtonType.Back)]
        [RefreshProperties(RefreshProperties.All)]
        [Description("Indicates the type.")]
        [Category("Appearance")]
        public NavigationButtonType Type
        {
            get
            {
                return this.type;
            }
            set
            {
                this.type = value;
                this.Invalidate();
            }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationButton"/> class.
        /// </summary>
        public NavigationButton()
        {
            this.type = NavigationButtonType.Back;
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
            this.UpdateStyles();
        }

        /// <summary>
        /// Raises the <see cref="E:Paint" /> event.
        /// </summary>
        /// <param name="e">The <see cref="PaintEventArgs"/> instance containing the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(VisualStyleElement.CreateElement("Navigation", 0, 0))/*PlatformHelper.VistaOrHigher && PlatformHelper.VisualStylesEnabled*/) //This seems to be the right check according to the MSDN: https://msdn.microsoft.com/en-us/library/vstudio/ms171735(v=vs.100).aspx
            {
{'fraction_non_alphanumeric': 0.11510289501220788, 'fraction_numerical': 0.0033135681897453785, 'mean_word_length': 1.9730430274753759, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 47, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1351607', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1451, 'n_words': 368}