コード例 #1
0
        public RemoteDesktopViewModel(IDialogCoordinator instance)
        {
            dialogCoordinator = instance;

            InterTabClient = new DragablzMainInterTabClient();
            TabContents    = new ObservableCollection <DragablzTabContent>();

            // Load sessions
            if (RemoteDesktopSessionManager.Sessions == null)
            {
                RemoteDesktopSessionManager.Load();
            }

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

                RemoteDesktopSessionInfo info = o as RemoteDesktopSessionInfo;

                string search = Search.Trim();

                // Search by: Name
                return(info.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0);
            };

            LoadSettings();

            _isLoading = false;
        }
コード例 #2
0
        public RemoteDesktopViewModel(IDialogCoordinator instance)
        {
            dialogCoordinator = instance;

            // Check if RDP 8.1 is available
            IsRDP8dot1Available = Models.RemoteDesktop.RemoteDesktop.IsRDP8dot1Available();

            if (IsRDP8dot1Available)
            {
                InterTabClient = new DragablzMainInterTabClient();
                TabItems       = new ObservableCollection <DragablzRemoteDesktopTabItem>();

                // Load sessions
                if (RemoteDesktopSessionManager.Sessions == null)
                {
                    RemoteDesktopSessionManager.Load();
                }

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

                    RemoteDesktopSessionInfo info = o as RemoteDesktopSessionInfo;

                    string search = Search.Trim();

                    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
                    {
                        return(info.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1);
                    }
                };

                LoadSettings();
            }

            _isLoading = false;
        }
コード例 #3
0
        public PingHostViewModel()
        {
            ChangeTabTitleAction = ChangeTabTitle;

            InterTabClient = new DragablzMainInterTabClient();

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