Ejemplo n.º 1
0
        private void AddExpedition_Click(object sender, EventArgs e)
        {
            var addExpeditionForm = new AddExpedition(ExpeditionFormType.Add, _settings);

            if (addExpeditionForm.ShowDialog() == DialogResult.OK)
            {
                if (null == addExpeditionForm.Expedition)
                {
                    return;
                }

                var expedition = addExpeditionForm.Expedition;

                var match = (from p in _expeditions
                             where p.Name == expedition.Name
                             select p).FirstOrDefault();

                if (match != null)
                {
                    return;
                }

                List <Expedition> temp = new List <Expedition>();
                foreach (var exp in _expeditions)
                {
                    exp.Current = false;
                    temp.Add(exp);
                }

                ExpeditionServices.ClearExpeditionCurrentFlags();
                var expSaved = ExpeditionServices.InsertExpedition(expedition);
                temp.Add(expSaved);
                _expeditions = temp;
                LogRichText(string.Format("Added expedition {0} ({1})...", expSaved.Name, expSaved.Id), Color.Red);
                RefreshExpeditionDropDown();
            }
        }
Ejemplo n.º 2
0
        private void AddExpedition_Click(object sender, EventArgs e)
        {
            var addExpeditionForm = new AddExpedition(ExpeditionFormType.Add, _settings);
            if (addExpeditionForm.ShowDialog() == DialogResult.OK) {
                if (null == addExpeditionForm.Expedition) return;

                var expedition = addExpeditionForm.Expedition;

                var match = (from p in _expeditions
                             where p.Name == expedition.Name
                             select p).FirstOrDefault();

                if (match != null) return;

                List<Expedition> temp = new List<Expedition>();
                foreach (var exp in _expeditions) {
                    exp.Current = false;
                    temp.Add(exp);
                }

                ExpeditionServices.ClearExpeditionCurrentFlags();
                var expSaved = ExpeditionServices.InsertExpedition(expedition);
                temp.Add(expSaved);
                _expeditions = temp;
                LogRichText(string.Format("Added expedition {0} ({1})...", expSaved.Name, expSaved.Id), Color.Red);
                RefreshExpeditionDropDown();
            }
        }