private void cmdLoad_Click(object sender, System.EventArgs e)
        {
            //Open a file dialog for selecting map documents
            openFileDialog1.Title  = "Select Published Map Document";
            openFileDialog1.Filter = "Published Map Documents (*.pmf)|*.pmf";
            openFileDialog1.ShowDialog();

            //Exit if no map document is selected
            string sFilePath = openFileDialog1.FileName;

            if (sFilePath == "")
            {
                return;
            }

            //Load the specified pmf
            if (axArcReaderControl1.CheckDocument(sFilePath) == true)
            {
                axArcReaderControl1.LoadDocument(sFilePath, "");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("This document cannot be loaded!");
                return;
            }

            //Determine whether permission to search layers and query field values
            m_queryFeatures = axArcReaderControl1.HasDocumentPermission(esriARDocumentPermissions.esriARDocumentPermissionsQueryFeatures);
            m_queryValues   = axArcReaderControl1.HasDocumentPermission(esriARDocumentPermissions.esriARDocumentPermissionsQueryValues);

            //Set current tool
            optTool0.Checked = true;
        }
        private void cmdLoad_Click(object sender, System.EventArgs e)
        {
            //Load the specified pmf
            if (txbPath.Text == "")
            {
                return;
            }
            if (axArcReaderControl1.CheckDocument(txbPath.Text) == true)
            {
                axArcReaderControl1.LoadDocument(txbPath.Text, "");
            }
            else
            {
                MessageBox.Show("This document cannot be loaded!");
                return;
            }

            optTool0.Checked = true;
        }
        private void cmdLoad_Click(object sender, System.EventArgs e)
        {
            openFileDialog1.Title  = "Select Published Map Document";
            openFileDialog1.Filter = "Published Map Documents (*.pmf)|*.pmf";
            openFileDialog1.ShowDialog();
            // Exit if no map document is selected
            string sFilePath = "";

            sFilePath = openFileDialog1.FileName;
            if (sFilePath == "")
            {
                return;
            }
            // Load the specified pmf
            if (axArcReaderControl1.CheckDocument(sFilePath) == true)
            {
                axArcReaderControl1.LoadDocument(sFilePath, "");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("This document cannot be loaded!");
                return;
            }
            if (axArcReaderControl1.HasDocumentPermission(esriARDocumentPermissions.esriARDocumentPermissionsViewTOC) == true)
            {
                chkTOC.Enabled = true;
                if (axArcReaderControl1.TOCVisible == true)
                {
                    chkTOC.CheckState = CheckState.Checked;
                }
                else
                {
                    chkTOC.CheckState = CheckState.Unchecked;
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("You do not have permission to toggle TOC visibility!");
            }
            RichTextBox1.Text = "";
        }
Exemplo n.º 4
0
        private void cmdOpen_Click(object sender, System.EventArgs e)
        {
            //Open a file dialog for selecting map documents
            openFileDialog1.Title  = "Select Published Map Document";
            openFileDialog1.Filter = "Published Map Documents (*.pmf)|*.pmf";
            openFileDialog1.ShowDialog();

            //Exit if no map document is selected
            string sFilePath = openFileDialog1.FileName;

            if (sFilePath == "")
            {
                return;
            }

            //Load the specified pmf
            if (axArcReaderControl1.CheckDocument(sFilePath) == true)
            {
                axArcReaderControl1.LoadDocument(sFilePath, "");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("This document cannot be loaded!");
                return;
            }

            //Disable search  & map tools
            cboLayers.Items.Clear();
            cboFields.Items.Clear();
            EnableSearchTools(false);
            EnableMeetHighlightTools(false);
            EnableFailHighlightTools(false);

            //Determine whether permission to search layers and query field values
            bool bqueryFeatures = axArcReaderControl1.HasDocumentPermission(esriARDocumentPermissions.esriARDocumentPermissionsQueryFeatures);
            bool bqueryValues   = axArcReaderControl1.HasDocumentPermission(esriARDocumentPermissions.esriARDocumentPermissionsQueryValues);

            if (bqueryFeatures == false || bqueryValues == false)
            {
                System.Windows.Forms.MessageBox.Show("The selected Document does not have Query Permissions.");
                return;
            }

            //Add map layers to combo and store in HashTable with combo index
            m_LayersIndex = new Hashtable();
            ARPopulateComboWithMapLayers(cboLayers, m_LayersIndex);

            //Select first searchable layer
            for (int i = 0; i <= cboLayers.Items.Count - 1; i++)
            {
                ARLayer arLayer = (ARLayer)m_LayersIndex[i];
                if (arLayer.Searchable == true)
                {
                    cboLayers.SelectedIndex = i;
                    break;
                }
            }

            //Enable Search & Map Tools
            EnableSearchTools(true);
            EnableMapTools(true);
        }