Example #1
0
        virtual protected string BuildHtml(Hit hit)
        {
            StringBuilder htmlBuilder = new StringBuilder("");
            StreamReader  sr          = DataBarn.GetText(templateName);
            string        line;

            while ((line = sr.ReadLine()) != null)
            {
                TransformLineOfHtml(line, htmlBuilder);
            }

            return(htmlBuilder.ToString());
        }
        ///////////////////////////////////

        //
        // Provides data for urls requested (images).  Things prefixed
        // with `internal:' we pull for one of the embedded streams
        //
        private void UrlRequested(object o, UrlRequestedArgs args)
        {
            Stream s = DataBarn.GetStream(args.Url);

            if (s == null)
            {
                Console.WriteLine("Could not obtain image '{0}'", args.Url);
                return;
            }

            byte [] buffer = new byte [8192];
            int     n;

            while ((n = s.Read(buffer, 0, 8192)) != 0)
            {
                args.Handle.Write(buffer, n);
            }
        }
Example #3
0
        public HitRendererControl(string _name, string icon, HitRenderer r)
            : base(false, 3)
        {
            name     = _name;
            renderer = r;

            renderer.RefreshEvent += new HitRenderer.RefreshHandler(OnRefresh);

            if (icon != null)
            {
                Gtk.Widget iconW = DataBarn.GetImageWidget(icon);
                if (iconW != null)
                {
                    this.PackStart(iconW, false, false, 3);
                    iconW.Show();
                }
            }

            nameLabel = new Gtk.Label("");
            this.PackStart(nameLabel, false, false, 3);
            nameLabel.Show();


            nextButton          = new Gtk.Button("Next");
            nextButton.Clicked += new EventHandler(OnNextClicked);
            this.PackEnd(nextButton, false, false, 3);

            displayedLabel = new Gtk.Label("");
            this.PackEnd(displayedLabel, false, false, 3);
            displayedLabel.Show();

            prevButton          = new Gtk.Button("Prev");
            prevButton.Clicked += new EventHandler(OnPrevClicked);
            this.PackEnd(prevButton, false, false, 3);

            // Initialize things
            OnRefresh(null);
        }