Ejemplo n.º 1
0
 private void chartToolStrip1_TemplateAction(object sender, TemplateActionEventArgs args)
 {
   switch (args.ActionType)
   {
     case TemplateActionType.Load:
       this.template = Global.ChartManager.Templates[args.TemplateName];
       this.ApplyTemplate();
       ((Control) this.chart).Refresh();
       break;
     case TemplateActionType.Save:
     case TemplateActionType.SaveAs:
       SaveTemplateDialog saveTemplateDialog = new SaveTemplateDialog();
       if (saveTemplateDialog.ShowDialog() != DialogResult.OK)
         break;
       Global.ChartManager.Templates.Add(saveTemplateDialog.TemplateName, this.template);
       break;
     case TemplateActionType.ChooseEmpty:
       this.template = Global.ChartManager.Templates.EmptyTemplate;
       this.ApplyTemplate();
       ((Control) this.chart).Refresh();
       break;
     case TemplateActionType.ChooseDefault:
       this.template = Global.ChartManager.Templates["Default Template"];
       this.ApplyTemplate();
       ((Control) this.chart).Refresh();
       break;
     case TemplateActionType.SetDefault:
       Global.ChartManager.Templates.Replace("Default Template", this.template);
       break;
   }
 }
Ejemplo n.º 2
0
        private void chartToolStrip1_TemplateAction(object sender, TemplateActionEventArgs args)
        {
            switch (args.ActionType)
            {
            case TemplateActionType.Load:
                this.template = Global.ChartManager.Templates[args.TemplateName];
                this.ApplyTemplate();
                ((Control)this.chart).Refresh();
                break;

            case TemplateActionType.Save:
            case TemplateActionType.SaveAs:
                SaveTemplateDialog saveTemplateDialog = new SaveTemplateDialog();
                if (saveTemplateDialog.ShowDialog() != DialogResult.OK)
                {
                    break;
                }
                Global.ChartManager.Templates.Add(saveTemplateDialog.TemplateName, this.template);
                break;

            case TemplateActionType.ChooseEmpty:
                this.template = Global.ChartManager.Templates.EmptyTemplate;
                this.ApplyTemplate();
                ((Control)this.chart).Refresh();
                break;

            case TemplateActionType.ChooseDefault:
                this.template = Global.ChartManager.Templates["Default Template"];
                this.ApplyTemplate();
                ((Control)this.chart).Refresh();
                break;

            case TemplateActionType.SetDefault:
                Global.ChartManager.Templates.Replace("Default Template", this.template);
                break;
            }
        }