Exemplo n.º 1
0
        private void ArticleClicked(object sender, ItemClickEventArgs e)
        {
            var articleIndex = Array.IndexOf(ViewModel.Articles, e.ClickedItem);

            var container = ArticlesGridView.ContainerFromItem(e.ClickedItem) as GridViewItem;

            if (container != null)
            {
                var root  = (FrameworkElement)container.ContentTemplateRoot;
                var image = (UIElement)root.FindName("Image");

                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Image", image);
            }

            // Add a fade out effect
            Transitions = new TransitionCollection();
            Transitions.Add(new ContentThemeTransition());

            Frame.Navigate(typeof(ArticlePage), _navigatedIndex = articleIndex);
        }
Exemplo n.º 2
0
        private void ArticlesGridView_OnLoaded(object sender, RoutedEventArgs e)
        {
            if (_navigatedIndex != null)
            {
                // May be able to perform backwards Connected Animation
                var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("Image");
                if (animation != null)
                {
                    var item = ViewModel.Articles[_navigatedIndex.Value];

                    ArticlesGridView.ScrollIntoView(item, ScrollIntoViewAlignment.Default);
                    ArticlesGridView.UpdateLayout();

                    var container = ArticlesGridView.ContainerFromItem(item) as GridViewItem;
                    if (container != null)
                    {
                        var root  = (FrameworkElement)container.ContentTemplateRoot;
                        var image = (Image)root.FindName("Image");

                        image.Opacity = 0;

                        // this never fires
                        //image.ImageOpened += (sender_, e_) =>
                        //{
                        //    image.Opacity = 1;
                        //    animation.TryStart(image);
                        //};

                        // Have to run this directly
                        image.Opacity = 1;
                        animation.TryStart(image);
                    }
                    else
                    {
                        animation.Cancel();
                    }
                }

                _navigatedIndex = null;
            }
        }
Exemplo n.º 3
0
    protected void ArticlesGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        //We want to obey OnSort and OnChart events
        string[] commands = new string[4] {
            "start", "stop", "remove", "edit"
        };

        if (commands.Contains(e.CommandName))
        {
            ErrorMessagePanel2.Visible = false;

            var index = e.GetSelectedRowIndex() % ArticlesGridView.PageSize;
            var row   = ArticlesGridView.Rows[index];

            var articleId = Convert.ToInt32(row.Cells[0].Text);
            var article   = new Article(articleId);

            if (e.CommandName == "remove")
            {
                article.Delete();
            }
            else if (e.CommandName == "start" && article.Status == AdvertStatus.Paused)
            {
                article.Status = AdvertStatus.Active;
                article.Save();
            }
            else if (e.CommandName == "stop" && article.Status == AdvertStatus.Active)
            {
                article.Status = AdvertStatus.Paused;
                article.Save();
            }
            else if (e.CommandName == "edit")
            {
                Response.Redirect("writing.aspx?editid=" + articleId);
            }

            ArticlesGridView.DataBind();
        }
    }
Exemplo n.º 4
0
        public void BindGridView()
        {
            string      fpath  = HttpContext.Current.Server.MapPath("~/App_Data/Permissions.xml");
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(fpath);
            XmlNodeList mylist = xmlDoc.GetElementsByTagName("Tasks")[0].ChildNodes;
            DataSet     ds     = new DataSet("ds_mission");
            DataTable   dt     = new DataTable("dt_mission");

            dt.Columns.Add(new DataColumn("Name", typeof(string)));//为dt_dry表内建立Column
            dt.Columns.Add(new DataColumn("Description", typeof(string)));
            for (int i = 0; i < mylist.Count; i++)
            {
                XmlNode node = mylist[i];
                DataRow dr   = dt.NewRow();
                dr["Name"]        = node.Attributes["Name"].Value;
                dr["Description"] = node.Attributes["Description"].Value;
                dt.Rows.Add(dr);
            }
            ds.Tables.Add(dt);
            ArticlesGridView.DataSource = ds.Tables[0].DefaultView;
            ArticlesGridView.DataBind();
        }
Exemplo n.º 5
0
 protected void manageView_Activate(object sender, EventArgs e)
 {
     ArticlesGridView.DataBind();
 }