public PingHostViewModel()
        {
            InterTabClient = new DragablzPingInterTabClient();

            TabItems = new ObservableCollection <DragablzPingTabItem>()
            {
                new DragablzPingTabItem(Application.Current.Resources["String_Header_Ping"] as string, new PingView(_tabId), _tabId)
            };
        }
        public PingHostViewModel()
        {
            InterTabClient = new DragablzPingInterTabClient();

            TabItems = new ObservableCollection <DragablzPingTabItem>()
            {
                new DragablzPingTabItem(LocalizationManager.GetStringByKey("String_Header_Ping"), new PingView(_tabId), _tabId)
            };
        }
Beispiel #3
0
        public PingHostViewModel(IDialogCoordinator instance)
        {
            dialogCoordinator = instance;

            InterTabClient = new DragablzPingInterTabClient();

            TabItems = new ObservableCollection <DragablzTabItem>()
            {
                new DragablzTabItem(LocalizationManager.GetStringByKey("String_Header_NewTab"), new PingView(_tabId), _tabId)
            };

            // Load profiles
            if (PingProfileManager.Profiles == null)
            {
                PingProfileManager.Load();
            }

            _pingProfiles = CollectionViewSource.GetDefaultView(PingProfileManager.Profiles);
            _pingProfiles.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
            _pingProfiles.SortDescriptions.Add(new SortDescription("Group", ListSortDirection.Ascending));
            _pingProfiles.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            _pingProfiles.Filter = o =>
            {
                if (string.IsNullOrEmpty(Search))
                {
                    return(true);
                }

                PingProfileInfo info = o as PingProfileInfo;

                string search = Search.Trim();

                // Search by: Tag
                if (search.StartsWith(tagIdentifier, StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(info.Tags))
                    {
                        return(false);
                    }
                    else
                    {
                        return(info.Tags.Replace(" ", "").Split(';').Any(str => search.Substring(tagIdentifier.Length, search.Length - tagIdentifier.Length).IndexOf(str, StringComparison.OrdinalIgnoreCase) > -1));
                    }
                }
                else // Search by: Name, Hostname
                {
                    return(info.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1 || info.Host.IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1);
                }
            };

            LoadSettings();

            _isLoading = false;
        }