public ConnectionGroupViewModel( ConnectionGroup connectionGroup, KnownConnections knownConnections, ConnectionParameterViewModelFactory connectionParameterViewModelFactory) { _connectionGroup = connectionGroup; _knownConnections = knownConnections; _connectionParameterViewModelFactory = new ConnectionParameterViewModelFactory(); ConnectionViewModels = new ObservableCollection <ConnectionDescriptionViewModel>( connectionGroup.Connections .Select(c => new ConnectionDescriptionViewModel(c, this, _knownConnections, new SelectFileView(), _connectionParameterViewModelFactory)) .ToList()); GroupViewModels = new ObservableCollection <ConnectionGroupViewModel>( connectionGroup.Groups .Select(gr => new ConnectionGroupViewModel(gr, knownConnections, _connectionParameterViewModelFactory)) .ToList()); ParameterViewModels = connectionGroup.Parameters .Select(p => connectionParameterViewModelFactory.Create(p)) .ToList(); Name = connectionGroup.Name; }
public ConnectionDescriptionViewModel( ConnectionDescription source, ConnectionGroupViewModel parent, KnownConnections knownConnections, IFileSelector fileSelector, ConnectionParameterViewModelFactory connectionParameterViewModelFactory) { Parent = parent; _knownConnections = knownConnections; _fileSelector = fileSelector; _autoCheckTimer = new Timer(1000); _autoCheckTimer.Elapsed += AutoCheckTimer_Elapsed; _uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); _networkService = new NetworkService(); _connectionParameterViewModelFactory = connectionParameterViewModelFactory; PingAccessibilityIconUri = new Uri("pack://application:,,,/Images/gray-icon.png"); PortAccessibilityIconUri = new Uri("pack://application:,,,/Images/gray-icon.png"); InitFromSource(source); ConnectionTypes = _knownConnections._knownConnectionProfiles.Keys.Except(new[] { "NetCat" }).ToList(); SelectedConnectionType = Source.ConnectionTypeName; }
public SettingsWindow(KnownConnections knownConnections) { Models = knownConnections._knownConnectionProfiles.ToDictionary( pair => pair.Key, pair => ToProfileSettingsVM(pair.Value)); InitializeComponent(); DataContext = Models; }
public MainWindowViewModel() { _knownConnections = new KnownConnections(); ConnectionGroupViewModels = new ObservableCollection <ConnectionGroupViewModel>(); var groups = Load(); if (groups != null) { foreach (var gr in groups) { ConnectionGroupViewModels.Add(new ConnectionGroupViewModel(gr, _knownConnections, new ConnectionParameterViewModelFactory())); } SelectedObject = ConnectionGroupViewModels.FirstOrDefault(); } _timer = new Timer(); _timer.Interval = 30000; _timer.Elapsed += Timer_Elapsed; _timer.Enabled = true; }