Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/CS/ChartsMainDemo/Modules/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/CS/ChartsMainDemo/Modules/ChartDemoBase.cs

using System;
using DevExpress.XtraEditors;
using DevExpress.Utils;

namespace DevExpress.XtraCharts.Demos.Modules {
    public partial class ChartDemoBase : TutorialControl {
        protected PanelControl panel;
        protected CheckEdit checkEditShowLabels;

        protected bool CheckEditShowLabelsVisible {
            get { return checkEditShowLabels.Visible; }
            set { checkEditShowLabels.Visible = value; }
        }
        protected bool ShowLabels { 
            get { return checkEditShowLabels.Checked; } 
            set { checkEditShowLabels.Checked = value; } 
        }
        protected virtual DefaultBoolean CrosshairEnabled { get { return DefaultBoolean.Default; } }
        protected virtual DefaultBoolean ToolTipEnabled { get { return DefaultBoolean.Default; } }

        public string AppearanceName {
            get { return ChartControl == null ? String.Empty : ChartControl.AppearanceName; }
            set { SetAppearanceName(value); }
        }
        public string PaletteName {
            get { return ChartControl == null ? String.Empty : ChartControl.PaletteName; }
            set { 
                if (ChartControl != null)
                    ChartControl.PaletteName = value;
            }
        }

        public ChartDemoBase() {
            InitializeComponent();
        }
        protected void SetNumericOptions(Series series, NumericFormat format, int precision) {
            series.Label.PointOptions.ValueNumericOptions.Format = format;
            series.Label.PointOptions.ValueNumericOptions.Precision = precision;
        }
        protected virtual void ChartDemoBase_Load(object sender, EventArgs e) {
            if (ChartControl != null && !DesignMode) {
                InitControls();
                UpdateControls();
            }
        }
        protected virtual void SetAppearanceName(string appearanceName) {
            if (ChartControl != null)
                ChartControl.AppearanceName = appearanceName;
        }
        protected virtual void checkEditShowLabels_CheckedChanged(object sender, EventArgs e) {
            foreach (Series series in ChartControl.Series)
                if (series.Label != null)
                    series.LabelsVisibility = checkEditShowLabels.Checked ? DefaultBoolean.True : DefaultBoolean.False;
            ChartControl.CrosshairEnabled = checkEditShowLabels.Checked ? DefaultBoolean.False : CrosshairEnabled;
            ChartControl.ToolTipEnabled = checkEditShowLabels.Checked ? DefaultBoolean.False : ToolTipEnabled;
            UpdateControls();
        }        
        protected virtual void InitControls() {
        }
        public virtual void UpdateControls() {
        }
    }
}