예제 #1
0
파일: Text.cs 프로젝트: cnxsoft/xibo4arm
        /// <summary>
        /// Creates a Text display control
        /// </summary>
        /// <param name="options">Region Options for this control</param>
        public Text(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            // Collect some options from the Region Options passed in
            // and store them in member variables.
            _filePath = options.uri;
            _direction = options.direction;
            _backgroundImage = options.backgroundImage;
            _backgroundColor = options.backgroundColor;
            _scaleFactor = options.scaleFactor;
            _backgroundTop = options.backgroundTop + "px";
            _backgroundLeft = options.backgroundLeft + "px";
            _documentText = options.text;
            _scrollSpeed = options.scrollSpeed;
            _headJavaScript = options.javaScript;

            // Generate a temporary file to store the rendered object in.
            _tempHtml = new TemporaryHtml();

            // Generate the Head Html and store to file.
            GenerateHeadHtml();

            // Generate the Body Html and store to file.
            GenerateBodyHtml();

            // Fire up a webBrowser control to display the completed file.
            _webBrowser = new WebBrowser();
            _webBrowser.Size = this.Size;
            _webBrowser.ScrollBarsEnabled = false;
            _webBrowser.ScriptErrorsSuppressed = true;
            _webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);

            // Navigate to temp file
            _webBrowser.Navigate(_tempHtml.Path);
        }
예제 #2
0
        public Flash(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            _tempHtml = new TemporaryHtml();

            _backgroundImage = options.backgroundImage;
            _backgroundColor = options.backgroundColor;
            _backgroundTop   = options.backgroundTop + "px";
            _backgroundLeft  = options.backgroundLeft + "px";

            // Create the HEAD of the document
            GenerateHeadHtml();

            // Set the body
            string html = @"
                <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='{2}' height='{3}' id='analog_clock' align='middle'>
                    <param name='allowScriptAccess' value='sameDomain' />
                    <param name='movie' value='{1}' />
                    <param name='quality' value='high' />
                    <param name='bgcolor' value='#000' />
                    <param name='WMODE' value='transparent' />
                    <embed src='{1}' quality='high' wmode='transparent' bgcolor='#ffffff' width='{2}' height='{3}' name='analog_clock' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />
                </object>
            ";

            _tempHtml.BodyContent = string.Format(html, options.uri, options.uri, options.width.ToString(), options.height.ToString());

            // Fire up a webBrowser control to display the completed file.
            _webBrowser      = new WebBrowser();
            _webBrowser.Size = this.Size;
            _webBrowser.ScrollBarsEnabled      = false;
            _webBrowser.ScriptErrorsSuppressed = true;
            _webBrowser.DocumentCompleted     += new WebBrowserDocumentCompletedEventHandler(_webBrowser_DocumentCompleted);

            // Navigate to temp file
            _webBrowser.Navigate(_tempHtml.Path);
            Controls.Add(_webBrowser);

            // Show the control
            Show();
        }
예제 #3
0
        public Flash (RegionOptions options)
            : base(options.width, options.height, options.top, options.left) 
        {
            _tempHtml = new TemporaryHtml();

            _backgroundImage = options.backgroundImage;
            _backgroundColor = options.backgroundColor; 
            _backgroundTop = options.backgroundTop + "px";
            _backgroundLeft = options.backgroundLeft + "px";

            // Create the HEAD of the document
            GenerateHeadHtml();

            // Set the body
            string html = @"
                <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='{2}' height='{3}' id='analog_clock' align='middle'>
                    <param name='allowScriptAccess' value='sameDomain' />
                    <param name='movie' value='{1}' />
                    <param name='quality' value='high' />
                    <param name='bgcolor' value='#000' />
                    <param name='WMODE' value='transparent' />
                    <embed src='{1}' quality='high' wmode='transparent' bgcolor='#ffffff' width='{2}' height='{3}' name='analog_clock' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />
                </object>
            ";

            _tempHtml.BodyContent = string.Format(html, options.uri, options.uri, options.width.ToString(), options.height.ToString());

            // Fire up a webBrowser control to display the completed file.
            _webBrowser = new WebBrowser();
            _webBrowser.Size = this.Size;
            _webBrowser.ScrollBarsEnabled = false;
            _webBrowser.ScriptErrorsSuppressed = true;
            _webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(_webBrowser_DocumentCompleted);

            // Navigate to temp file
            _webBrowser.Navigate(_tempHtml.Path);
            Controls.Add(_webBrowser);

            // Show the control
            Show();
        }
예제 #4
0
파일: Rss.cs 프로젝트: cnxsoft/xibo4arm
        /// <summary>
        /// Creates an RSS position with the RegionOptions parameter
        /// </summary>
        /// <param name="options"></param>
        public Rss(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            if (String.IsNullOrEmpty(options.uri))
            {
                throw new ArgumentNullException("Uri", "The Uri for the RSS feed can not be empty");
            }

            // Try to make a URI out of the file path
            try
            {
                _filePath = Uri.UnescapeDataString(options.uri);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message, "Rss");

                throw new ArgumentNullException("Uri", "The URI is invalid.");
            }

            Debug.WriteLine("Ticker URL: " + _filePath + ". Options count: " + options.Dictionary.Count.ToString());

            // Set the parameters based on the RegionOptions
            _direction = options.direction;
            _backgroundImage = options.backgroundImage;
            _backgroundColor = options.backgroundColor;
            _copyrightNotice = options.copyrightNotice;
            _mediaid = options.mediaid;
            _scheduleId = options.scheduleId;
            _layoutId = options.layoutId;
            _scaleFactor = options.scaleFactor;
            _duration = options.duration;

            // Update interval and scrolling speed
            _updateInterval = options.updateInterval;
            _scrollSpeed = options.scrollSpeed;

            Debug.WriteLine(String.Format("Scrolling Speed: {0}, Update Interval: {1})", _scrollSpeed.ToString(), _updateInterval.ToString()), "Rss - Constructor");

            // Items to show and duration
            _numItems = Convert.ToInt32(options.Dictionary.Get("numItems", "0"));
            _durationIsPerItem = Convert.ToInt32(options.Dictionary.Get("durationIsPerItem", "0"));
            _takeItemsFrom = options.Dictionary.Get("takeItemsFrom", "start");

            // Generate a temporary file to store the rendered object in.
            _tempHtml = new TemporaryHtml();

            // Set up the backgrounds
            _backgroundTop = options.backgroundTop + "px";
            _backgroundLeft = options.backgroundLeft + "px";

            _documentText = options.text;
            _documentTemplate = options.documentTemplate;

            // Generate the HTML for the HEAD of the document
            GenerateHeadHtml();

            // Prepare the RSS
            PrepareRSS();

            // Create a webbrowser to take the temp file loc
            _webBrowser = new WebBrowser();
            _webBrowser.ScriptErrorsSuppressed = true;
            _webBrowser.Size = this.Size;
            _webBrowser.ScrollBarsEnabled = false;
            _webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);

            // Is the RSS ready to be loaded into the temp location?
            if (_rssReady)
            {
                // Load the RSS
                LoadRssIntoTempFile();

                // Navigate to temp file
                _webBrowser.Navigate(_tempHtml.Path);
            }
        }
예제 #5
0
        /// <summary>
        /// Creates a Text display control
        /// </summary>
        /// <param name="options">Region Options for this control</param>
        public Text(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            // Collect some options from the Region Options passed in
            // and store them in member variables.
            _options = options;

            _backgroundImage = options.backgroundImage;
            _backgroundColor = options.backgroundColor;
            _backgroundTop = options.backgroundTop + "px";
            _backgroundLeft = options.backgroundLeft + "px";

            // Fire up a webBrowser control to display the completed file.
            _webBrowser = new WebBrowser();
            _webBrowser.Size = this.Size;
            _webBrowser.ScrollBarsEnabled = false;
            _webBrowser.ScriptErrorsSuppressed = true;
            _webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);

            // XMDS feed?
            if (options.Dictionary.Get("xmds", "0") == "1")
            {
                // Set the file path
                _filePath = Settings.Default.LibraryPath + @"\" + _options.mediaid + ".htm";

                // Check to see if the HTML is ready for us.
                if (HtmlReady())
                {
                    // Write to temporary file
                    SaveToTemporaryFile();

                    // Navigate to temp file
                    _webBrowser.Navigate(_temporaryFile.Path);
                }
                else
                {
                    RefreshFromXmds();
                }

                return;
            }

            // Non XMDS substitutes manually
            _filePath = options.uri;
            _direction = options.direction;
            _documentText = options.text;
            _scrollSpeed = options.scrollSpeed;
            _headJavaScript = options.javaScript;
            _fitText = (options.Dictionary.Get("fitText", "0") == "0" ? false : true);

            // Scale Factor
            _scaleFactor = options.scaleFactor;

            // Generate a temporary file to store the rendered object in.
            _tempHtml = new TemporaryHtml();

            // Generate the Head Html and store to file.
            GenerateHeadHtml();

            // Generate the Body Html and store to file.
            GenerateBodyHtml();

            // Navigate to temp file
            _webBrowser.Navigate(_tempHtml.Path);
        }