Beispiel #1
0
        internal static clsTemplate LoadTemplate(string filename, sherm.rpt.BuiltinReportDescriptor.mydelegate my)
        {
            string raw;
            var    assy = System.Reflection.Assembly.GetExecutingAssembly();
            /* 1. do we have it on disk? */
            var binpath    = assy.Location;
            var rootpath   = Directory.GetParent(Path.GetDirectoryName(binpath)).ToString();
            var rtpath     = Path.Combine(rootpath, "rt");
            var pagespath  = Path.Combine(rtpath, "pages");
            var rptpath    = Path.Combine(pagespath, "reporting");
            var searchpath = Path.Combine(rptpath, filename);

            if (File.Exists(searchpath))
            {
                try
                {
                    raw = File.ReadAllText(searchpath);
                }
                catch (Exception ef)
                {
                    throw new Exception(String.Format("Failed to read \"{0}\" from file system", searchpath), ef);
                }
            }
            else
            {
                try
                {
                    using (var strraw = assy.GetManifestResourceStream(typeof(HtmlTemplatesType), filename))
                    {
                        using (StreamReader sr = new StreamReader(strraw, System.Text.Encoding.UTF8, true))
                        {
                            raw = sr.ReadToEnd();
                        }
                    }
                }
                catch (Exception es)
                {
                    throw new Exception(String.Format("Failed to read \"{0}\" from resources", filename), es);
                }
            }
            /* build an active template */
            var tmp = new clsTemplate(my)
            {
                filename = filename
            };

            if (!tmp.Load(raw))
            {
                throw new ArgumentOutOfRangeException("filename", filename, "could not load and tokenize this template.");
            }
            return(tmp);
        }
Beispiel #2
0
 public clsTemplate(sherm.rpt.BuiltinReportDescriptor.mydelegate xmy)
 {
     my = xmy;
 }
Beispiel #3
0
        }                                  /* [dlatikay 20111205] we need to be able to control this; we do not want animation during offline rendition in PDF generator (waste of time) */

        public Chart(sherm.rpt.BuiltinReportDescriptor.mydelegate myx)
        {
            Graphs = new List <ChartGraph>();
            Series = new List <ChartSeries>();
            my     = myx;
        }