AMPSExcel.ActiveSub.isActive C# (CSharp) Method

isActive() public static method

public static isActive ( AMPSAddin d ) : bool
d AMPSAddin
return bool
        public static bool isActive(AMPSAddin.SubscriptionDefinition d)
        {
            return _actives.ContainsKey(d);
        }

Usage Example

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var form = new SubscriptionForm(Globals.AMPSAddin.Application.ActiveWorkbook);
            var sd   = _subs[e.RowIndex];

            form.SubscriptionName = sd.Name;
            // don't let the user modify this name.
            form.txtName.Enabled = false;
            form.ServerName      = sd.ServerName;
            form.Topic           = sd.Topic;
            form.Filter          = sd.Filter;
            form.WorksheetRange  = sd.WorksheetRange;
            bool wasActive = ActiveSub.isActive(sd);

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                sd.Name           = form.SubscriptionName;
                sd.ServerName     = form.ServerName;
                sd.Topic          = form.Topic;
                sd.Filter         = form.Filter;
                sd.WorksheetRange = form.WorksheetRange;
                DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
                if (wasActive)
                {
                    row.Cells[0].Value = false;
                    deactivate(e.RowIndex);
                    var wbInfo = Globals.AMPSAddin.getWorkbookInfo(
                        Globals.AMPSAddin.Application.ActiveWorkbook);
                    wbInfo.createOrUpdate(sd);
                    if (activate(e.RowIndex))
                    {
                        row.Cells[0].Value = true;
                    }
                }
                row.Cells[1].Value = sd.Name;
                row.Cells[2].Value = sd.ServerName;
                row.Cells[3].Value = sd.Topic;
                row.Cells[4].Value = sd.Filter;
                row.Cells[5].Value = sd.WorksheetRange;
            }
        }
All Usage Examples Of AMPSExcel.ActiveSub::isActive