Exemple #1
0
        public void OnD9030_F9030_CancelSliceInformation(object sender, EventArgs eventArgs)
        {
            if (this.catalogForm != null)
            {
                // this.catalogForm.DisposeGDI();
                this.catalogForm.Dispose();
                this.catalogForm = null;
                catalogForm      = new CatalogControl();
                mainPanel.Controls.Clear();


                //catalogForm.DisposeGDI();

                //this.catalogForm._datacontext._wrapper._dataset.UpdateChanges(false);
                // Refresh object collection
                // this.catalogForm._datacontext.RefreshObjectCollection();
                this.isFormLoad = true;
                // this.catalogForm.ReloadCatalog();
                // Call the method to load the EXE.
                this.isInEditMode = false;
                this.LoadCreateCatalogForm();
                this.Cursor     = Cursors.Default;
                this.isFormLoad = false;
            }
        }
Exemple #2
0
        public void F3201_F32012_FormReload(object sender, DataEventArgs <int> eventArgs)
        {
            if (eventArgs.Data.Equals(this.ParcelId))
            {
                //DialogResult dialogResult = MessageBox.Show("Do you want to discard the changes?", ConfigurationWrapper.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                //if (dialogResult == DialogResult.Yes)
                //{
                //this.FormActivateEvent(this, new DataEventArgs<string>(formInfo.formFile));
                this.isInEditMode = false;
                this.isFormLoad   = true;
                if (this.catalogForm != null)
                {
                    catalogForm.Dispose();
                    catalogForm = null;
                    catalogForm = new CatalogControl();
                    mainPanel.Controls.Clear();
                    IsApexOpened = false;
                    this.LoadCreateCatalogForm();
                }
                else
                {
                    catalogForm = new CatalogControl();
                    mainPanel.Controls.Clear();
                    IsApexOpened = false;
                    this.LoadCreateCatalogForm();
                }
                this.Cursor     = Cursors.Default;
                this.isFormLoad = false;

                //}
            }
            else
            {
                if (!this.isInEditMode)
                {
                    this.F9030_ApexOpenEvent(this, new DataEventArgs <bool>(false));
                }
            }
        }
Exemple #3
0
        //[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);
            }
        }
Exemple #4
0
 public void ParentForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (apexForm != null)
     {
         //  MessageBox.Show("Please Close the previous apex before opening new sketch", "Terrascan", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         // ((F3205)apexForm).closeApexForm();
         ((F3205)apexForm).CloseSketch();
     }
     if (string.IsNullOrEmpty((sender as System.Windows.Forms.Form).Text))
     {
         //if (this.camaSketchData != null)
         //{
         //    this.camaSketchData.Clear();
         //    this.camaSketchData.Dispose();
         //    this.camaSketchData = null;
         //}
         if (this.mainPanel != null)
         {
             this.mainPanel.Controls.Clear();
             //foreach (Control ctrl in this.mainPanel.Controls)
             //{
             //    this.mainPanel.Controls.Remove(ctrl);
             //}
             //this.mainPanel.Controls.Remove(catalogForm);
             this.mainPanel.Dispose();
             this.mainPanel = null;
         }
         if (this.OverallPanel != null)
         {
             this.OverallPanel.Controls.Clear();
             this.OverallPanel.Dispose();
             this.OverallPanel = null;
         }
         if (this.catalogForm != null)
         {
             // this.catalogForm.Objects = null;
             this.CatalogPictureBox.Dispose();
             this.CatalogPictureBox             = null;
             this.catalogProcessInfo            = null;
             catalogForm.ApexFormOpened        -= new CatalogControl.OpenEventHandler(catalogForm_ApexFormOpened);
             catalogForm.LinkFormOpened        -= new CatalogControl.OpenLinkEventHandler(catalogForm_LinkFormOpened);
             catalogForm.ParcelSaved           -= new EventHandler <ParcelSavedEventArgs>(catalogForm_ParcelSaved);
             catalogForm.FormMasterEditEnabled -= new EventHandler(this.CatalogForm_EditEnabled);
             //if (this.form32012Control != null)
             //{
             //    if (this.form32012Control.WorkItem != null)
             //    {
             //        //this.catalogForm.DisposeGDI();
             //        this.form32012Control.WorkItem.Deactivate();
             //        this.form32012Control.WorkItem.Terminate();
             //        this.form32012Control.WorkItem.Dispose();
             //    }
             //}
             // this.form32012Control.WorkItem = null;
             this.form32012Control = null;
             this.catalogForm.DisposeGDI();
             this.catalogForm.Dispose();
             this.catalogForm = null;
         }
         this.Dispose();
         this.DestroyHandle();
         GC.Collect();
     }
 }