private void EventHandlerMethod(object sender, EventArgs e) { try { PLUGIN_CONTENT_TYPE TagType = (PLUGIN_CONTENT_TYPE)((ToolStripMenuItem)sender).Tag; GroupStructure gs = GroupStructure.Instance; object _instance; switch (TagType) { case PLUGIN_CONTENT_TYPE.Root: _instance = this.PWork.Invoke(gs); break; case PLUGIN_CONTENT_TYPE.Group: _instance = this.PWork.Invoke(gs[this.Tree.SelectedNode.Text]); break; case PLUGIN_CONTENT_TYPE.Student: _instance = this.PWork.Invoke(gs[this.Tree.SelectedNode.Parent.Text][this.Tree.SelectedNode.Index]); break; default: throw new Exception("Unknown Plugin Instance"); } switch (this.PInfor.Type) { case PLUGIN_TYPEOUT.Message: MessageBox.Show(_instance.ToString(), this.PInfor.Text); break; case PLUGIN_TYPEOUT.File: string fileName = this.PInfor.Name + "_" + DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() + "-" + DateTime.Now.Second.ToString() + ".txt"; var sw = new StreamWriter(fileName); sw.Write(_instance.ToString()); sw.Close(); MessageBox.Show("Written into file '" + fileName + ".txt'", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } } catch (Exception ex) { MessageBox.Show("Error on working plugin: " + ex.Message, this.PInfor.Text); } }
public void CreateSubMenu(GroupStructure structure) { IsCreate = false; groupStr = structure; if (structure == null) { gameObject.SetActive(false); return; } IsCreate = true; TotalMenu = structure.TypeList.Length; //Instantiate SubMenuTop for (int i = 0; i < TotalMenu; i++) { if (i == 0) { GameObject button = (GameObject)GameObject.Instantiate(TopSubMenu.gameObject); button.GetComponent <SubMenuButton>().SetText(PageDetailGlobal.pGlobal.Link[(int)structure.TypeList[i] - 1].Header); button.GetComponent <SubMenuButton>().ButtonIdx = i; button.GetComponent <SubMenuButton>().OnPressed += buttonCallback; button.transform.parent = this.transform; button.transform.localPosition = new Vector3(TopSubMenu.transform.localPosition.x, -0.78f, 0f); MenuList.Add(button); } else if (i == TotalMenu - 1) { GameObject button = (GameObject)GameObject.Instantiate(BottomSubMenu.gameObject); button.GetComponent <SubMenuButton>().SetText(PageDetailGlobal.pGlobal.Link[(int)structure.TypeList[i] - 1].Header); button.GetComponent <SubMenuButton>().ButtonIdx = i; button.GetComponent <SubMenuButton>().OnPressed += buttonCallback; button.transform.parent = this.transform; button.transform.localPosition = new Vector3(BottomSubMenu.transform.localPosition.x, -0.78f + (TotalMenu - 1) * -0.58f, 0f); MenuList.Add(button); } else { GameObject button = (GameObject)GameObject.Instantiate(MidSubMenu.gameObject); button.GetComponent <SubMenuButton>().SetText(PageDetailGlobal.pGlobal.Link[(int)structure.TypeList[i] - 1].Header); button.GetComponent <SubMenuButton>().ButtonIdx = i; button.GetComponent <SubMenuButton>().OnPressed += buttonCallback; button.transform.parent = this.transform; button.transform.localPosition = new Vector3(MidSubMenu.transform.localPosition.x, -0.78f + i * -0.58f, 0f); MenuList.Add(button); } } }
private static List <GroupStructure> ExtractUsersOfGroups(List <string> listOfGroupNames) { List <GroupStructure> listOfGroupsUsersInternal = new List <GroupStructure>(); // ArrayList myGroups = GetGroupMembers("Administrators"); foreach (var group in listOfGroupNames) { GroupStructure listOfGroupsUsers = new GroupStructure(); List <string> listOfMembersOnly = new List <string>(); foreach (string item in GetGroupMembers(group)) { listOfMembersOnly.Add(item); } listOfGroupsUsers.groupName = group; listOfGroupsUsers.listOfUsers = listOfMembersOnly; listOfGroupsUsersInternal.Add(listOfGroupsUsers); } return(listOfGroupsUsersInternal); }
public Command() { tree = GroupStructure.Instance; }