private async void CopyAsSessionAction() { CustomDialog customDialog = new CustomDialog() { Title = Application.Current.Resources["String_Header_CopySession"] as string }; RemoteDesktopSessionViewModel remoteDesktopSessionViewModel = new RemoteDesktopSessionViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); ConfigurationManager.Current.FixAirspace = false; RemoteDesktopSessionInfo remoteDesktopSessionInfo = new RemoteDesktopSessionInfo { Name = instance.Name, Host = instance.Host, Group = instance.Group, Tags = instance.Tags }; RemoteDesktopSessionManager.AddSession(remoteDesktopSessionInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); ConfigurationManager.Current.FixAirspace = false; }, RemoteDesktopSessionManager.GetSessionGroups(), SelectedSession); customDialog.Content = new RemoteDesktopSessionDialog { DataContext = remoteDesktopSessionViewModel }; ConfigurationManager.Current.FixAirspace = true; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
public RemoteDesktopControl(RemoteDesktopSessionInfo info) { InitializeComponent(); DataContext = this; Disconnected = false; HideRdpClient = false; rdpClient.Server = info.Hostname; // AdvancedSettings rdpClient.AdvancedSettings9.AuthenticationLevel = 2; rdpClient.AdvancedSettings9.EnableCredSspSupport = true; // Devices and resources rdpClient.AdvancedSettings9.RedirectClipboard = info.RedirectClipboard; rdpClient.AdvancedSettings9.RedirectDevices = info.RedirectDevices; rdpClient.AdvancedSettings9.RedirectDrives = info.RedirectDrives; rdpClient.AdvancedSettings9.RedirectPorts = info.RedirectPorts; rdpClient.AdvancedSettings9.RedirectSmartCards = info.RedirectSmartCards; rdpClient.AdvancedSettings9.RedirectPrinters = info.RedirectPrinters; // Display rdpClient.ColorDepth = info.ColorDepth; // 8, 15, 16, 24 rdpClient.DesktopWidth = info.DesktopWidth; rdpClient.DesktopHeight = info.DesktopHeight; // Events rdpClient.OnDisconnected += RdpClient_OnDisconnected;; rdpClient.Connect(); }
public static RemoteDesktopSessionInfo CreateSessionInfo(ProfileInfo profileInfo = null) { var info = new RemoteDesktopSessionInfo { Hostname = profileInfo?.Host, // Display AdjustScreenAutomatically = profileInfo != null && profileInfo.RemoteDesktop_OverrideDisplay ? profileInfo.RemoteDesktop_AdjustScreenAutomatically : SettingsManager.Current.RemoteDesktop_AdjustScreenAutomatically, UseCurrentViewSize = profileInfo != null && profileInfo.RemoteDesktop_OverrideDisplay ? profileInfo.RemoteDesktop_UseCurrentViewSize : SettingsManager.Current.RemoteDesktop_UseCurrentViewSize, DesktopWidth = profileInfo != null && profileInfo.RemoteDesktop_OverrideDisplay ? (profileInfo.RemoteDesktop_UseCustomScreenSize ? profileInfo.RemoteDesktop_CustomScreenWidth : profileInfo.RemoteDesktop_ScreenWidth) : (SettingsManager.Current.RemoteDesktop_UseCustomScreenSize ? SettingsManager.Current.RemoteDesktop_CustomScreenWidth : SettingsManager.Current.RemoteDesktop_ScreenWidth), DesktopHeight = profileInfo != null && profileInfo.RemoteDesktop_OverrideDisplay ? (profileInfo.RemoteDesktop_UseCustomScreenSize ? profileInfo.RemoteDesktop_CustomScreenHeight : profileInfo.RemoteDesktop_ScreenHeight) : (SettingsManager.Current.RemoteDesktop_UseCustomScreenSize ? SettingsManager.Current.RemoteDesktop_CustomScreenHeight : SettingsManager.Current.RemoteDesktop_ScreenHeight), ColorDepth = profileInfo != null && profileInfo.RemoteDesktop_OverrideColorDepth ? profileInfo.RemoteDesktop_ColorDepth : SettingsManager.Current.RemoteDesktop_ColorDepth, // Network Port = profileInfo != null && profileInfo.RemoteDesktop_OverridePort ? profileInfo.RemoteDesktop_Port : SettingsManager.Current.RemoteDesktop_Port, // Authentication EnableCredSspSupport = profileInfo != null && profileInfo.RemoteDesktop_OverrideCredSspSupport ? profileInfo.RemoteDesktop_EnableCredSspSupport : SettingsManager.Current.RemoteDesktop_EnableCredSspSupport, AuthenticationLevel = profileInfo != null && profileInfo.RemoteDesktop_OverrideAuthenticationLevel ? profileInfo.RemoteDesktop_AuthenticationLevel : SettingsManager.Current.RemoteDesktop_AuthenticationLevel, // Remote audio AudioRedirectionMode = profileInfo != null && profileInfo.RemoteDesktop_OverrideAudioRedirectionMode ? profileInfo.RemoteDesktop_AudioRedirectionMode : SettingsManager.Current.RemoteDesktop_AudioRedirectionMode, AudioCaptureRedirectionMode = profileInfo != null && profileInfo.RemoteDesktop_OverrideAudioCaptureRedirectionMode ? profileInfo.RemoteDesktop_AudioCaptureRedirectionMode : SettingsManager.Current.RemoteDesktop_AudioCaptureRedirectionMode, // Keyboard KeyboardHookMode = profileInfo != null && profileInfo.RemoteDesktop_OverrideApplyWindowsKeyCombinations ? profileInfo.RemoteDesktop_KeyboardHookMode : SettingsManager.Current.RemoteDesktop_KeyboardHookMode, // Local devices and resources RedirectClipboard = profileInfo != null && profileInfo.RemoteDesktop_OverrideRedirectClipboard ? profileInfo.RemoteDesktop_RedirectClipboard : SettingsManager.Current.RemoteDesktop_RedirectClipboard, RedirectDevices = profileInfo != null && profileInfo.RemoteDesktop_OverrideRedirectDevices ? profileInfo.RemoteDesktop_RedirectDevices : SettingsManager.Current.RemoteDesktop_RedirectDevices, RedirectDrives = profileInfo != null && profileInfo.RemoteDesktop_OverrideRedirectDrives ? profileInfo.RemoteDesktop_RedirectDrives : SettingsManager.Current.RemoteDesktop_RedirectDrives, RedirectPorts = profileInfo != null && profileInfo.RemoteDesktop_OverrideRedirectPorts ? profileInfo.RemoteDesktop_RedirectPorts : SettingsManager.Current.RemoteDesktop_RedirectPorts, RedirectSmartCards = profileInfo != null && profileInfo.RemoteDesktop_OverrideRedirectSmartcards ? profileInfo.RemoteDesktop_RedirectSmartCards : SettingsManager.Current.RemoteDesktop_RedirectSmartCards, RedirectPrinters = profileInfo != null && profileInfo.RemoteDesktop_OverrideRedirectPrinters ? profileInfo.RemoteDesktop_RedirectPrinters : SettingsManager.Current.RemoteDesktop_RedirectPrinters, // Experience PersistentBitmapCaching = profileInfo != null && profileInfo.RemoteDesktop_OverridePersistentBitmapCaching ? profileInfo.RemoteDesktop_PersistentBitmapCaching : SettingsManager.Current.RemoteDesktop_PersistentBitmapCaching, ReconnectIfTheConnectionIsDropped = profileInfo != null && profileInfo.RemoteDesktop_OverrideReconnectIfTheConnectionIsDropped ? profileInfo.RemoteDesktop_ReconnectIfTheConnectionIsDropped : SettingsManager.Current.RemoteDesktop_ReconnectIfTheConnectionIsDropped, // Performance NetworkConnectionType = profileInfo != null && profileInfo.RemoteDesktop_OverrideNetworkConnectionType ? profileInfo.RemoteDesktop_NetworkConnectionType : SettingsManager.Current.RemoteDesktop_NetworkConnectionType, DesktopBackground = profileInfo != null && profileInfo.RemoteDesktop_OverrideDesktopBackground ? profileInfo.RemoteDesktop_DesktopBackground : SettingsManager.Current.RemoteDesktop_DesktopBackground, FontSmoothing = profileInfo != null && profileInfo.RemoteDesktop_OverrideFontSmoothing ? profileInfo.RemoteDesktop_FontSmoothing : SettingsManager.Current.RemoteDesktop_FontSmoothing, DesktopComposition = profileInfo != null && profileInfo.RemoteDesktop_OverrideDesktopComposition ? profileInfo.RemoteDesktop_DesktopComposition : SettingsManager.Current.RemoteDesktop_DesktopComposition, ShowWindowContentsWhileDragging = profileInfo != null && profileInfo.RemoteDesktop_OverrideShowWindowContentsWhileDragging ? profileInfo.RemoteDesktop_ShowWindowContentsWhileDragging : SettingsManager.Current.RemoteDesktop_ShowWindowContentsWhileDragging, MenuAndWindowAnimation = profileInfo != null && profileInfo.RemoteDesktop_OverrideMenuAndWindowAnimation ? profileInfo.RemoteDesktop_MenuAndWindowAnimation : SettingsManager.Current.RemoteDesktop_MenuAndWindowAnimation, VisualStyles = profileInfo != null && profileInfo.RemoteDesktop_OverrideVisualStyles ? profileInfo.RemoteDesktop_VisualStyles : SettingsManager.Current.RemoteDesktop_VisualStyles, }; // Set credentials if (profileInfo.RemoteDesktop_UseCredentials) { info.CustomCredentials = true; info.Username = profileInfo.RemoteDesktop_Username; info.Password = profileInfo.RemoteDesktop_Password; } return(info); }
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; }
public RemoteDesktopHostViewModel(IDialogCoordinator instance) { dialogCoordinator = instance; // Check if RDP 8.1 is available IsRDP8dot1Available = Models.RemoteDesktop.RemoteDesktop.IsRDP8dot1Available(); if (IsRDP8dot1Available) { InterTabClient = new DragablzInterTabClient(ApplicationViewManager.Name.RemoteDesktop); TabItems = new ObservableCollection <DragablzTabItem>(); // 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(); // 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; }
public RemoteDesktopControl(RemoteDesktopSessionInfo info) { InitializeComponent(); DataContext = this; _rdpSessionInfo = info; reconnectAdjustScreenTimer.Tick += ReconnectAdjustScreenTimer_Tick; reconnectAdjustScreenTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
public RemoteDesktopSessionViewModel(Action <RemoteDesktopSessionViewModel> saveCommand, Action <RemoteDesktopSessionViewModel> cancelHandler, List <string> groups, RemoteDesktopSessionInfo sessionInfo = null) { _saveCommand = new RelayCommand(p => saveCommand(this)); _cancelCommand = new RelayCommand(p => cancelHandler(this)); _sessionInfo = sessionInfo ?? new RemoteDesktopSessionInfo(); Name = _sessionInfo.Name; Hostname = _sessionInfo.Hostname; Group = string.IsNullOrEmpty(_sessionInfo.Group) ? Application.Current.Resources["String_Default"] as string : _sessionInfo.Group; _groups = CollectionViewSource.GetDefaultView(groups); _groups.SortDescriptions.Add(new SortDescription()); _isLoading = false; }
public RemoteDesktopSessionViewModel(Action <RemoteDesktopSessionViewModel> saveCommand, Action <RemoteDesktopSessionViewModel> cancelHandler, List <string> groups, RemoteDesktopSessionInfo sessionInfo = null) { _saveCommand = new RelayCommand(p => saveCommand(this)); _cancelCommand = new RelayCommand(p => cancelHandler(this)); _sessionInfo = sessionInfo ?? new RemoteDesktopSessionInfo(); Name = _sessionInfo.Name; Hostname = _sessionInfo.Hostname; // Get the group, if not --> get the first group (ascending), fallback --> default group Group = string.IsNullOrEmpty(_sessionInfo.Group) ? (groups.Count > 0 ? groups.OrderBy(x => x).First() : Application.Current.Resources["String_Default"] as string) : _sessionInfo.Group; Tags = _sessionInfo.Tags; _groups = CollectionViewSource.GetDefaultView(groups); _groups.SortDescriptions.Add(new SortDescription()); _isLoading = false; }
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 for complete tag or by name if (search.StartsWith(tagIdentifier, StringComparison.OrdinalIgnoreCase)) { 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; }
private void RemoteDesktopSession_Search(object sender, FilterEventArgs e) { if (string.IsNullOrEmpty(Search)) { e.Accepted = true; return; } RemoteDesktopSessionInfo info = e.Item as RemoteDesktopSessionInfo; string search = Search.Trim(); if (info.Host.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) { e.Accepted = true; } else { e.Accepted = false; } }
private async void EditSessionAction() { CustomDialog customDialog = new CustomDialog() { Title = LocalizationManager.GetStringByKey("String_Header_EditSession") }; RemoteDesktopSessionViewModel remoteDesktopSessionViewModel = new RemoteDesktopSessionViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); ConfigurationManager.Current.FixAirspace = false; RemoteDesktopSessionManager.RemoveSession(SelectedSession); RemoteDesktopSessionInfo remoteDesktopSessionInfo = new RemoteDesktopSessionInfo { Name = instance.Name, Host = instance.Host, CredentialID = instance.CredentialID, Group = instance.Group, Tags = instance.Tags }; RemoteDesktopSessionManager.AddSession(remoteDesktopSessionInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); ConfigurationManager.Current.FixAirspace = false; }, RemoteDesktopSessionManager.GetSessionGroups(), SelectedSession); customDialog.Content = new RemoteDesktopSessionDialog { DataContext = remoteDesktopSessionViewModel }; ConfigurationManager.Current.FixAirspace = true; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
public RemoteDesktopSessionViewModel(Action <RemoteDesktopSessionViewModel> saveCommand, Action <RemoteDesktopSessionViewModel> cancelHandler, List <string> groups, RemoteDesktopSessionInfo sessionInfo = null) { _saveCommand = new RelayCommand(p => saveCommand(this)); _cancelCommand = new RelayCommand(p => cancelHandler(this)); _sessionInfo = sessionInfo ?? new RemoteDesktopSessionInfo(); Name = _sessionInfo.Name; Host = _sessionInfo.Host; CredentialID = _sessionInfo.CredentialID; // Get the group, if not --> get the first group (ascending), fallback --> default group Group = string.IsNullOrEmpty(_sessionInfo.Group) ? (groups.Count > 0 ? groups.OrderBy(x => x).First() : Application.Current.Resources["String_Default"] as string) : _sessionInfo.Group; Tags = _sessionInfo.Tags; if (CredentialManager.Loaded) { _credentials = CollectionViewSource.GetDefaultView(CredentialManager.CredentialInfoList); } else { ShowUnlockCredentialsHint = true; } // Fake the entry for the user (if credentials are not loaded or credential was deleted) --> example [12] if (CredentialID != null && (!CredentialManager.Loaded || CredentialManager.GetCredentialByID((int)CredentialID) == null)) { _credentials = CollectionViewSource.GetDefaultView(new List <CredentialInfo>() { new CredentialInfo((int)CredentialID) }); } _groups = CollectionViewSource.GetDefaultView(groups); _groups.SortDescriptions.Add(new SortDescription()); _isLoading = false; }
public static RemoteDesktopSessionInfo CreateSessionInfo(ProfileInfo profileInfo) { var info = new RemoteDesktopSessionInfo(); // Override hostname info.Hostname = profileInfo.Host; // Network if (profileInfo.RemoteDesktop_OverridePort) { info.Port = profileInfo.RemoteDesktop_Port; } // Display if (profileInfo.RemoteDesktop_OverrideDisplay) { info.AdjustScreenAutomatically = profileInfo.RemoteDesktop_AdjustScreenAutomatically; info.UseCurrentViewSize = profileInfo.RemoteDesktop_UseCurrentViewSize; info.DesktopWidth = profileInfo.RemoteDesktop_UseCustomScreenSize ? profileInfo.RemoteDesktop_CustomScreenWidth : profileInfo.RemoteDesktop_ScreenWidth; info.DesktopHeight = profileInfo.RemoteDesktop_UseCustomScreenSize ? profileInfo.RemoteDesktop_CustomScreenHeight : profileInfo.RemoteDesktop_ScreenHeight; info.ColorDepth = profileInfo.RemoteDesktop_ColorDepth; } // Authentication if (profileInfo.RemoteDesktop_OverrideCredSspSupport) { info.EnableCredSspSupport = profileInfo.RemoteDesktop_EnableCredSspSupport; } if (profileInfo.RemoteDesktop_OverrideAuthenticationLevel) { info.AuthenticationLevel = profileInfo.RemoteDesktop_AuthenticationLevel; } // Remote audio if (profileInfo.RemoteDesktop_OverrideAudioRedirectionMode) { info.AudioRedirectionMode = profileInfo.RemoteDesktop_AudioRedirectionMode; } if (profileInfo.RemoteDesktop_OverrideAudioCaptureRedirectionMode) { info.AudioCaptureRedirectionMode = profileInfo.RemoteDesktop_AudioCaptureRedirectionMode; } // Keyboard if (profileInfo.RemoteDesktop_OverrideApplyWindowsKeyCombinations) { info.KeyboardHookMode = profileInfo.RemoteDesktop_KeyboardHookMode; } // Local devices and resources if (profileInfo.RemoteDesktop_OverrideRedirectClipboard) { info.RedirectClipboard = profileInfo.RemoteDesktop_RedirectClipboard; } if (profileInfo.RemoteDesktop_OverrideRedirectDevices) { info.RedirectDevices = profileInfo.RemoteDesktop_RedirectDevices; } if (profileInfo.RemoteDesktop_OverrideRedirectDrives) { info.RedirectDrives = profileInfo.RemoteDesktop_RedirectDrives; } if (profileInfo.RemoteDesktop_OverrideRedirectPorts) { info.RedirectPorts = profileInfo.RemoteDesktop_RedirectPorts; } if (profileInfo.RemoteDesktop_OverrideRedirectSmartcards) { info.RedirectSmartCards = profileInfo.RemoteDesktop_RedirectSmartCards; } if (profileInfo.RemoteDesktop_OverrideRedirectPrinters) { info.RedirectPrinters = profileInfo.RemoteDesktop_RedirectPrinters; } // Experience if (profileInfo.RemoteDesktop_OverridePersistentBitmapCaching) { info.PersistentBitmapCaching = profileInfo.RemoteDesktop_PersistentBitmapCaching; } if (profileInfo.RemoteDesktop_OverrideReconnectIfTheConnectionIsDropped) { info.ReconnectIfTheConnectionIsDropped = profileInfo.RemoteDesktop_ReconnectIfTheConnectionIsDropped; } // Performance if (profileInfo.RemoteDesktop_OverrideNetworkConnectionType) { info.NetworkConnectionType = profileInfo.RemoteDesktop_NetworkConnectionType; } if (profileInfo.RemoteDesktop_OverrideDesktopBackground) { info.DesktopBackground = profileInfo.RemoteDesktop_DesktopBackground; } if (profileInfo.RemoteDesktop_OverrideFontSmoothing) { info.FontSmoothing = profileInfo.RemoteDesktop_FontSmoothing; } if (profileInfo.RemoteDesktop_OverrideDesktopComposition) { info.DesktopComposition = profileInfo.RemoteDesktop_DesktopComposition; } if (profileInfo.RemoteDesktop_OverrideShowWindowContentsWhileDragging) { info.ShowWindowContentsWhileDragging = profileInfo.RemoteDesktop_ShowWindowContentsWhileDragging; } if (profileInfo.RemoteDesktop_OverrideMenuAndWindowAnimation) { info.MenuAndWindowAnimation = profileInfo.RemoteDesktop_MenuAndWindowAnimation; } if (profileInfo.RemoteDesktop_OverrideVisualStyles) { info.VisualStyles = profileInfo.RemoteDesktop_VisualStyles; } // Set credentials if (profileInfo.RemoteDesktop_UseCredentials) { info.CustomCredentials = true; info.Username = profileInfo.RemoteDesktop_Username; info.Password = profileInfo.RemoteDesktop_Password; } return(info); }