private void BtnRemovePartialContent_Click(Object sender, RoutedEventArgs e) { TextBlock btn = sender as TextBlock; System.Diagnostics.Debug.Assert(btn != null); if (btn == null) { goto end; } PartialContent content = btn.DataContext as PartialContent; System.Diagnostics.Debug.Assert(content != null); if (content == null) { goto end; } ViewModel vm = this.ViewModel; if (vm == null) { goto end; } Boolean didRemoveContent = vm.RemovePartialContent(content); if (!didRemoveContent) { MessageBox.Show("Failed to delete message"); } end: return; }
private void RadioProtocolChecked(Object sender, RoutedEventArgs e) { ConnectionType selectedType = ConnectionType.Unused; if (sender == this.rbUdp) { selectedType = ConnectionType.UDP; } else if (sender == this.rbTcp) { selectedType = ConnectionType.TCP; } System.Diagnostics.Debug.Assert(selectedType != ConnectionType.Unused); if (selectedType == ConnectionType.Unused) { goto end; } ViewModel vm = this.ViewModel; System.Diagnostics.Debug.Assert(vm != null); vm.SwitchConnectionType(selectedType); end: return; }
public MainWindow() { this.InitializeComponent(); ViewModel vm = this.ViewModel; vm.PartialMessageSent += this.Vm_PartialMessageSent; vm.MessageLogAdded += this.Vm_MessageLogAdded; }
private void BtnSend_Click(Object sender, RoutedEventArgs e) { Button btn = sender as Button; System.Diagnostics.Debug.Assert(btn != null); if (btn == null) { goto end; } ViewModel vm = this.ViewModel; if (vm == null) { goto end; } vm.Send( ); end: return; }
private void BtnAddMessageContent_MouseUp(Object sender, MouseButtonEventArgs e) { Image senderControl = sender as Image; System.Diagnostics.Debug.Assert(senderControl != null); if (senderControl == null) { goto end; } ViewModel vm = senderControl.DataContext as ViewModel; System.Diagnostics.Debug.Assert(vm != null); if (vm == null) { goto end; } vm.AddPartialContent(""); end: return; }