Beispiel #1
0
        private void AddPlatformButton_Click(object sender, EventArgs e)
        {
            var index      = TpfDataGridView.SelectedRows[0].Index;
            var collar     = _collars[index];
            var platform   = (string)TpfDataGridView.SelectedRows[0].Cells[2].Value;
            var platformId = (string)TpfDataGridView.SelectedRows[0].Cells[3].Value;
            var start      = (DateTime)TpfDataGridView.SelectedRows[0].Cells[5].Value;

            if (platform == "Argos")
            {
                if (Database.ArgosPlatforms.Any(a => a.PlatformId == platformId))
                {
                    AddArgosDeployment(platformId, collar, start);
                }
                else
                {
                    //First add the Argosplatform
                    var form = new AddArgosPlatformForm();
                    form.SetDefaultPlatform(platformId);
                    form.DatabaseChanged += (o, x) => AddArgosDeployment(platformId, collar, start);
                    form.Show(this);
                }
            }
            if (platform == "Argos")
            {
                //TODO: implement support for Iridium
            }
        }
        private ArgosPlatform CreatePlatform(string argosId)
        {
            var platformAdded = false;
            var form          = new AddArgosPlatformForm();

            form.DatabaseChanged += (o, x) => platformAdded = true;
            form.SetDefaultPlatform(argosId);
            form.ShowDialog(this);
            if (!platformAdded)
            {
                return(null);
            }
            return(Database.ArgosPlatforms.FirstOrDefault(p => p.PlatformId == argosId));
        }
Beispiel #3
0
        private void CollarAdded(string id)
        {
            var collar = Database.Collars.FirstOrDefault(c => c.CollarManufacturer == "Telonics" && c.CollarId == id);

            if (collar == null)
            {
                return;
            }
            //Add Parameter
            var start = (DateTime)TpfDataGridView.SelectedRows[0].Cells[5].Value;
            //Since this is a new collar, I don't need to worry about any parameter conflicts.
            var param = new CollarParameter
            {
                Collar = collar,
                CollarParameterFile = File,
                StartDate           = start
            };

            Database.CollarParameters.InsertOnSubmit(param);
            if (SubmitChanges())
            {
                TpfDataChanged();
            }

            //Add PlatformDeployment
            var platformType = (string)TpfDataGridView.SelectedRows[0].Cells[2].Value;
            var platformId   = (string)TpfDataGridView.SelectedRows[0].Cells[3].Value;

            if (platformType == "Argos")
            {
                var platform = Database.ArgosPlatforms.FirstOrDefault(a => a.PlatformId == platformId);
                if (platform == null)
                {
                    var form = new AddArgosPlatformForm();
                    form.DatabaseChanged += (o, x) => ArgosAdded(platformId, collar, start);
                    form.SetDefaultPlatform(platformId);
                    form.Show(this);
                }
                else
                {
                    AddArgosDeployment(platformId, collar, start);
                }
            }
            if (platformType == "Iridium")
            {
                //TODO: implement support for Iridium
            }
        }
 private ArgosPlatform CreatePlatform(string argosId)
 {
     var platformAdded = false;
     var form = new AddArgosPlatformForm();
     form.DatabaseChanged += (o, x) => platformAdded = true;
     form.SetDefaultPlatform(argosId);
     form.ShowDialog(this);
     if (!platformAdded)
         return null;
     return Database.ArgosPlatforms.FirstOrDefault(p => p.PlatformId == argosId);
 }
        private void CollarAdded(string id)
        {
            var collar = Database.Collars.FirstOrDefault(c => c.CollarManufacturer == "Telonics" && c.CollarId == id);
            if (collar == null)
                return;
            //Add Parameter
            var start = (DateTime) TpfDataGridView.SelectedRows[0].Cells[5].Value;
            //Since this is a new collar, I don't need to worry about any parameter conflicts.
            var param = new CollarParameter
                {
                    Collar = collar,
                    CollarParameterFile = File,
                    StartDate = start
                };
            Database.CollarParameters.InsertOnSubmit(param);
            if (SubmitChanges())
                TpfDataChanged();

            //Add PlatformDeployment
            var platformType = (string)TpfDataGridView.SelectedRows[0].Cells[2].Value;
            var platformId = (string)TpfDataGridView.SelectedRows[0].Cells[3].Value;
            if (platformType == "Argos")
            {
                var platform = Database.ArgosPlatforms.FirstOrDefault(a => a.PlatformId == platformId);
                if (platform == null)
                {
                    var form = new AddArgosPlatformForm();
                    form.DatabaseChanged += (o, x) => ArgosAdded(platformId, collar, start);
                    form.SetDefaultPlatform(platformId);
                    form.Show(this);
                }
                else
                {
                    AddArgosDeployment(platformId, collar, start);
                }
            }
            if (platformType == "Iridium")
            {
                //TODO: implement support for Iridium
            }
        }
 private void AddPlatformButton_Click(object sender, EventArgs e)
 {
     var index = TpfDataGridView.SelectedRows[0].Index;
     var collar = _collars[index];
     var platform = (string)TpfDataGridView.SelectedRows[0].Cells[2].Value;
     var platformId = (string)TpfDataGridView.SelectedRows[0].Cells[3].Value;
     var start = (DateTime)TpfDataGridView.SelectedRows[0].Cells[5].Value;
     if (platform == "Argos")
     {
         if (Database.ArgosPlatforms.Any(a => a.PlatformId == platformId))
             AddArgosDeployment(platformId, collar, start);
         else
         {
             //First add the Argosplatform
             var form = new AddArgosPlatformForm();
             form.SetDefaultPlatform(platformId);
             form.DatabaseChanged += (o, x) => AddArgosDeployment(platformId, collar, start);
             form.Show(this);
         }
     }
     if (platform == "Argos")
     {
         //TODO: implement support for Iridium
     }
 }