Hi, I have some questions about ArcObjects for ArcGIS 10.4.
I've got a custom toolbar to ArcMap. This toolbar has developed for ArcMap 10.0. Although, I need to upgrade this toolbar to ArcMap 10.4. I've done few steps. See below.
--- Update Library References ( Changed From ArcObjects 10.0 to ArcObjects 10.4)
--- Recompile the solution.
--- Change the .NET Framework Version (From 3.5 to 4.5).
--- Create an installer (.msi) for the toolbar
PS : This toolbar opens the ArcMap.
After I had done those steps, When I executed the installer. The ArcMap opened strangely as if it hadn't loaded completely.
(See the picture).
.
Also, See Below my a part of source code.
public class FuncoesArcGIS
{
#region Variáveis
private string StrPatchFile = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
public enum tpPapel
{
A0 = 0,
A1,
A2,
A3,
A4,
}
public enum StateSelect
{
SelectAll = 0,
DeselectAll,
}
public enum OrientacaoPapel
{
Retrato = 0,
Paisagem,
}
public enum TipoOttobacia
{
Montante = 0,
Jusante,
}
private IApplication pIApplication;
public IApplication PIApplication
{
get { return pIApplication; }
set { pIApplication = value; }
}
/// <summary>
/// Work Space Factory
/// </summary>
private IWorkspaceFactory pIWorkspaceFactory;
public IWorkspaceFactory PIWorkspaceFactory
{
get { return pIWorkspaceFactory; }
set { pIWorkspaceFactory = value; }
}
private IPoint pPoint;
public IPoint PPoint
{
get { return pPoint; }
set { pPoint = value; }
}
private IPointCollection pGonColl;
public IPointCollection PGonColl
{
get { return pGonColl; }
set { pGonColl = value; }
}
private IFeatureLayer pIFeatureLayer;
public IFieldChecker fieldChecker;
private IFeatureWorkspace pFeatureWorkspace;
public MxDocument pMxDocument;
#endregion
#region Construtor
public FuncoesArcGIS()
{
this.pIWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
this.pPoint = new Point();
this.pGonColl = new Ring(); //new MultipointClass();
this.pIFeatureLayer = new FeatureLayer();
this.fieldChecker = new FieldCheckerClass();
this.pFeatureWorkspace = SetaWorkspace();
}
public void Destructor()
{
Marshal.FinalReleaseComObject(this.pIWorkspaceFactory);
Marshal.FinalReleaseComObject(this.pPoint);
Marshal.FinalReleaseComObject(this.pGonColl);
Marshal.FinalReleaseComObject(this.fieldChecker);
Marshal.FinalReleaseComObject(this.pFeatureWorkspace);
Marshal.ReleaseComObject(this.pIWorkspaceFactory);
Marshal.ReleaseComObject(this.pPoint);
Marshal.ReleaseComObject(this.pGonColl);
Marshal.ReleaseComObject(this.fieldChecker);
Marshal.ReleaseComObject(this.pFeatureWorkspace);
Marshal.ReleaseComObject(this.fieldChecker);
this.pIWorkspaceFactory = null;
this.pPoint = null;
this.pGonColl = null;
this.pIFeatureLayer = null;
this.fieldChecker = null;
this.pFeatureWorkspace = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
#endregion
#region Metodos
#region LoginSplash
//1
public void StartArcMap(bool blVisible)
{
ESRI.ArcGIS.ArcMap.Application objApp;
pMxDocument = new ESRI.ArcGIS.ArcMapUI.MxDocument(); //.MxDocument//(IMxDocument)pIApplication.Document;
try
{
if (pMxDocument != null)
{
// Get a reference to the application
//objApp = pIMxDocument.Parent;
objApp = (Application)pMxDocument.Parent;
// Show ArcMap
objApp.Visible = blVisible;
MontarBarras(objApp);
}
}
catch (Exception exL)
{
throw new Exception(exL.Message);
}
}
//2
private void MontarBarras(ESRI.ArcGIS.ArcMap.Application objApp)
{
try
{
string strBarra = null;
DataSet recBarra = new DataSet();
ICommandBars commandBars = pMxDocument.CommandBars;
ICommandBar menuBar = commandBars.Create("GeoDIMSYS - " + Assembly.GetExecutingAssembly().GetName().Version.Major + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor, ESRI.ArcGIS.SystemUI.esriCmdBarType.esriCmdBarTypeToolbar);
UID cmdId = new UIDClass();
object objIndex = new object();
recBarra.ReadXml(StrPatchFile + @"\Barras.xml");
for (int i = 0; i < recBarra.Tables["row"].Rows.Count; i++)
{
if (recBarra.Tables["row"].Rows[i]["Dll"].ToString() == "GDSBAR")
{
strBarra = recBarra.Tables["row"].Rows[i]["Dll"].ToString() + "." + recBarra.Tables["row"].Rows[i]["Class"].ToString();
//cmdId.SubType = 5;
cmdId.Value = strBarra;
objIndex = menuBar.Count;
menuBar.Add(cmdId, ref objIndex);
}
}
}
catch(Exception exl1)
{
throw new Exception(exl1.Message);
}
}
#endregion
#endregion
}
Well, The main question is : Is there any difference to create commandbar from ArcObjects 10.0 to ArcObjects 10.4 ??
Best Regards,