Ejemplo n.º 1
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            //Set the user name into the statuslabel
            var user = LoginManager.Instance.GetUser();

            if (user != null)
            {
                this.tsslUser.Text = user.Name;
            }
            int userId = LoginManager.Instance.GetUserId();

            //load the navbar in the left panel
            var nodes      = ConfigManager.Instance.GetNavbarConfig().BarDataList;
            var validNodes = GetValidNavItems(userId, nodes);

            if (validNodes != null)
            {
                foreach (var node in validNodes)
                {
                    if (_permissionManager.HasFeaturePermission(userId, node.Id, Model.Permission.PermissionMask.View))
                    {
                        Controls.TSNavBarItem tsNavBarItem = _navBarContainer.AddBar();
                        tsNavBarItem.Title = node.Title;
                        //tsNavBarItem.Dock = DockStyle.Top;
                        tsNavBarItem.AddTreeNode(node.Children);
                        tsNavBarItem.TreeView.NodeCollapseImage = _imageList.Images[0];
                        tsNavBarItem.TreeView.NodeExpandedImage = _imageList.Images[1];
                        tsNavBarItem.TreeView.NodeImage         = _imageList.Images[2];
                    }
                }

                //Set the default expand
                const int index     = 0;
                string    featureId = string.Empty;
                if (validNodes.Count > 0 && validNodes[index].Children != null && validNodes[index].Children.Count > 0)
                {
                    featureId = validNodes[index].Children[0].Id;

                    _navBarContainer.ExpandDefaultBar(index);
                    FormManager.Instance.ActiveForm(this, _panelMain, featureId, _gridConfig, UFXBLLManager.Instance);
                }
            }
        }
Ejemplo n.º 2
0
 private void Form_Load(object sender, System.EventArgs e)
 {
     try
     {
         var nodes = ConfigManager.Instance.GetNavbarConfig().BarDataList;
         if (nodes != null)
         {
             foreach (var node in nodes)
             {
                 Controls.TSNavBarItem tsNavBarItem = tsNavBarContainer.AddBar();
                 tsNavBarItem.Title = node.Title;
                 tsNavBarItem.AddTreeNode(node.Children);
                 tsNavBarItem.TreeView.NodeCollapseImage = imageList1.Images[0];
                 tsNavBarItem.TreeView.NodeExpandedImage = imageList1.Images[1];
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }