Example #1
0
        private void deleteSelectedBaseMap(object sender, MessageBoxClosedArgs e)
        {
            if (e.Result != MessageBoxResult.OK)
            {
                return;
            }

            BaseMapInfo currentSelectedBaseMap = BaseMapsList.SelectedItem as BaseMapInfo;

            if (currentSelectedBaseMap == null)
            {
                return;
            }

            int currIndex = BaseMaps.IndexOf(currentSelectedBaseMap);

            BaseMaps.Remove(currentSelectedBaseMap);
            if (currIndex > BaseMaps.Count - 1) // if last item is being deleted
            {
                currIndex = BaseMaps.Count - 1;
            }

            if (currIndex > -1) // select the next item in the list
            {
                BaseMapsList.SelectedIndex = currIndex;
            }
        }
        private void deleteSelectedBaseMap(object sender, MessageBoxClosedArgs e)
        {
            if (e.Result != MessageBoxResult.OK)
                return;

            BaseMapInfo currentSelectedBaseMap = BaseMapsList.SelectedItem as BaseMapInfo;
            if (currentSelectedBaseMap == null)
                return;

            int currIndex = BaseMaps.IndexOf(currentSelectedBaseMap);
            BaseMaps.Remove(currentSelectedBaseMap);
            if (currIndex > BaseMaps.Count - 1) // if last item is being deleted
                currIndex = BaseMaps.Count - 1;

            if (currIndex > -1) // select the next item in the list
                BaseMapsList.SelectedIndex = currIndex;
        }