Esempio n. 1
0
        private void buttonAddAlert_Click(object sender, EventArgs e)
        {
            FormAlertAdd form = new FormAlertAdd(market);

//            form.parent = this;
            form.ShowDialog();
            if (form.alertAdded || form.alertChanged)
            {
                AlertManager.SaveAlerts();
                AlertManager.CheckAlerts();
            }
            ShowAlertList();
        }
Esempio n. 2
0
        private void dGridAlerts_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (gvAlerts.Column(e.ColumnIndex).Name == "delete")
            {
                string id      = (string)gvAlerts.CellValue("id", e.RowIndex);
                int    alertid = int.Parse(id);
                AlertManager.Remove(alertid);
                AlertManager.CheckAlerts();
                ShowAlertList();
            }
            else if (gvAlerts.Column(e.ColumnIndex).Name == "edit")
            {
                string       id      = (string)gvAlerts.CellValue("id", e.RowIndex);
                int          alertid = int.Parse(id);
                Alert        alert   = AlertManager.alerts[alertid];
                FormAlertAdd form    = new FormAlertAdd(ExchangeManager.GetMarketByMarketName(alert.market), "", alertid);
                form.ShowDialog();
                if (form.alertAdded || form.alertChanged)
                {
                    AlertManager.SaveAlerts();
                    AlertManager.CheckAlerts();
                }
                ShowAlertList();
            }
            else if (gvAlerts.Column(e.ColumnIndex).Name == "enable")
            {
                string id      = (string)gvAlerts.CellValue("id", e.RowIndex);
                int    alertid = int.Parse(id);
                Alert  alert   = AlertManager.alerts[alertid];
                alert.enabled = !alert.enabled;
                if (!alert.enabled)
                {
                    alert.alertExecute = false;
                }
                AlertManager.SaveAlerts();
                AlertManager.CheckAlerts();
                ShowAlertList();
            }
        }