public ARPTableViewModel() { _arpTableView = CollectionViewSource.GetDefaultView(ARPTable); _arpTableView.SortDescriptions.Add(new SortDescription("IPAddressInt32", ListSortDirection.Ascending)); _arpTableView.Filter = o => { if (string.IsNullOrEmpty(Filter)) { return(true); } ARPTableInfo info = o as ARPTableInfo; string filter = Filter.Replace(" ", "").Replace("-", "").Replace(":", ""); // Search by IPAddress and MACAddress return(info.IPAddress.ToString().IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1 || info.MACAddress.ToString().IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1); }; Refresh(); LoadSettings(); //_isLoading = false; }
public ARPTableViewModel(IDialogCoordinator instance) { dialogCoordinator = instance; _arpTableView = CollectionViewSource.GetDefaultView(ARPTable); _arpTableView.SortDescriptions.Add(new SortDescription(nameof(ARPTableInfo.IPAddressInt32), ListSortDirection.Ascending)); _arpTableView.Filter = o => { if (string.IsNullOrEmpty(Search)) { return(true); } ARPTableInfo info = o as ARPTableInfo; string filter = Search.Replace(" ", "").Replace("-", "").Replace(":", ""); // Search by IPAddress and MACAddress return(info.IPAddress.ToString().IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1 || info.MACAddress.ToString().IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1); }; Refresh(); }
public ARPTableViewModel(IDialogCoordinator instance) { dialogCoordinator = instance; _arpTableView = CollectionViewSource.GetDefaultView(ARPTable); _arpTableView.SortDescriptions.Add(new SortDescription(nameof(ARPTableInfo.IPAddressInt32), ListSortDirection.Ascending)); _arpTableView.Filter = o => { if (string.IsNullOrEmpty(Search)) { return(true); } ARPTableInfo info = o as ARPTableInfo; string filter = Search.Replace(" ", "").Replace("-", "").Replace(":", ""); // Search by IPAddress and MACAddress return(info.IPAddress.ToString().IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1 || info.MACAddress.ToString().IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1 || (info.IsMulticast ? LocalizationManager.GetStringByKey("String_Yes") : LocalizationManager.GetStringByKey("String_No")).IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1); }; _autoRefreshTimes = CollectionViewSource.GetDefaultView(AutoRefreshTime.Defaults); SelectedAutoRefreshTime = AutoRefreshTimes.SourceCollection.Cast <AutoRefreshTimeInfo>().FirstOrDefault(x => (x.Value == SettingsManager.Current.ARPTable_AutoRefreshTime.Value && x.TimeUnit == SettingsManager.Current.ARPTable_AutoRefreshTime.TimeUnit)); _autoRefreshTimer.Tick += AutoRefreshTimer_Tick; LoadSettings(); _isLoading = false; Refresh(); if (AutoRefresh) { StartAutoRefreshTimer(); } }