/// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the Rss data
            var RssDataGroups = RssDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = RssDataGroups;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // Allow saved page state to override the initial item to display
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            // TODO: Create an appropriate data model for your problem domain to replace the Rss data
            var item = RssDataSource.GetItem((String)navigationParameter);

            this.DefaultViewModel["Group"] = item.Group;
            this.DefaultViewModel["Items"] = item.Group.Items;
            this.flipView.SelectedItem     = item;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RssDataSourceConfigForm"/> class.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        public RssDataSourceConfigForm(RssDataSource dataSource)
        {
            _dataSource = dataSource;
            InitializeComponent();

            lock (_history)
            {
                AddToHistory(dataSource.Url);

                foreach (string url in _history)
                {
                    urlComboBox.Items.Add(url);
                }
            }

            urlComboBox.Text = dataSource.Url;
        }
 internal RssDataSourceView(RssDataSource owner, string viewName)
     : base(owner, viewName)
 {
     _owner = owner;
 }
 /// <summary>
 /// Initializes the control designer and loads the specified component.
 /// </summary>
 /// <param name="component">The control being designed.</param>
 public override void Initialize(IComponent component)
 {
     base.Initialize(component);
     _dataSource = (RssDataSource)component;
 }
Exemplo n.º 6
0
        private void BindRssNews()
        {
            string ss = "";
            string RssPath = (Request["RssPath"] == null) ? "" : Request["RssPath"].ToString();
            int RssCount = (Request["RssCount"] == null) ? 0 : int.Parse(Request["RssCount"].ToString());
            if (RssPath != "")
            {
                RssDataSource rss = new RssDataSource();
                GenericRssChannel channel = new GenericRssChannel();

                try
                {
                    rss.Url = RssPath;
                    rss.DataBind();
                    channel = rss.Channel;
                }
                catch
                {
                    Response.ContentType = "text/xml";
                    Response.Write("<div style='text-align:center;padding:10px;color:red;' class='text'>" + LocRM.GetString("tRSSProblems") + "</div>");
                    return;
                }
                //XMLUtilities
                // Create root element
                XmlDocument doc = new XmlDocument();
                XmlNode root = doc.AppendChild(doc.CreateElement("rssData"));
                XmlNode node = doc.CreateElement("htmlData");

                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<div>");
                sb.AppendFormat("<div style='padding-top: 3px;padding-bottom:3px;color: #444;font-size: 10pt;'><b>{0}</b></div>", channel.Attributes["Title"]);
                for (int i = 0; i < channel.Items.Count && i < RssCount; i++)
                {
                    sb.AppendFormat("<div style='padding-top: 3px;' class='text'><a href='{1}' target='_blank'>{0}</a></div>", channel.Items[i].Attributes["Title"], channel.Items[i].Attributes["Link"]);
                    sb.AppendFormat("<div style='color: gray;' class='text'>{0}</div>", Convert.ToDateTime(channel.Items[i].Attributes["pubDate"]).ToString());
                    //sb.AppendFormat("<div style='color: black; font-family: tahoma; font-size: 12px;'>{0}</div>", channel.Items[i].Attributes["description"]);
                }
                sb.Append("</div>");
                XmlNode cdata = doc.CreateCDataSection(sb.ToString());
                //node.Name = "htmlData";
                node.AppendChild(cdata);
                root.AppendChild(node);
                //doc.DocumentElement.AppendChild(doc.CreateCDataSection(sb.ToString()));
                ss += doc.InnerText;
            }
            Response.ContentType = "text/xml";
            Response.Write(ss);
        }