Example #1
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (selectedGateway == null)
            {
                return;
            }

            MessageBoxResult result = MessageBox.Show("Are you sure to delete this?", "WARNING!", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.No)
            {
                return;
            }

            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                Gateway gateway = (Gateway)lstGateways.SelectedItem;
                IndoorPositioningClient.DeleteGateway(gateway);

                /* remove selected item */
                selectedGateway = null;
                selectedIndex   = 0;
                /* Load the list again */
                Load();
                Mouse.OverrideCursor = Cursors.Arrow;
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = Cursors.Arrow;
                MessageBox.Show(ex.ToString());
            }
        }