private async void ConnectProfileAs()
        {
            CustomDialog customDialog = new CustomDialog()
            {
                Title = LocalizationManager.GetStringByKey("String_Header_ConnectAs")
            };

            RemoteDesktopConnectViewModel remoteDesktopConnectViewModel = new RemoteDesktopConnectViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);
                ConfigurationManager.Current.IsDialogOpen = false;

                Models.RemoteDesktop.RemoteDesktopSessionInfo session = new Models.RemoteDesktop.RemoteDesktopSessionInfo
                {
                    Hostname = instance.Host
                };

                if (instance.UseCredentials)
                {
                    session.CustomCredentials = true;

                    if (instance.CustomCredentials)
                    {
                        session.Username = instance.Username;
                        session.Password = instance.Password;
                    }
                    else
                    {
                        CredentialInfo credentialInfo = CredentialManager.GetCredentialByID((int)instance.CredentialID);

                        session.Username = credentialInfo.Username;
                        session.Password = credentialInfo.Password;
                    }
                }

                Connect(session, instance.Name);
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);
                ConfigurationManager.Current.IsDialogOpen = false;
            }, true)
            {
                // Set name, hostname
                Name = SelectedProfile.Name,
                Host = SelectedProfile.RemoteDesktop_Host,

                // Request credentials
                UseCredentials = true
            };

            customDialog.Content = new RemoteDesktopConnectDialog
            {
                DataContext = remoteDesktopConnectViewModel
            };

            ConfigurationManager.Current.IsDialogOpen = true;
            await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }
        private async void Connect(string host = null)
        {
            CustomDialog customDialog = new CustomDialog()
            {
                Title = LocalizationManager.GetStringByKey("String_Header_Connect")
            };

            RemoteDesktopConnectViewModel remoteDesktopConnectViewModel = new RemoteDesktopConnectViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);
                ConfigurationManager.Current.IsDialogOpen = false;

                // Add host to history
                AddHostToHistory(instance.Host);

                // Create new remote desktop Profile info
                Models.RemoteDesktop.RemoteDesktopSessionInfo session = new Models.RemoteDesktop.RemoteDesktopSessionInfo
                {
                    Hostname = instance.Host
                };

                if (instance.UseCredentials)
                {
                    session.CustomCredentials = true;

                    if (instance.CustomCredentials)
                    {
                        session.Username = instance.Username;
                        session.Password = instance.Password;
                    }
                    else
                    {
                        CredentialInfo credentialInfo = CredentialManager.GetCredentialByID((int)instance.CredentialID);

                        session.Username = credentialInfo.Username;
                        session.Password = credentialInfo.Password;
                    }
                }

                Connect(session);
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);
                ConfigurationManager.Current.IsDialogOpen = false;
            })
            {
                Host = host
            };

            customDialog.Content = new RemoteDesktopConnectDialog
            {
                DataContext = remoteDesktopConnectViewModel
            };

            ConfigurationManager.Current.IsDialogOpen = true;
            await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }