示例#1
0
        private void toolStripButtonSave_Click(object sender, EventArgs e)
        {
            UpdateRouteInfo(_currentRoute);

            if (String.IsNullOrEmpty(_currentRoute.Name))
            {
                var result = ExtendedControls.MessageBoxTheme.Show(_discoveryForm, "Please specify a name for the route.", "Unsaved route", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBoxRouteName.Select();
                return;
            }
            if (_currentRoute.Id == -1)
            {
                _currentRoute.Add();
                _savedRoutes.Add(_currentRoute);
            }
            else
            {
                _currentRoute.Update();
            }
            UpdateComboBox();
            toolStripComboBoxRouteSelection.Text = _currentRoute.Name;
        }
        private void toolStripButtonSave_Click(object sender, EventArgs e)
        {
            UpdateRouteInfo(_currentRoute);

            if (_currentRoute.Id == -1)
            {
                _currentRoute.Add();
                _savedRoutes.Add(_currentRoute);
                UpdateComboBox();
            }
            else
            {
                _currentRoute.Update();
            }
        }
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            if (ExtendedControls.MessageBoxTheme.Show(FindForm(), "Are you sure you want to delete this route?", "Delete Route", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (currentroute.Id >= 0)
                {
                    currentroute.Deleted = true;
                    currentroute.Update();

                    savedroute.Remove(currentroute);
                    UpdateUndeleteMenu();
                    UpdateComboBox();
                }

                ClearRoute();
            }
        }
示例#4
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            if (ExtendedControls.MessageBoxTheme.Show(ParentForm, "Are you sure you want to delete this route?", "Delete Route", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (_currentRoute.Id >= 0)
                {
                    if (DeleteIsPermanent && !EDSMClass.Expeditions.Any(r => r.Name.Equals(_currentRoute.Name)))
                    {
                        _currentRoute.Delete();
                    }
                    else
                    {   // Expeditions shouldn't use .Delete(), as LoadControl will ignorantly re-create them at next startup.
                        _currentRoute.Name = "\x7F" + _currentRoute.Name;
                        _currentRoute.Update();
                    }

                    _savedRoutes.Remove(_currentRoute);
                    UpdateComboBox();
                }

                ClearRoute();
            }
        }