// // Constructors // public MainWindow( ) { InitializeComponent( ); foreach ( var network in _configuration.Networks ) { var networkWrapper = new NetworkWrapper( network ); networkWrapper.ConnectFailed += NetworkWrapper_ConnectFailed; networkWrapper.ConnectStarted += NetworkWrapper_ConnectStarted; networkWrapper.ConnectSucceeded += NetworkWrapper_ConnectSucceeded; networkWrapper.ServerChange += NetworkWrapper_ServerChange; _networks.Add( network.RefId, networkWrapper ); foreach ( var serverWrapper in networkWrapper.Servers ) { serverWrapper.ConnectFailed += ServerWrapper_ConnectFailed; serverWrapper.ConnectStarted += ServerWrapper_ConnectStarted; serverWrapper.ConnectSucceeded += ServerWrapper_ConnectSucceeded; _servers.Add( serverWrapper.RefId, serverWrapper ); } } RestoreWindowState( ); _commandProcessor = new CommandProcessor( ); _inputProcessor = new InputProcessor { CommandProcessor = _commandProcessor }; }
// // Constructors // public MainWindow( ) { InitializeComponent( ); foreach (var network in _configuration.Networks) { var networkWrapper = new NetworkWrapper(network); networkWrapper.ConnectFailed += NetworkWrapper_ConnectFailed; networkWrapper.ConnectStarted += NetworkWrapper_ConnectStarted; networkWrapper.ConnectSucceeded += NetworkWrapper_ConnectSucceeded; networkWrapper.ServerChange += NetworkWrapper_ServerChange; _networks.Add(network.RefId, networkWrapper); foreach (var serverWrapper in networkWrapper.Servers) { serverWrapper.ConnectFailed += ServerWrapper_ConnectFailed; serverWrapper.ConnectStarted += ServerWrapper_ConnectStarted; serverWrapper.ConnectSucceeded += ServerWrapper_ConnectSucceeded; _servers.Add(serverWrapper.RefId, serverWrapper); } } RestoreWindowState( ); _commandProcessor = new CommandProcessor( ); _inputProcessor = new InputProcessor { CommandProcessor = _commandProcessor }; }
// // Constructors // public MainWindow( ) { InitializeComponent( ); _app = (App)Application.Current; _configuration = _app.ConfigurationManager.Configuration; foreach (var network in _configuration.Networks) { var networkWrapper = new NetworkWrapper(network); networkWrapper.ConnectFailed += NetworkWrapper_ConnectFailed; networkWrapper.ConnectStarted += NetworkWrapper_ConnectStarted; networkWrapper.ConnectSucceeded += NetworkWrapper_ConnectSucceeded; networkWrapper.ServerChange += NetworkWrapper_ServerChange; _networks.Add(network.RefId, networkWrapper); foreach (var serverWrapper in networkWrapper.Servers) { _servers.Add(serverWrapper.RefId, serverWrapper); } } RestoreWindowState( ); InputProcessor = new InputProcessor { CommandProcessor = (CommandProcessor = new CommandProcessor( )) }; }
// // Command bindings: View menu // // // Command bindings: Network menu // // NetworkConnect private void NetworkConnect_Executed(object sender, ExecutedRoutedEventArgs ev) { var dialog = new NetworkConnectDialog { Configuration = _configuration, }; if (!(dialog.ShowDialog( ) ?? false)) { Debug.Print("MainWindow.NetworkConnect_Executed: cancelled"); return; } Debug.Print("MainWindow.NetworkConnect_Executed: result is: Name='{0}' RefId='{1}'", dialog.Result.Name, dialog.Result.RefId); _currentNetwork = _networks[dialog.Result.RefId]; _currentNetwork.Connect( ); }
// // Constructors // public MainWindow( ) { InitializeComponent( ); _app = (App) Application.Current; _configuration = _app.ConfigurationManager.Configuration; foreach ( var network in _configuration.Networks ) { var networkWrapper = new NetworkWrapper( network ); networkWrapper.ConnectFailed += NetworkWrapper_ConnectFailed; networkWrapper.ConnectStarted += NetworkWrapper_ConnectStarted; networkWrapper.ConnectSucceeded += NetworkWrapper_ConnectSucceeded; networkWrapper.ServerChange += NetworkWrapper_ServerChange; _networks.Add( network.RefId, networkWrapper ); foreach ( var serverWrapper in networkWrapper.Servers ) { _servers.Add( serverWrapper.RefId, serverWrapper ); } } RestoreWindowState( ); InputProcessor = new InputProcessor { CommandProcessor = ( CommandProcessor = new CommandProcessor( ) ) }; }
private void NetworkDisconnect_Executed( object sender, ExecutedRoutedEventArgs ev ) { _currentNetwork.Disconnect( ); _currentNetwork = null; }
// // Command bindings: View menu // // // Command bindings: Network menu // // NetworkConnect private void NetworkConnect_Executed( object sender, ExecutedRoutedEventArgs ev ) { var dialog = new NetworkConnectDialog { Configuration = _configuration, }; if ( !( dialog.ShowDialog( ) ?? false ) ) { Debug.Print( "MainWindow.NetworkConnect_Executed: cancelled" ); return; } Debug.Print( "MainWindow.NetworkConnect_Executed: result is: Name='{0}' RefId='{1}'", dialog.Result.Name, dialog.Result.RefId ); _currentNetwork = _networks[ dialog.Result.RefId ]; _currentNetwork.Connect( ); }
private void NetworkDisconnect_Executed(object sender, ExecutedRoutedEventArgs ev) { _currentNetwork.Disconnect( ); _currentNetwork = null; }