Inheritance: MenuItemBase
Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 public ComponentMenuItem.Builder ComponentMenuItem(ComponentMenuItem component)
 {
     return(new ComponentMenuItem.Builder(component));
 }
Ejemplo n.º 2
0
        protected void Test()
        {
            using (BaglantiCumlesi db = new BaglantiCumlesi())
            {
                try
                {
                    #region Layer 0
                    List <tbl_sbt_menu> Layer0 = (from p in db.tbl_sbt_menu
                                                  where p.menu_id == 0
                                                  select p).ToList <tbl_sbt_menu>();

                    if (Layer0.Any())
                    {
                        #region Create Null Instance
                        Ext.Net.Menu M = null;
                        Ext.Net.ComponentMenuItem CMI = null;
                        Ext.Net.Container         C   = null;
                        Ext.Net.MenuPanel         MP  = null;
                        Ext.Net.MenuItem          MI  = null;
                        Ext.Net.MenuSeparator     MS  = null;
                        #endregion

                        #region Layer 0 Loop
                        foreach (var i in Layer0)
                        {
                            #region Button
                            Ext.Net.Button B = new Ext.Net.Button();
                            B.ID   = "Button" + i.id;
                            B.Text = i.ad;
                            #endregion

                            #region Layer 1
                            List <tbl_sbt_menu> Layer1 = (from p in db.tbl_sbt_menu
                                                          where p.menu_id == i.id
                                                          select p).ToList <tbl_sbt_menu>();

                            if (Layer1.Any())
                            {
                                #region Menu
                                M               = new Ext.Net.Menu();
                                M.ID            = "Menu" + i.id;
                                M.ShowSeparator = false;
                                #endregion

                                #region Component Menu i
                                CMI       = new Ext.Net.ComponentMenuItem();
                                CMI.ID    = "ComponentMenuItem" + i.id;
                                CMI.Shift = false;
                                #endregion

                                #region Container
                                C                = new Ext.Net.Container();
                                C.ID             = "Container" + i.id;
                                C.AutoWidth      = true;
                                C.AutoHeight     = true;
                                C.AnchorVertical = "100%";
                                C.Layout         = "ColumnLayout";
                                #endregion

                                #region Layer 1 Loop
                                foreach (var t in Layer1)
                                {
                                    #region MenuPanel
                                    MP                    = new Ext.Net.MenuPanel();
                                    MP.ID                 = "MenuPanel" + t.id;
                                    MP.Title              = t.ad;
                                    MP.Margins            = "10 10 10 10";
                                    MP.Menu.ID            = "Menu" + t.id;
                                    MP.Menu.ShowSeparator = false;
                                    #endregion

                                    #region Layer 2
                                    List <tbl_sbt_menu> Layer2 = (from p in db.tbl_sbt_menu
                                                                  where p.menu_id == t.id
                                                                  select p).ToList <tbl_sbt_menu>();

                                    if (Layer2.Any())
                                    {
                                        int LastID = Layer2[Layer2.Count - 1].id;

                                        #region Layer 2 Loop
                                        foreach (var y in Layer2)
                                        {
                                            #region Menu i
                                            MI      = new Ext.Net.MenuItem();
                                            MI.ID   = "MenuItem" + y.id;
                                            MI.Text = y.ad;

                                            #region URL Check
                                            if (!string.IsNullOrEmpty(y.url))
                                            {
                                                MI.Icon = Ext.Net.Icon.StarGold;
                                                MI.Listeners.Click.Handler = "TabEkle(TabPanel1, '" + MI.ID + "', '" + y.url + "', '" + MP.ID + "', '" + y.ad + "')";
                                            }
                                            else
                                            {
                                                MI.Icon     = Ext.Net.Icon.StarHalfGrey;
                                                MI.Disabled = true;
                                            }
                                            #endregion

                                            #endregion

                                            if (y.id != LastID)
                                            {
                                                #region Menu Separator
                                                MS    = new Ext.Net.MenuSeparator();
                                                MS.ID = "MenuSeparator" + y.id;
                                                #endregion
                                            }

                                            #region Adding
                                            MP.Menu.Items.Add(MI);
                                            #endregion

                                            if (y.id != LastID)
                                            {
                                                #region Adding
                                                MP.Menu.Items.Add(MS);
                                                #endregion
                                            }
                                        }
                                        #endregion
                                    }
                                    #endregion

                                    #region Adding
                                    C.Items.Add(MP);
                                    #endregion
                                }
                                #endregion

                                #region Adding
                                CMI.Component.Add(C);
                                M.Items.Add(CMI);
                                B.Menu.Add(M);
                                #endregion
                            }
                            else
                            {
                                B.StandOut = true;
                            }
                            #endregion

                            #region Adding
                            MenuToolbar.Items.Add(B);
                            #endregion
                        }
                        #endregion
                    }
                    #endregion
                }
                catch
                {
                }

                /*
                 * try
                 * {
                 *  //http://www.superstarcoders.com/blogs/posts/recursive-hierarchical-joins-in-c-sharp-and-linq.aspx
                 *
                 *  IEnumerable<DeepNodeData> nodes = elements.RecursiveJoin(
                 *      element => element.Id,
                 *      element => element.ParentId,
                 *      (FlatData element, int index, int depth, IEnumerable<DeepNodeData> children) =>
                 *      {
                 *          return new DeepNodeData()
                 *          {
                 *              Text = element.Text,
                 *              Children = children,
                 *              Depth = depth
                 *          };
                 *      });
                 *
                 *  foreach (var i in nodes)
                 *  {
                 *
                 *  }
                 *
                 *  var q = (from p in db.tbl_sbt_menu
                 *           select new
                 *           {
                 *               ParentID = p.menu_id,
                 *               child = from c in db.tbl_sbt_menu
                 *                       where c.menu_id == p.id
                 *                       select new
                 *                           {
                 *                               ChildID = c.id,
                 *                               ParentID = c.menu_id
                 *                           }
                 *           });
                 *
                 *  //var abc = q.Select(p=>p.child).fir
                 *
                 * }
                 * catch
                 * {
                 *
                 * }
                 */
            }
        }