예제 #1
0
        private void RemovePoint(bool message = true)
        {
            if (gridView.SelectedItem != null)
            {
                var sta = gridView.SelectedItem;

                if (sta is Station)
                {
                    throw new NotSupportedException("Bahnhöfe können nicht gelöscht werden!");
                }
                else if (sta is BfplPoint point)
                {
                    if (attrs != null)
                    {
                        attrs.RemovePoint(point);
                    }

                    UpdateListView();
                }
            }
            else if (message)
            {
                MessageBox.Show("Zuerst muss eine Zeile ausgewählt werden!", "Löschen");
            }
        }
예제 #2
0
        private void RemovePoint(bool message = true)
        {
            if (gridView.SelectedItem != null)
            {
                var sta = gridView.SelectedItem;

                if (sta is Station)
                {
                    throw new InvalidOperationException("Invalid state: Stations cannot be deleted with this function.");
                }
                if (sta is BfplPoint point)
                {
                    attrs?.RemovePoint(point);
                    UpdateListView();
                }
            }
            else if (message)
            {
                MessageBox.Show("Zuerst muss eine Zeile ausgewählt werden!", "Löschen");
            }
        }