private void MainForm_Load(object sender, EventArgs e) { Stream inStream = null; if(ClientSetting.IsClient()) { inStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.ClientMenuPermissions.xml"); } else { if(ClientSetting.IsServer()) { inStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.ServerMenuPermissions.xml"); } else { inStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.NAMenuPermissions.xml"); } } // load menu permission MenuItemPermission menuItemPermission = new MenuItemPermission(MenuItemPermission.INVISIBLE); menuItemPermission.loadRoles(inStream); ClientInfo clientInfo = ClientInfo.getInstance(); clientInfo.MenuPermissions = menuItemPermission; // register main form GlobalCache.Instance().MainForm = this; // check menu permission MenuUtility.setPermission(clientInfo.LoggedUser, ref this.mnuMenu, menuItemPermission); //CheckClientServer(); }
private void MainForm_Load(object sender, EventArgs e) { Stream inStream = this.GetType().Assembly.GetManifestResourceStream("ClientManagementTool.MenuPermissions.xml"); // load menu permission MenuItemPermission menuItemPermission = new MenuItemPermission(MenuItemPermission.INVISIBLE); menuItemPermission.loadRoles(inStream); ClientInfo clientInfo = ClientInfo.getInstance(); clientInfo.MenuPermissions = menuItemPermission; // register main form GlobalCache.Instance().MainForm = this; // check menu permission MenuUtility.setPermission(clientInfo.LoggedUser, ref this.menuStrip1, menuItemPermission); //CheckClientServer(); }
private void MainForm_Load(object sender, EventArgs e) { foreach (ToolStripItem item in toolStripClient.Items) { toolStripTexts.Add(item.Text); } Stream inStream = null; if(ClientSetting.IsClient()) { // load menu inStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.ClientMenuPermissions.xml"); } else { if(ClientSetting.IsServer()) { inStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.ServerMenuPermissions.xml"); } else { if(ClientSetting.IsSubStock()) { inStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.SubStockMenuPermissions.xml"); } else { inStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.NAMenuPermissions.xml"); } } } // load menu permission MenuItemPermission menuItemPermission = new MenuItemPermission(MenuItemPermission.INVISIBLE); menuItemPermission.loadRoles(inStream); ClientInfo clientInfo = ClientInfo.getInstance(); clientInfo.MenuPermissions = menuItemPermission; // register main form GlobalCache.Instance().MainForm = this; // check menu permission MenuUtility.setPermission(clientInfo.LoggedUser, ref this.mnuMenu, menuItemPermission); //CheckClientServer(); toolStripClient.Focus(); Stream toolStripInStream = null; if(ClientSetting.IsClient()) { toolStripClient.Visible = true; // load and set permissions toolStripInStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.ClientToolStripPermissions.xml"); // run service in client consumer = new ServerServiceConsumer(); } else if (ClientSetting.IsSubStock()) { subStockConsumer= new SubStockConsumer(); // load toolstrip toolStripClient.Visible = true; // load and set permissions toolStripInStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.SubStockToolStripPermissions.xml"); } else if(ClientSetting.IsServer()) { // load toolstrip toolStripClient.Visible = true; // load and set permissions toolStripInStream = this.GetType().Assembly.GetManifestResourceStream("AppFrameClient.ServerToolStripPermissions.xml"); ServiceStatus.Text = "..."; } else { toolStripClient.Visible = false; } if(toolStripInStream != null) { ToolStripItemPermission toolStripItemPermission = new ToolStripItemPermission(ToolStripItemPermission.INVISIBLE); toolStripItemPermission.loadRoles(toolStripInStream); GlobalCache.Instance().ClientToolStripPermission = toolStripItemPermission; MenuUtility.setPermission(this, clientInfo, ref this.toolStripClient, toolStripItemPermission); } if(toolStripClient.Visible == true) { RenderFunctionKeysTextToToolStrip(); } }