public MainWindowViewModel() { LoadedCommand = new DelegateCommand(OnLoaded); OpenSettingsCommand = new DelegateCommand(OnOpenSettingsCommand); ExitSettingsCommand = new DelegateCommand(OnExitSettingsCommand); fileWriter = new FileWriter(); this.settingsViewModel = new SettingsViewModel(); this.telnetViewerViewModel = new TelnetViewerViewModel(fileWriter); this.connectionDetailsViewModel = new ConnectionDetailsViewModel(this.settingsViewModel.DefaultSettings, this.telnetViewerViewModel, fileWriter); this.quickCommandsViewModel = new QuickCommandsViewModel(this.settingsViewModel.DefaultSettings, this.telnetViewerViewModel); }
public ConnectionDetailsViewModel(SettingsBindableModel defaultSettings, TelnetViewerViewModel telnetViewerViewModel, FileWriter fileWriter) { this.telnetViewerViewModel = telnetViewerViewModel; this.fileWriter = fileWriter; ConnectDisconnectCommand = new DelegateCommand(OnConnectDisconnectCommand, CanConnectDisconnect); ClearCommand = new DelegateCommand(OnClearCommand); BrowseCommand = new DelegateCommand(OnBrowseCommand); ScrollToEndCommand = new DelegateCommand(OnScrollToEndCommand); telnetViewerViewModel.TelnetClient.ConnectionStatusChanged += DisconnectCommandRaiseCanExecuteChanged; telnetViewerViewModel.TelnetClient.ResponseReceived += TelnetClient_ResponseReceived; SetDefaultConnectionDetails(); ConnectionDetails.ServerAddress = defaultSettings.DefaultServerAddress; ConnectionDetails.ServerPort = defaultSettings.DefaultServerPort; OutputDirectory = defaultSettings.DefaultOutputDirectory; FileName = defaultSettings.DefaultFileName; IsSavingToFile = defaultSettings.AutomaticallySaveToFile; }