Exemplo n.º 1
0
        private void AddCollarButton_Click(object sender, EventArgs e)
        {
            var form = new AddCollarForm(Investigator);

            form.DatabaseChanged += (o, x) => CollarDataChanged();
            form.Show(this);
        }
Exemplo n.º 2
0
        private void AddCollarButton_Click(object sender, EventArgs e)
        {
            //TODO support multi-select
            var index  = TpfDataGridView.SelectedRows[0].Index;
            var collar = _collars[index];

            if (collar == null)
            {
                var ctn = (string)TpfDataGridView.Rows[index].Cells[1].Value;
                ctn = IgnoreSuffixCheckBox.Checked && ctn.Length > 6 ? ctn.Substring(0, 6) : ctn;
                var form = new AddCollarForm(File.ProjectInvestigator);
                form.DatabaseChanged += (o, x) => CollarAdded(ctn);
                form.SetDefaultFrequency((double)TpfDataGridView.SelectedRows[0].Cells[4].Value);
                form.SetDefaultModel("Telonics", "Gen4");
                form.SetDefaultId(ctn);
                form.Show(this);
            }
            else
            {
                //Fix the frequency
                collar.Frequency = (double)TpfDataGridView.SelectedRows[0].Cells[4].Value;
                if (SubmitChanges())
                {
                    TpfDataChanged();
                }
            }
        }
        private Collar CreateTpfCollar(ProjectInvestigator owner, string collarId, double frequency)
        {
            var collarAdded = false;
            var form        = new AddCollarForm(owner);

            form.DatabaseChanged += (o, x) => collarAdded = true;
            form.SetDefaultFrequency(frequency);
            form.SetDefaultModel("Telonics", "Gen4");
            form.SetDefaultId(collarId);
            form.ShowDialog(this); //Blocks until form closed
            if (!collarAdded)
            {
                return(null);
            }
            return(Database.Collars.FirstOrDefault(c => c.CollarManufacturer == "Telonics" &&
                                                   c.CollarId == collarId));
        }
 private Collar CreateTpfCollar(ProjectInvestigator owner, string collarId, double frequency)
 {
     var collarAdded = false;
     var form = new AddCollarForm(owner);
     form.DatabaseChanged += (o, x) => collarAdded = true;
     form.SetDefaultFrequency(frequency);
     form.SetDefaultModel("Telonics", "Gen4");
     form.SetDefaultId(collarId);
     form.ShowDialog(this); //Blocks until form closed
     if (!collarAdded)
         return null;
     return Database.Collars.FirstOrDefault(c => c.CollarManufacturer == "Telonics" &&
                                                           c.CollarId == collarId);
 }
 private void AddCollarButton_Click(object sender, EventArgs e)
 {
     //TODO support multi-select
     var index = TpfDataGridView.SelectedRows[0].Index;
     var collar = _collars[index];
     if (collar == null)
     {
         var ctn = (string)TpfDataGridView.Rows[index].Cells[1].Value;
         ctn = IgnoreSuffixCheckBox.Checked && ctn.Length > 6 ? ctn.Substring(0, 6) : ctn;
         var form = new AddCollarForm(File.ProjectInvestigator);
         form.DatabaseChanged += (o, x) => CollarAdded(ctn);
         form.SetDefaultFrequency((double)TpfDataGridView.SelectedRows[0].Cells[4].Value);
         form.SetDefaultModel("Telonics","Gen4");
         form.SetDefaultId(ctn);
         form.Show(this);
     }
     else
     {
         //Fix the frequency
         collar.Frequency = (double)TpfDataGridView.SelectedRows[0].Cells[4].Value;
         if (SubmitChanges())
             TpfDataChanged();
     }
 }
 private void AddCollarButton_Click(object sender, EventArgs e)
 {
     var form = new AddCollarForm(Investigator);
     form.DatabaseChanged += (o, x) => CollarDataChanged();
     form.Show(this);
 }