public AttachDebuggerWindowViewModel(Instance gceInstance, AttachDebuggerWindow dialogWindow) { OKCommand = new ProtectedAsyncCommand(() => ExceuteAsync(OnOKCommand), canExecuteCommand: false); CancelCommand = new ProtectedCommand(OnCancelCommand, canExecuteCommand: false); var context = new AttachDebuggerContext(gceInstance, dialogWindow); var firstStep = SetCredentialStepViewModel.CreateStep(context); ErrorHandlerUtils.HandleExceptionsAsync(() => ExceuteAsync(() => GotoStep(firstStep))); }
/// <summary> /// Starts the attaching remote debugger wizard. /// </summary> /// <param name="gceInstance">A GCE windows VM <seealso cref="Instance"/> object.</param> public static void PromptUser(Instance gceInstance) { if (String.IsNullOrWhiteSpace(gceInstance.GetPublicIpAddress())) { UserPromptUtils.OkPrompt( message: StringResources.AttachDebuggerAddPublicIpAddressMessage, title: StringResources.UiDefaultPromptTitle); return; } var dialog = new AttachDebuggerWindow(gceInstance); EventsReporterWrapper.ReportEvent(RemoteDebuggerWindowOpenEvent.Create()); dialog.ShowModal(); }
/// <summary> /// Create the <seealso cref="System.Runtime.Remoting.Contexts.Context"/> /// to associate the <paramref name="gceInstance"/>. /// </summary> /// <param name="gceInstance">GCE VM instance object.</param> /// <param name="dialogWindow">The dialog window</param> public AttachDebuggerContext(Instance gceInstance, AttachDebuggerWindow dialogWindow) { GceInstance = gceInstance.ThrowIfNull(nameof(gceInstance)); DialogWindow = dialogWindow.ThrowIfNull(nameof(dialogWindow)); PublicIp = gceInstance.GetPublicIpAddress(); DebuggerPort = new AttachDebuggerFirewallPort( DebuggerPortInfo, Resources.AttachDebuggerRemoteToolsPortDescription, gceInstance, _lazyDataSource); RemotePowerShellPort = new AttachDebuggerFirewallPort( RemotePowerShellPortInfo, Resources.AttachDebuggerRemotePowerShellPortDescription, gceInstance, _lazyDataSource); }