Exemplo n.º 1
0
        private void DeleteCanvasButton_Click(object sender, RoutedEventArgs e)
        {
            if (!int.TryParse(CanvasManagerPort.Text, out var port) || !IsValidIpAddress(CanvasManagerIpAddressTextBox.Text))
            {
                MessageBox.Show("Please enter a valid IP address and port.");
                return;
            }

            _adminClient.CanvasManagerIpAddress  = CanvasManagerIpAddressTextBox.Text;
            _adminClient.CanvasManagerPortNumber = Convert.ToInt32(CanvasManagerPort.Text);
            _adminClient.StartDispatcher(port);

            try
            {
                var canvas = ((SharedAppLayer.Entitities.Canvas)CanvasIdListBox.SelectedItem);
                _adminClient.DeleteCanvas(canvas.CanvasId);
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("No canvas was selected to delete.");
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }