Beispiel #1
0
        void appearanceMenu_EndSkinChanging(object sender, EventArgs e)
        {
            ChartModuleBase currentDemo = ChartModulesInfo.CurrentModule as ChartModuleBase;

            if (currentDemo != null)
            {
                currentDemo.EndSkinChanging();
            }
        }
        public static void ShowModule(string name, DevExpress.XtraEditors.GroupControl group, ChartAppearanceMenu chartAppearanceMenu, IDXMenuManager menuManager, DevExpress.Utils.Frames.ApplicationCaption caption)
        {
            ModuleInfo item          = ChartModulesInfo.GetItem(name);
            Cursor     currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                Control oldTutorial = null;
                if (Instance.CurrentModuleBase != null)
                {
                    if (Instance.CurrentModuleBase.Name == name)
                    {
                        return;
                    }
                    oldTutorial = Instance.CurrentModuleBase.TModule;
                }

                TutorialControlBase tutorialBase = item.TModule as TutorialControlBase;
                tutorialBase.Bounds        = group.DisplayRectangle;
                Instance.CurrentModuleBase = item;
                tutorialBase.Visible       = false;
                group.Controls.Add(tutorialBase);
                tutorialBase.Dock = DockStyle.Fill;

                //-----Init----
                //-----Set----
                tutorialBase.TutorialName = name;
                tutorialBase.Caption      = caption;

                TutorialControl tutorial = tutorialBase as TutorialControl;
                if (tutorial != null)
                {
                    tutorial.MenuManager = menuManager;
                }

                ChartModuleBase chartDemo = tutorialBase as ChartModuleBase;
                chartAppearanceMenu.UpdateAppearanceAndPalette();

                bool wizardAndPrintAndAppearancesMenuEnabled = chartDemo != null;
                chartAppearanceMenu.EnableWizardAndPrintAndAppearancesMenu(wizardAndPrintAndAppearancesMenuEnabled);
                //------------

                tutorialBase.Visible = true;
                item.WasShown        = true;
                if (oldTutorial != null)
                {
                    oldTutorial.Visible = false;
                }
            }
            finally
            {
                Cursor.Current = currentCursor;
            }
            RaiseModuleChanged();
        }
 public static void SaveChartTemplate(ChartTemplateInfo template)
 {
     if (Instance.CurrentModuleBase != null)
     {
         ChartModuleBase chartModule = Instance.CurrentModuleBase.TModule as ChartModuleBase;
         if (chartModule != null)
         {
             chartModule.SaveChartControl(template);
         }
     }
 }
 public static string SetPaletteName(string paletteName)
 {
     if (Instance.CurrentModuleBase != null)
     {
         ChartModuleBase chartModule = Instance.CurrentModuleBase.TModule as ChartModuleBase;
         if (chartModule != null)
         {
             chartModule.PaletteName = paletteName;
             return(chartModule.AppearanceName);
         }
     }
     return(String.Empty);
 }
        public static ChartTemplateInfo GetChartTemplate()
        {
            if (Instance.CurrentModuleBase != null)
            {
                ChartModuleBase chartModule = Instance.CurrentModuleBase.TModule as ChartModuleBase;
                if (chartModule != null)
                {
                    return(chartModule.Template);
                }
            }

            return(null);
        }
 public static void RunChartWizard()
 {
     if (Instance.CurrentModuleBase != null)
     {
         ChartModuleBase chartModule = Instance.CurrentModuleBase.TModule as ChartModuleBase;
         if (chartModule != null)
         {
             ChartWizard chartWizard = new ChartWizard(chartModule.ChartControl);
             chartWizard.ShowDialog();
             chartModule.UpdateControls();
         }
     }
 }
 public static void InitChartControl(IClientRuleQueryBase clientRule, object datasource, ChartTemplateInfo template)
 {
     if (Instance.CurrentModuleBase != null)
     {
         ChartModuleBase chartModule = Instance.CurrentModuleBase.TModule as ChartModuleBase;
         if (chartModule != null)
         {
             chartModule.Template = template;
             chartModule.InitChartControl(clientRule);
             //绑定数据源
             chartModule.BindingChartControl(datasource);
         }
     }
 }
        public static void SaveTemplate(ChartTemplateInfo template)
        {
            try
            {
                if (template.ID <= 0)
                {
                    string tempType = template.TEMPLATE_TYPE;
                    string name     = template.NAME;

                    FrmSaveTemplate frm = new FrmSaveTemplate(tempType, name);
                    frm.ShowDialog();

                    if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        template.NAME          = frm.TemplateName;
                        template.TEMPLATE_TYPE = frm.TemplateType;
                    }
                    else
                    {
                        return;
                    }
                }

                string path = AppDomain.CurrentDomain.BaseDirectory + "\\ChartTemplate\\" + template.TEMPLATE_TYPE + "_" + template.NAME + ".xml";

                if (Instance.CurrentModuleBase == null)
                {
                    return;
                }
                ChartModuleBase chartDemoBase = Instance.CurrentModuleBase.TModule as ChartModuleBase;
                if (chartDemoBase == null)
                {
                    return;
                }
                chartDemoBase.ChartControl.SaveToFile(path);

                byte[] file = File.ReadAllBytes(path);

                template.TEMPLATE_FILE = file;
                File.Delete(path);

                MB.WinDxChart.Chart.DxChartControlHelper.Instance.SaveChartTemplate(template);
            }
            catch (Exception ex)
            {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }
        static ChartControl PrepeareForPrintOrExport(bool checkPrinterAvailable)
        {
            if (!PrintHelper.IsPrintingAvailable && checkPrinterAvailable)
            {
                XtraMessageBox.Show("XtraPrinting Library is currently inaccesible.", "XtraCharts Demo");
                return(null);
            }
            if (Instance.CurrentModuleBase == null)
            {
                return(null);
            }
            ChartModuleBase chartDemoBase = Instance.CurrentModuleBase.TModule as ChartModuleBase;

            if (chartDemoBase == null)
            {
                return(null);
            }
            return(chartDemoBase.ChartControl);
        }