Mini Kabibi Habibi

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

using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using DevExpress.DXperience.Demos;
using DevExpress.Utils.Menu;
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Control;
using DevExpress.XtraPrintingLinks;
using System.Globalization;

namespace DevExpress.XtraMap.Demos {
    public class MapTutorialControl : TutorialControlBase, IDXMenuManager {
        #region static
        public static string GetSaveFileName(string defaulName) {
            return GetSaveFileName("Xlsx files(*.xlsx)|*.xlsx|All files (*.*)|*.*", defaulName);
        }
        public static string GetSaveFileName(string filter, string defaulName) {
            SaveFileDialog sfDialog = new SaveFileDialog();
            sfDialog.Filter = filter;
            sfDialog.FileName = defaulName;
            if(sfDialog.ShowDialog() != DialogResult.OK)
                return null;
            return sfDialog.FileName;
        }
        public static void ShowFile(string fileName, TutorialControlBase control) {
            if(!File.Exists(fileName))
                return;
            DialogResult dResult = XtraMessageBox.Show(control.LookAndFeel, control, String.Format("Do you want to open the resulting file?", fileName), control.TutorialName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if(dResult == DialogResult.Yes)
                Process.Start(fileName);
        }
        #endregion
        #region fields
        private LookAndFeelMenu menu = null;
        IDXMenuManager fMenuManager;
        #endregion

        public MapTutorialControl() {
            InitializeComponent();
        }
        
        #region properties
        public LookAndFeelMenu DemoMainMenu {
            get { return menu; }
            set {
                if (menu == value) return;
                this.menu = value;
            }
        }
        public IDXMenuManager MenuManager {
            get { return fMenuManager; }
            set { fMenuManager = value; }
        }
        public virtual bool ShowOptions { get { return false; } }
        #endregion
        #region initialize
        private void InitializeComponent() {
            this.SuspendLayout();
            this.Name = "MapTutorialControl";
            this.Size = new System.Drawing.Size(500, 500);
            this.ResumeLayout(false);

        }
        #endregion

        void IDXMenuManager.ShowPopupMenu(DXPopupMenu menu, Control control, Point pos) {
            MenuManagerHelper.ShowMenu(menu, LookAndFeel, fMenuManager, control, pos);
        }
        
        IDXMenuManager IDXMenuManager.Clone(Form newForm) { return this; }

        void IDXMenuManager.DisposeManager() { }

        protected BingMapDataProvider CreateBingDataProvider(BingMapKind kind) {
            return new BingMapDataProvider() { BingKey = DemoUtils.DevexpressBingKey, Kind = kind };
        }
        protected override void SetControlManager(Control ctrl, BarManager manager) {
            BaseEdit be = ctrl as BaseEdit;
            if (be != null) be.MenuManager = manager;
        }


    }
}