'*****************************************************************************
'       Copyright 1985, 2020 Precisely.
'       All rights reserved.

Include "mapbasic.def"
Include "IMapInfoPro.def"

' Declare methods from our own assembly
Declare Method New_SimpleInteractiveCustomFrameExample Class "MapInfo.MiPro.Samples.SimpleInteractiveCustomFrameExample.SimpleInteractiveCustomFrameExample" Lib "SimpleInteractiveCustomFrameExample.dll" Alias  Ctor_CreateInstance() as This
Declare Method Initialize Class "MapInfo.MiPro.Samples.SimpleInteractiveCustomFrameExample.SimpleInteractiveCustomFrameExample" Lib "SimpleInteractiveCustomFrameExample.dll" Alias Initialize(ByVal p1 as This, ByVal p2 as refptr, ByVal p3 as String)
Declare Method Unload Class "MapInfo.MiPro.Samples.SimpleInteractiveCustomFrameExample.SimpleInteractiveCustomFrameExample" Lib "SimpleInteractiveCustomFrameExample.dll" Alias Unload(ByVal p1 as This)

' Declare method from Pro assembly
' see IMapInfoPro.def for all defines

Declare Sub EndHandler 
Declare Sub Main

Declare Sub AddIn_About
Declare Sub AddIn_Help
Declare Sub AddIn_DefaultCommand
Declare Sub AddIn_HideRunningProgram
Declare Function AddIn_Name() As String 
Declare Function AddIn_Description() As String 
Declare Function AddIn_ImageUri() As String 
Declare Function AddIn_Version() As String
Declare Function AddIn_AssemblyName() As String
Declare Function AddIn_ClassName() As String

Global mapinfoApplication as This
Global mbAddIn as This
Global MessageTitle as string

Sub Main
	onerror goto ErrorTrap
                
		if (SystemInfo(SYS_INFO_MIPLATFORM) = MIPLATFORM_WIN64) then
			if (SystemInfo(SYS_INFO_MAPINFO_INTERFACE) = MIINTERFACE_RIBBON) then
				goto ContinueSample
			end if
		end if

	InvalidScenario:
                Note "This sample can only work with 64-bit Ribbon Interface UX."
                goto Done
                
	ContinueSample:

	
	mapinfoApplication = SYSTEMINFO(SYS_INFO_IMAPINFOAPPLICATION)
	mbAddIn = New_SimpleInteractiveCustomFrameExample()
	call Initialize(mbAddIn, mapinfoApplication, ApplicationName$() )
	
	Done:
	Exit Sub
	
	ErrorTrap:
		Note "Main: " + Str$(err()) + ": " + Error$()
		Resume done

End Sub 

Sub EndHandler
	If mapinfoApplication <> 0 and mbAddIn <> 0 Then
		call Unload(mbAddIn)
	End If
	mapinfoApplication = NULL_PTR
	mbAddIn = NULL_PTR

End Sub 

Function AddIn_Name() As String
 AddIn_Name = "Simple Interactive Custom Frame Example"
 End Function

 Function AddIn_Description() As String
 AddIn_Description = "Simple Interactive Custom Frame Example"
 End Function

 Sub AddIn_About
	Note "This is a Simple Interactive Custom Frame Example sample."
 End Sub

Function AddIn_Version() As String
 AddIn_Version = "1.0"
End Function

 Sub AddIn_Help
	Note "This is a Simple Interactive Custom Frame Example Help."
 End Sub

Sub AddIn_DefaultCommand
	Note "This is a Simple Interactive Custom Frame Example Command."
End Sub

Function AddIn_ImageUri() As String
 AddIn_ImageUri = "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/about_32x32.png"
End Function

Function AddIn_AssemblyName() As String
 Addin_AssemblyName = "SimpleInteractiveCustomFrameExample.dll"
End Function

Function AddIn_ClassName() As String
 Addin_ClassName = "MapInfo.MiPro.Samples.SimpleInteractiveCustomFrameExample.SimpleInteractiveCustomFrameExample"
End Function

Sub AddIn_HideRunningProgram

end Sub


