Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/CS/BarTutorials/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/CS/BarTutorials/SampleStart.cs

using System;
using System.Windows.Forms;

namespace DevExpress.XtraBars.Demos.Tutorials {
	/// <summary>
	/// Summary description for SampleStart.
	/// </summary>
	public partial class SampleStart : TutorialControl {
		public SampleStart() {
			InitializeComponent();
			Sample = null;
		}

        Form fSample = null;
		Form Sample {
			get { return fSample; }
			set {
				fSample = value;
				sbStart.Enabled = fSample == null;
				sbClose.Enabled = fSample != null;
			}
		}
		protected virtual Form CreateSample() {
			return null;
		}

		private void sbStart_Click(object sender, System.EventArgs e) {
			Sample = CreateSample();
			if(Sample == null) return;
			Sample.Closed += new EventHandler(Sample_Close);
			Sample.Show();
		}

		void Sample_Close(object sender, EventArgs e) {
			Sample.Closed -= new EventHandler(Sample_Close);
			Sample.Dispose();
			Sample = null;
		}

		void CloseSample() {
			if(Sample != null) Sample.Close();
		}

		private void sbClose_Click(object sender, System.EventArgs e) {
			CloseSample();
		}

		protected override void DoVisibleChanged(bool visible) {
			base.DoVisibleChanged(visible);
			CloseSample();
		}
	}

	public class MDIMenuMergingStart : SampleStart {
		protected override Form CreateSample() {
			return new DevExpress.XtraBars.Demos.Tutorials.frmMDIMenuMerging();
		}
	}

	public class MostRecentFilesStart : SampleStart {
		protected override Form CreateSample() {
			return new DevExpress.XtraBars.Demos.Tutorials.frmMostRecentFiles();
		}
	}

	public class TabbedMDIStart : SampleStart {
		protected override Form CreateSample() {
			return new DevExpress.XtraBars.Demos.Tutorials.frmTabbedMDI();
		}
	}

    public class DocumentManagerStart : SampleStart {
        protected override Form CreateSample() {
            return new DevExpress.XtraBars.Demos.Tutorials.frmDocumentManager();
        }
    }
    public class DocumentManagerNativeMdiStart : SampleStart {
        protected override Form CreateSample() {
            return new DevExpress.XtraBars.Demos.Tutorials.frmDocumentManagerNative();
        }
    }

    public class DocumentManagerDockingStart : SampleStart {
        protected override Form CreateSample() {
            return new DevExpress.XtraBars.Demos.Tutorials.frmDocumentManagerDocking();
        }
    }

}