/// <summary> /// Method to Create Each TerraScanLinkLabel For Active Child Window /// </summary> /// <param name="locationY">Position of TerraScanLinkLabel Where to Insert</param> /// <param name="displayName">Display Name</param> /// <param name="accessName">Access Name</param> /// <param name="form">The form.</param> /// <returns>windowLinkLabel</returns> private TerraScanLinkLabel CreateWindowLinkLabel(int locationY, string displayName, string accessName, int form) { //// Creating a new windowLinkLabel this.windowLinkLabel = new TerraScanLinkLabel(); ////set the properties of LinkLable this.windowLinkLabel.Text = displayName; this.windowLinkLabel.Name = accessName; this.windowLinkLabel.AccessibleName = accessName; this.windowLinkLabel.FormId = form; this.windowLinkLabel.PermissionOpen = 1; this.windowLinkLabel.AutoSize = true; this.windowLinkLabel.ActiveLinkColor = System.Drawing.Color.LightSkyBlue; this.windowLinkLabel.BackColor = System.Drawing.Color.Transparent; this.windowLinkLabel.LinkBehavior = LinkBehavior.HoverUnderline; ////this.windowLinkLabel.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.windowLinkLabel.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)0)); this.windowLinkLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.windowLinkLabel.LinkColor = System.Drawing.Color.Black; this.windowLinkLabel.Location = new System.Drawing.Point(8, locationY); this.windowLinkLabel.Size = new System.Drawing.Size(150, 16); //this.windowLinkLabel.TabIndex = 8; this.windowLinkLabel.TabStop = false; this.windowLinkLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.windowLinkLabel.Click += new EventHandler(this.WindowLinkLabel_Click); return(this.windowLinkLabel); }
/// <summary> /// Creates the link lable inside the Terrascan.XPPanel. /// </summary> /// <param name="menuName">menuName to Display</param> /// <param name="form">form</param> /// <param name="formFile">formFile</param> /// <param name="locationY">Location Y</param> /// <param name="permissionOpen">The permission open.</param> private void CreateLinkLable(string menuName, string form, string formFile, int locationY, int permissionOpen, bool flagwithKeyId) //// Creating TerraScanLinkLabel Controls and Setting Properties { this.pannelLinkLabel = new TerraScanLinkLabel(); //// Set the properties of LinkLable this.pannelLinkLabel.Text = menuName; this.pannelLinkLabel.Name = form; this.pannelLinkLabel.AccessibleName = formFile; this.pannelLinkLabel.FormId = Convert.ToInt32(form); this.pannelLinkLabel.PermissionOpen = permissionOpen; this.pannelLinkLabel.AutoSize = true; this.pannelLinkLabel.Tag = flagwithKeyId; this.pannelLinkLabel.ActiveLinkColor = System.Drawing.Color.LightSkyBlue; this.pannelLinkLabel.LinkBehavior = LinkBehavior.HoverUnderline; this.pannelLinkLabel.BackColor = System.Drawing.Color.Transparent; this.pannelLinkLabel.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)0); this.pannelLinkLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.pannelLinkLabel.LinkColor = System.Drawing.Color.Black; this.pannelLinkLabel.Location = new System.Drawing.Point(8, locationY); this.pannelLinkLabel.Size = new System.Drawing.Size(150, 16); //this.pannelLinkLabel.TabIndex = 8; this.pannelLinkLabel.TabStop = false; this.pannelLinkLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.pannelLinkLabel.Click += new EventHandler(this.PannelLinkLabel_Click); this.leftNavXPPanel.Controls.Add(this.pannelLinkLabel); }
/// <summary> /// Handles the Panel TerraScanLinkLabel Click /// </summary> /// <param name="sender">sender</param> /// <param name="e">eventargs</param> private void PannelLinkLabel_Click(object sender, EventArgs e) { ////xpPanelGroup3.AutoSize = true; bool setParameter = false; TerraScanLinkLabel linkLabel = new TerraScanLinkLabel(); linkLabel = ((TerraScanLinkLabel)sender); linkLabel.Focus(); FormInfo formInfo; formInfo = TerraScanCommon.GetFormInfo(linkLabel.FormId); if ((linkLabel.Tag != null) && bool.TryParse(linkLabel.Tag.ToString(), out setParameter)) { if (setParameter) { formInfo.optionalParameters = new object[1]; formInfo.optionalParameters[0] = 999; //999; //-1; ////purushotham to resolve bug //999; } } bool isFieldUser = TerraScanCommon.IsFieldUser; //bool isDatabaseAvailable = ScriptEngine.IsDatabaseAvailable(); bool isDatabaseAvailable = TerraScanCommon.IsDataBaseAvailable; bool isOnLineMode = WSHelper.IsOnLineMode; if (isFieldUser && isOnLineMode && linkLabel.FormId == 3230) { this.ShowForm(this, new DataEventArgs <FormInfo>(formInfo)); } else if ((isFieldUser && isDatabaseAvailable)) { this.ShowForm(this, new DataEventArgs <FormInfo>(formInfo)); } else if ((((isFieldUser && isOnLineMode && !isDatabaseAvailable) && linkLabel.FormId != 3230)) || ((!isFieldUser && isOnLineMode) && linkLabel.FormId == 3230)) { MessageBox.Show(SharedFunctions.GetResourceString("PermissionCheck"), ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if ((!isFieldUser && isOnLineMode) && linkLabel.FormId != 3230) { this.ShowForm(this, new DataEventArgs <FormInfo>(formInfo)); } if (isDatabaseAvailable && isFieldUser) { WSHelper.IsOnLineMode = false; } else { WSHelper.IsOnLineMode = true; } }
/// <summary> /// Handles the WindowLinkLabel Click Event /// </summary> /// <param name="sender">sender</param> /// <param name="e">eventargs</param> private void WindowLinkLabel_Click(object sender, EventArgs e) { TerraScanLinkLabel linkLabel = new TerraScanLinkLabel(); linkLabel = ((TerraScanLinkLabel)sender); FormInfo formInfo = TerraScanCommon.GetFormInfo(linkLabel.FormId); WorkItem moduleWorkItem = new WorkItem(); UserControl childForm = new UserControl(); string displayFormName = formInfo.formFile.Substring((formInfo.formFile.LastIndexOf(".") + 1), (formInfo.formFile.Length - formInfo.formFile.LastIndexOf(".") - 1)); moduleWorkItem = (WorkItem)this.navigationPanelSmartPartControll.WorkItem.Items.Get(formInfo.form.ToString()); if (moduleWorkItem != null) { childForm = (UserControl)moduleWorkItem.SmartParts.Get(displayFormName); if (childForm != null) { this.WindowsLinkLabelClickEvent(this, new DataEventArgs <UserControl>(childForm)); } } else { this.ShowForm(this, new DataEventArgs <FormInfo>(formInfo)); } }
public void FormActivateEvent(object sender, DataEventArgs <string> e) { // write ur code here int locationY = 36; string displayName, accessName; int form; int lblCount = 0; int activeMenuCount = 0; Control[] tmpPnl = new Control[1]; tmpPnl = this.xpPanelGroup3.Controls.Find("Windows", true); ((TerraScanXPPanel)tmpPnl[0]).Controls.Clear(); bool checkWindowsLinkLabelExpanded = ((TerraScanXPPanel)tmpPnl[0]).IsExpanded; //((TerraScanXPPanel)tmpPnl[0]).PanelState = XPPanelState.Expanded; activeMenuCount = (int)this.navigationPanelSmartPartControll.WorkItem.State["ActiveMenuCount"]; lblCount = (int)this.navigationPanelSmartPartControll.WorkItem.State["ActiveMenuCount"]; if (lblCount > 0) { ((TerraScanXPPanel)tmpPnl[0]).Caption = "Windows " + "(" + activeMenuCount.ToString() + ")"; lblCount = (lblCount * 16) + 9; } else { ((TerraScanXPPanel)tmpPnl[0]).Caption = "Windows"; lblCount = (lblCount * 16); if (!checkWindowsLinkLabelExpanded) { ((TerraScanXPPanel)tmpPnl[0]).PanelState = XPPanelState.Expanded; } } ((TerraScanXPPanel)tmpPnl[0]).PanelHeight = lblCount; DataSet menuDataSet = (DataSet)this.navigationPanelSmartPartControll.WorkItem.State["FormItemsDataSet"]; foreach (DataTable table in menuDataSet.Tables) { foreach (DataRow row in table.Rows) { if (int.Equals((int)(row["Active"]), 1)) { TerraScanLinkLabel tempLinkLabel = new TerraScanLinkLabel(); displayName = row["MenuName"].ToString(); accessName = row["FormFile"].ToString(); form = Convert.ToInt32(row["Form"]); tempLinkLabel = this.CreateWindowLinkLabel(locationY, displayName, accessName, form); tmpPnl[0].Controls.Add(tempLinkLabel); locationY += 16; } } } if (!checkWindowsLinkLabelExpanded) { ((TerraScanXPPanel)tmpPnl[0]).PanelState = XPPanelState.Collapsed; } if (string.Equals(e.Data.ToString(), "0")) { ////this.SetPanelState(); ////((TerraScanXPPanel)tmpPnl[0]).PanelState = XPPanelState.Expanded; } }