private bool activate(int index)
{
this.Cursor = Cursors.WaitCursor;
string subName = dataGridView1.Rows[index].Cells[1].Value.ToString();
Globals.AMPSAddin.Application.StatusBar = "Activating subscription " + subName + "...";
// activate
try
{
var workbook = Globals.AMPSAddin.Application.ActiveWorkbook;
var ampsWBInfo = Globals.AMPSAddin.getWorkbookInfo(workbook);
Client c = new Client(Guid.NewGuid().ToString());
AMPSAddin.ServerDefinition serverDef = ampsWBInfo.Servers[_subs[index].ServerName];
c.connect(serverDef.URL);
c.logon();
ActiveSub.activate(_subs[index], c, serverDef.MessageType, workbook);
}
catch (Exception ex)
{
this.Cursor = Cursors.Default;
MessageBox.Show(string.Format("Error activating: {0}", ex.Message),
"Error activating subscription " + subName, MessageBoxButtons.OK, MessageBoxIcon.Error);
Globals.AMPSAddin.Application.StatusBar = false;
return(false);
}
Globals.AMPSAddin.Application.StatusBar = false;
this.Cursor = Cursors.Default;
return(true);
}