public AddInController(IAddInAdapter adapter) { _adapter = adapter; _adapter.OnMessage += new AddInMessageEvent(_adapter_OnMessage); _adapter.OnError += new AddInMessageEvent(_adapter_OnError); _adapter.OnWarning += new AddInMessageEvent(_adapter_OnWarning); _adapter.OnBeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(_adapter_OnBeforeExecute); _adapter.OnAfterExecute += new _dispCommandEvents_AfterExecuteEventHandler(_adapter_OnAfterExecute); _workingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); _uiDLL = Path.Combine(_workingDirectory, "ACSR.SqlServer.Addin.Core.UI.dll"); _adapter.CommonUIAssemblyLocation = _uiDLL; }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param term='application'>Root object of the host application.</param> /// <param term='connectMode'>Describes how the Add-in is being loaded.</param> /// <param term='addInInst'>Object representing this Add-in.</param> public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { try { _adapter = new AddInAdapter(addInInst); _controller = new AddInController(_adapter); _controller.OnConnection(application, connectMode, addInInst, ref custom); } catch (Exception e) { ShowMessage("Error Connect.OnConnection: " + e.Message); } }