Beispiel #1
0
 public static bool NewDocument(object object_0)
 {
     if (object_0 is IAppContext)
     {
         object_0 = (object_0 as IAppContext);
     }
     for (int i = 0; i < m_pList.Count; i++)
     {
         MxDocument document = m_pList[i];
         if (document.Hook == object_0)
         {
             return(document.NewDocument());
         }
     }
     return(false);
 }
Beispiel #2
0
 public static MxDocument GetDocument(object object_0)
 {
     if (object_0 is IAppContext)
     {
         object_0 = (object_0 as IAppContext);
     }
     for (int i = 0; i < m_pList.Count; i++)
     {
         MxDocument document = m_pList[i];
         if (document.Hook == object_0)
         {
             return(document);
         }
     }
     return(null);
 }
Beispiel #3
0
 public static bool UnRegister(object object_0)
 {
     if (object_0 is IAppContext)
     {
         object_0 = (object_0 as IAppContext);
     }
     for (int i = 0; i < m_pList.Count; i++)
     {
         MxDocument document = m_pList[i];
         if (document.Hook == object_0)
         {
             if (document.Close())
             {
                 return(true);
             }
             m_pList.RemoveAt(i);
             return(false);
         }
     }
     return(false);
 }
Beispiel #4
0
        public static bool SaveDocumentAs(object object_0)
        {
            if (object_0 is IAppContext)
            {
                object_0 = (object_0 as IAppContext);
            }
            MxDocument document = null;

            for (int i = 0; i < m_pList.Count; i++)
            {
                document = m_pList[i];
                if (document.Hook == object_0)
                {
                    break;
                }
            }
            if (document != null)
            {
                SaveFileDialog dialog = new SaveFileDialog
                {
                    OverwritePrompt = true,
                    Title           = "保存为",
                    Filter          =
                        "ArcMap Document (*.mxd)|*.mxd|ArcMap Template (*.mxt)|*.mxt|Published Maps (*.pmf)|*.pmf|所有支持Map格式|*.mxd;*.mxt;*.pmf",
                    FilterIndex      = 0,
                    RestoreDirectory = true,
                    FileName         = document.DocumentFilename
                };
                switch (dialog.ShowDialog())
                {
                case DialogResult.Cancel:
                    return(true);

                case DialogResult.OK:
                    document.Save(dialog.FileName);
                    break;
                }
            }
            return(false);
        }
Beispiel #5
0
        public static bool OpenDocument(object object_0)
        {
            if (object_0 is IAppContext)
            {
                object_0 = (object_0 as IAppContext);
            }
            MxDocument document = null;

            for (int i = 0; i < m_pList.Count; i++)
            {
                document = m_pList[i];
                if (document.Hook == object_0)
                {
                    break;
                }
            }
            OpenFileDialog dialog = new OpenFileDialog
            {
                CheckFileExists  = true,
                Multiselect      = false,
                RestoreDirectory = true,
                Filter           =
                    "ArcMap Document (*.mxd)|*.mxd|ArcMap Template (*.mxt)|*.mxt|Published Maps (*.pmf)|*.pmf|所有支持Map格式|*.mxd;*.mxt;*.pmf"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string fileName = dialog.FileName;
                if (document == null)
                {
                    document = new MxDocument(object_0);
                    return(document.Open(fileName));
                }
                return(document.Open(fileName));
            }
            return(false);
        }