Exemplo n.º 1
0
        void ISnippetListView.Refresh()
        {
            Controls.Clear();
            SuspendLayout();

            List <Snippet> L = new List <Snippet>();

            foreach (var rr in TheModel.snippetsDataSet.SnippetsTable.Rows)
            {
                SnippetsDataSet.SnippetsTableRow r = (SnippetsDataSet.SnippetsTableRow)rr;
                Snippet S = new Snippet()
                {
                    Name         = r.Name,
                    Code         = r.SnippetCode,
                    Example      = r.SampleCode,
                    Key          = r.ID,
                    Dependencies = r.Dependencies,
                    Category     = r.Category,
                    EdgeStyle    = r.IsEdgeStyleNull()?null : r.EdgeStyle,
                    NodeStyle    = r.IsNodeStyleNull()?null : r.NodeStyle,
                    Row          = r,
                };
                L.Add(S);
            }

            //L.Sort((a, b) => String.Compare(a.Category, b.Category));
            var Categories = L.Select(s => s.Category).Distinct().OrderBy(s => s);

            foreach (string C in Categories)
            {
                var Butt = new CheckBox()
                {
                    Text = C, Visible = true, Width = ClientSize.Width, Appearance = Appearance.Button, BackColor = Color.Gainsboro, Margin = new Padding(0), TabStop = false
                };
                Butt.Click += new EventHandler(Butt_Click);
                Controls.Add(Butt);
                foreach (var S in L.Where(s => s.Category == C))
                {
                    var o = new SnippetEntry(S);
                    o.Visible  = false;
                    o.Parent   = this;
                    o.Width    = ClientSize.Width;
                    o.Margin   = new Padding(0);
                    o.ImgWidth = ThumbnailSize;

                    o.ContextMenu = TheContextMenu;

                    o.DblClick      += new EventHandler(o_MouseDoubleClick);
                    o.UseStyle      += new EventHandler(o_UseStyle);
                    o.InsertAsStyle += new EventHandler(o_InsertAsStyle);

                    //o.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                    Controls.Add(o);
                }
            }

            ResumeLayout();
        }
Exemplo n.º 2
0
        void ISnippetListView.Refresh()
        {
            Controls.Clear();
			SuspendLayout();

            List<Snippet> L = new List<Snippet>();

            foreach (var rr in TheModel.snippetsDataSet.SnippetsTable.Rows)
            {
                SnippetsDataSet.SnippetsTableRow r = (SnippetsDataSet.SnippetsTableRow)rr;
                Snippet S = new Snippet()
                {
                    Name = r.Name,
                    Code = r.SnippetCode,
                    Example = r.SampleCode,
                    Key = r.ID,
                    Dependencies = r.Dependencies,
                    Category = r.Category,
                    EdgeStyle = r.IsEdgeStyleNull()?null : r.EdgeStyle,
                    NodeStyle = r.IsNodeStyleNull()?null : r.NodeStyle,
                    Row = r,
                };
                L.Add(S);
            }

            //L.Sort((a, b) => String.Compare(a.Category, b.Category));
            var Categories = L.Select(s => s.Category).Distinct().OrderBy(s => s);

            foreach (string C in Categories)
            {
                var Butt = new CheckBox() { Text = C, Visible = true, Width = ClientSize.Width, Appearance=Appearance.Button, BackColor=Color.Gainsboro, Margin=new Padding(0), TabStop=false};
                Butt.Click += new EventHandler(Butt_Click);
                Controls.Add(Butt);
                foreach (var S in L.Where(s => s.Category == C))
                {
                    var o = new SnippetEntry(S);
                    o.Visible = false;
                    o.Parent = this;
                    o.Width = ClientSize.Width;
                    o.Margin = new Padding(0);
                    o.ImgWidth = ThumbnailSize;

                    o.ContextMenu = TheContextMenu;
                    
                    o.DblClick += new EventHandler(o_MouseDoubleClick);
                    o.UseStyle += new EventHandler(o_UseStyle);
                    o.InsertAsStyle += new EventHandler(o_InsertAsStyle);

                    //o.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                    Controls.Add(o);
                }
            }
			
			ResumeLayout();
        }