public void ApexOpenEvent(object sender, DataEventArgs <bool> eventArgs) { if (eventArgs.Data.Equals(true)) { this.isFormLoad = true; IsApexOpened = true; if (catalogForm != null) { catalogForm.DisableSketch(true); } this.Cursor = Cursors.Default; this.isFormLoad = false; } else { this.isFormLoad = true; IsApexOpened = false; if (catalogForm != null) { catalogForm.DisableSketch(false); } this.Cursor = Cursors.Default; this.isFormLoad = false; } }
//[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)] //[return: MarshalAs(UnmanagedType.Bool)] //static extern bool DestroyWindow(IntPtr hwnd); //[DllImport("User32")] //extern public static int GetGuiResources(IntPtr hProcess, int uiFlags); //public static int GetGuiResourcesGDICount() //{ // return GetGuiResources(Process.GetCurrentProcess().Handle, 0); //} //public static int GetGuiResourcesUserCount() //{ // return GetGuiResources(Process.GetCurrentProcess().Handle, 1); //} #region Method /// <summary> /// Loads the create catalog form. /// </summary> private void LoadCreateCatalogForm() { // Used to store the parcel value string cataLogval; // Used to store the value string parcelVal; // Used to Store the Component (HTC Value) string htcVal; // Used to Store config value for the cama sketch. string configVal; // Stores the mainwindow handle of the process. IntPtr exPtr = IntPtr.Zero; // Checks for the object Id if (this.objectID > 0) { this.Cursor = Cursors.WaitCursor; // Call the workitem to get the parameters. camaSketchData = this.form32012Control.WorkItem.F32012_GetCatalogData(this.objectID); // Check if (camaSketchData.ConfigurationValue.Count > 0 && camaSketchData.CatalogXML.Count > 0 && camaSketchData.ConfigXML.Count > 0 && camaSketchData.HtcXML.Count > 0 && camaSketchData.ParcelXML.Count > 0) { //// Gets the needed parameter. cataLogval = camaSketchData.CatalogXML[0]["CatalogXml"].ToString(); configVal = camaSketchData.ConfigXML[0]["ConfigXml"].ToString(); parcelVal = camaSketchData.ParcelXML[0]["ParcelXml"].ToString(); htcVal = camaSketchData.HtcXML[0]["HtcXml"].ToString(); if (!string.IsNullOrEmpty(parcelVal.Trim())) { XmlDocument doc = new XmlDocument(); doc.LoadXml(parcelVal); XmlNode node = doc.DocumentElement.SelectSingleNode("//ParcelID"); int.TryParse(node.InnerText, out this.ParcelId); tempID = this.ParcelId; // Pass the parameter to the catalog dll // and initialize the form then show it // cataLogWindowForm = new CatalogWindow(); catalogForm = null; catalogForm = CatalogControl.Create(cataLogval, htcVal, configVal, parcelVal); // Response.Write("node = " + node); //catalogForm.InitializeComponent(); // used for Opening ApexForm try { catalogForm.ApexFormOpened += new CatalogControl.OpenEventHandler(catalogForm_ApexFormOpened); catalogForm.LinkFormOpened += new CatalogControl.OpenLinkEventHandler(catalogForm_LinkFormOpened); if (camaSketchData.ConfigurationValue.Rows.Count > 0) { F32012CatalogData.ConfigurationValueRow configRow = (F32012CatalogData.ConfigurationValueRow)camaSketchData.ConfigurationValue.Rows[0]; if (!configRow.IsIsSketchVisibleNull()) { int sketchVisible = 0; int.TryParse(configRow.IsSketchVisible.ToString(), out sketchVisible); catalogForm.IsSketchVisible = sketchVisible; } else { catalogForm.IsSketchVisible = 0; } } if (!IsApexOpened) { //catalogForm.SketchButton = true; catalogForm.DisableSketch(false); } else { //catalogForm.SketchButton = false; catalogForm.DisableSketch(true); } } catch (Exception ex) { MessageBox.Show("There was an error launching the Apex Sketch module. It may not have been installed properly. Please contact T2 Support for further assistance.", "TerraScan – Error opening Apex", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catalogForm.ParcelSaved += new EventHandler <ParcelSavedEventArgs>(catalogForm_ParcelSaved); catalogForm.FormMasterEditEnabled += new EventHandler(this.CatalogForm_EditEnabled); // Code added to host for WPF control //ElementHost elementHost = new ElementHost(); //elementHost.Dock = DockStyle.None; //elementHost.Width = (int)catalogForm.Width; //elementHost.Height = (int)catalogForm.Height; //elementHost.Child = catalogForm; //mainPanel.Controls.Add(elementHost); mainPanel.Controls.Add(catalogForm); // Size has been changed based on the control size //this.mainPanel.Size = new System.Drawing.Size(catalogForm.Width, catalogForm.Height + 5); //this.Size = new System.Drawing.Size(catalogForm.Width, catalogForm.Height + 5); //this.mainPanel.Size = new System.Drawing.Size(elementHost.Width, elementHost.Height); //this.Size = new System.Drawing.Size(elementHost.Width, elementHost.Height); //this.catalogForm._datacontext._wrapper._dataset.UpdateChanges(true); } else { MessageBox.Show("Invalid ValueSlice Id", ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("Invalid ValueSlice Id", ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }