Self-Service instances implementation

Restart services added
Firewall exceptions for self-service instances
This commit is contained in:
Tomek Melissa 2019-12-11 02:46:47 +01:00
Родитель c661214e77
Коммит 4c96d91796
13 изменённых файлов: 835 добавлений и 532 удалений

Просмотреть файл

@ -103,6 +103,12 @@
<Compile Include="ExtendedWebBrowser.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\ChooseService.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\ChooseService.Designer.cs">
<DependentUpon>ChooseService.cs</DependentUpon>
</Compile>
<Compile Include="Forms\UpcomingUpdates.cs">
<SubType>Form</SubType>
</Compile>
@ -206,6 +212,9 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebBrowserHelper.cs" />
<EmbeddedResource Include="Forms\ChooseService.resx">
<DependentUpon>ChooseService.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\UpcomingUpdates.resx">
<DependentUpon>UpcomingUpdates.cs</DependentUpon>
</EmbeddedResource>

Просмотреть файл

@ -1,20 +1,5 @@
namespace LCS
{
public enum ProjectType
{
None = 0,
Deprecated1 = 1,
Deprecated2 = 2,
Deprecated3 = 3,
Deprecated4 = 4,
Deprecated5 = 5,
Learn = 6,
Presales = 7,
Implementation = 8,
Partner = 9,
OnPremImplementation = 10,
ServiceFabricImplementation = 11
}
public enum HotfixesType
{
@ -24,210 +9,142 @@
CriticalMetadata = 16
}
public enum ProjectSystemRoleType
public enum LCSEnvironments
{
None = 0,
ProjectOwner = 1,
Contributor = 2,
ReadOnly = 3,
ProjectContributor = 5,
OperationsAdmin = 6,
EnvironmentAdmin = 7,
InternalSreUser = 8,
InternalSupportUser = 9,
InternalDriUser = 10,
InternalSreTier1User = 11
ALL = 0,
CHE = 1,
SAAS = 2
}
public enum ProjectUserStatus
{
Pending = 0,
Declined = 1,
Accepted = 2
}
#region LCS enums
public enum ProjectDocScope { Methodology = 0, Artifact = 1 }
public enum OrgUserRoleType
{
None = 0,
SystemAdmin = 1,
Admin = 2,
Contributor = 3,
Prospect = 4,
DelegatedAdmin = 5,
SupportAdmin = 6,
OpsAdmin = 7,
DriAdmin = 8,
SreTier1Admin = 9
}
public enum WorkItemStatus { Inactive = 0, Active = 1, Closed = 2, Unknown = 3 }
public enum OrganizationType
{
None = 0,
Partner = 1,
Customer = 2,
Prospect = 3,
Employee = 4
}
public enum WorkItemTaskStatus { Inactive = 0, Active = 1, Closed = 2, Locked = 3, Blocked = 4 }
public enum DeploymentStatus
{
Undefined = 0,
Succeeded = 1,
Failed = 2,
Canceled = 3,
StateTransitionIncomplete = 4
}
public enum WorkItemPhaseStatus { Inactive = 0, Active = 1, Closed = 2, Locked = 3 }
public enum DeploymentState
{
Undefined = 0,
Active = 1,
Paused = 2,
Finished = 3,
Starting = 4,
Stopping = 5,
Stopped = 6,
Deleting = 7,
Deallocating = 8,
Deallocated = 9,
Deleted = 10,
Servicing = 11,
Recovering = 12,
SafeMode = 13,
Restoring = 14,
Swapping = 15,
SwapRollingBack = 16,
RotatingSecrets = 17,
CommitingSwap = 18,
Swapped = 19,
ServicingRollback = 20,
DatabaseRestoreRollback = 21,
Migrating = 22,
RestartingServices = 23,
DatabaseNeedsUpgrade = 24,
ValidatingDataUpgrade = 25,
ExecutingSQLCommand = 26,
ExecutingGenevaAction = 27,
MigratingToSF = 28,
MigratedToSF = 29,
CDSConfiguring = 30,
ScalingOut = 31,
InfrastructureMaintenance = 32,
PreparingForMigration = 33,
PreppedForMigration = 34,
ConfiguringFirewallRules = 35
}
public enum MethodologyScope { Global = 0, Organization = 1, Private = 2, Project = 3, Prospect = 4, Package = 5 }
public enum DeploymentAction
{
Undefined = 0,
Deploy = 1,
Start = 2,
Stop = 3,
Update = 4,
ScaleOut = 5,
Configure = 6,
Delete = 7,
Restart = 8,
Service = 9,
PreService = 10,
PostService = 11,
MoveVMToMaintenancePool = 12,
MoveVMToLivePool = 13,
MarkStepComplete = 14,
Rollback = 15,
Abort = 16,
Failover = 17,
DeployDisasterRecovery = 18,
RestoreDatabaseFromSourceToTargetServer = 19,
Failback = 20,
CleanupFailoverResources = 21,
Resume = 22,
SwapStaging = 23,
SwapRollback = 24,
SwapCommit = 25,
ExecutePowershellScript = 26,
RotateSecrets = 27,
CreateJITAccount = 28,
UpdateNetworkSecurityGroup = 29,
ImportDatabase = 30,
DataUpgrade = 31,
RestartService = 32,
ValidateDataUpgrade = 33,
ExecuteSQLCommand = 34,
Redeploy = 35,
DataMovement = 36,
ExecuteGenevaAction = 37,
DataUpgradeRollback = 38
}
public enum TemplateState { Draft = 0, Published = 1, Deprecated = 2, Deleted = 3 }
public enum IssueStorage
{
None = 0,
Legacy = 1,
Tfs = 2
}
public enum SaasEnvironmentType
{
none = 0,
prod = 1,
sandbox = 2,
devtest = 3
}
public enum SeverityEnum { Information = 0, Warning = 1, Error = 2 }
public enum RefinedEnvironmentType
{
Unknown = 0,
Production = 1,
Sandbox = 2,
Demo = 3,
DevTestDev = 4,
DevTestBuild = 5,
DevTestDevAndBuild = 6,
OnPremSandbox = 7,
OnPremProduction = 8,
HighAvailability = 9
}
public enum MethodologyResourceType { Link = 0, DocumentTemplate = 1 }
public enum UpgradeEnvironmentStatus
{
None = 0,
EnvironmentDeploymentStarted = 1,
EnvironmentDeploymentSucceeded = 2,
EnvironmentDeploymentFailed = 3,
DeployablePackageInstallationStarted = 4,
DeployablePackageInstallationSucceeded = 5,
DeployablePackageInstallationFailed = 6,
DeployablePackageRollbackStarted = 7,
DeployablePackageRollbackSucceeded = 8,
DeployablePackageRollbackFailed = 9,
SwapInStarted = 10,
SwapInSucceeded = 11,
SwapInFailed = 12,
DataUpgradeStarted = 13,
DataUpgradeSucceeded = 14,
DataUpgradeFailed = 15,
DataUpgradeValidationStarted = 16,
DataUpgradeValidationSucceeded = 17,
DataUpgradeValidationFailed = 18,
CustomerValidationStarted = 19,
CustomerValidationSucceeded = 20,
CustomerValidationFailed = 21,
SwapOutStarted = 22,
SwapOutSucceeded = 23,
SwapOutFailed = 24,
EnvironmentDeallocationStarted = 25,
EnvironmentDeallocationSucceeded = 26,
EnvironmentDeallocationFailed = 27,
EnvironmentDeleteStarted = 28,
EnvironmentDeleteSucceeded = 29,
EnvironmentDeleteFailed = 30,
PointInTimeRestoreStarted = 31,
PointInTimeRestoreSucceeded = 32,
PointInTimeRestoreFailed = 33,
DataUpgradePackageRollbackStarted = 34,
DataUpgradePackageRollbackSucceeded = 35,
DataUpgradePackageRollbackFailed = 36
}
public enum MilestoneStatus { Unfinished = 0, UnfinishedLate = 1, Finished = 2, FinishedEarly = 3 }
public enum StatusMetadataType { None = 0, Dependency = 1, RuleEngine = 2 }
public enum StatusLinkType { Internal = 0, Dialog = 1, External = 2 }
public enum ConnectorSettingStatus { NotStarted = 0, InProgress = 1, Completed = 2 }
public enum LcsEnvironmentServicingActionCategory { Servicing = 1, DataManagement = 2, SecretRotation = 3, EnvironmentUpgrade = 4, RollbackPackage = 5, OnPremServicing = 6, SqlCommand = 7 }
public enum EnvironmentActionCategoryType { None = 0, PureCategory = 1, ActionableCategory = 2 }
public struct LcsRegion { public const string None = "None"; public const string UnitedStates = "UnitedStates"; public const string Europe = "Europe"; public const string Canada = "Canada"; public const string UnitedKingdom = "UnitedKingdom"; public const string China = "China"; public const string USGov = "USGov"; public const string Germany = "Germany"; public const string France = "France"; }
public enum MethodologyPinScopes { None = 0, GettingStarted = 1, Task = 2, Phase = 4 }
public enum PinInputType { External = 0, Parameters = 1 }
public enum PinOutputType { Display = 0, External = 1 }
public enum PinDisplayType { Tile = 0, TextOnly = 1, Link = 2, Custom = 3, Card = 4 }
public enum ChecklistFileType { Model = 1, Configuration = 4, DeploymentFile = 5, ModelStore = 6, ModelDB = 7, BusinessDB = 8, DeployablePackage = 10, BrandingLogo = 14 }
public enum ProjectSystemRoleType { None = 0, ProjectOwner = 1, Contributor = 2, ReadOnly = 3, ProjectContributor = 5, OperationsAdmin = 6, EnvironmentAdmin = 7, InternalSreUser = 8, InternalSupportUser = 9, InternalDriUser = 10, InternalSreTier1User = 11 }
public enum ProjectUserStatus { Pending = 0, Declined = 1, Accepted = 2 }
public enum OrgUserRoleType { None = 0, SystemAdmin = 1, Admin = 2, Contributor = 3, Prospect = 4, DelegatedAdmin = 5, SupportAdmin = 6, OpsAdmin = 7, DriAdmin = 8, SreTier1Admin = 9 }
public enum OrganizationType { None = 0, Partner = 1, Customer = 2, Prospect = 3, Employee = 4 }
public enum IssueStorage { None = 0, Legacy = 1, Tfs = 2 }
public enum ProductVersionId { None = 0, AX2012Rtm = 4, AX2012R2 = 5, AX2012FP = 6, AX2012R3 = 7, Nav2009 = 8, Nav2009R2 = 9, Nav2013 = 10, Nav2013R2 = 11, AX7 = 12, Crm2015 = 13, Nav2015 = 14, Nav2016 = 15, Dynamics365ForRetail = 18, Dynamics365Talent = 19, Crm2016 = 20, Nav2018 = 21, NavSaaS = 22, CRM = 23 }
public enum Industry { None = 0, Other = 1, Retail = 2, Manufacturing = 3, Distribution = 4, Services = 5, PublicSector = 6 }
public enum Product { None = 0, AX2012 = 2, Nav = 3, AX7 = 4, Crm = 5, Dynamics365ForRetail = 6, Dynamics365Talent = 7 }
public enum TileEnum { None = 0, AllProjects = 4, NewProject = 5, ProjectRequests = 6, UserRequests = 7, Users = 8, Messages = 9, Announcements = 10, ProjectTeam = 13, IssuesTracking = 15, Documents = 17, ProjectMessages = 19, CodeAnalysisTool = 20, DiagnosticFramework = 21, ProjectRole = 23, Entitlement = 24, BusinessProcessModeler = 26, License = 27, UsageProfiler = 28, IssueSearch = 29, UpgradeService = 30, ProjectSettings = 31, ProjectHealth = 34, KeyWins = 37, Checkpoints = 38, RisksAndMitigations = 39, ApplicationModules = 40, CompletedCheckpoints = 41, MediumRisk = 42, LowRisk = 43, AllRisk = 44, Metering = 45, SupportIncident = 46, IsComService = 47, MSSupportIncident = 48, LcsBlog = 50, DeploymentPortal = 51, UpdateDownload = 52, ConfigurationManager = 53, InfraSizing = 54, DumpAnalysis = 55, OperationalInsight = 56, AX7CodeUpgrade = 57, TranslationService = 58, CRMInfraSizing = 59, ConfigurationAndDataManager = 60, AX7InfraSizing = 61, TotalEconomicImpactEstimatorForAX7 = 62, SubscriptionEstimator = 63, Dynamics365Talent = 64, AlertService = 65, MigrationAdminTemplate = 66, PerfbotAnalysis = 69, ImpactAnalysisReport = 71 }
public enum ProjectType { None = 0, Learn = 6, PreSales = 7, Implementation = 8, Partner = 9, OnPremImplementation = 10, ServiceFabricImplementation = 11 }
public enum ProjectSettingsTab { None = 0, ProjectOverview = 1, ProjectOwnership = 2, LegacySharePoint = 3, VSOnline = 4, AzureConnectors = 5, OneDriveSettings = 6, OnPremiseConnector = 7, UpdateSettings = 8, UpdateSettingsForRing3 = 9, OnPremTFS = 10 }
public enum SolutionRequestStatus { None = 0, Pending = 1, Approved = 2, Rejected = 3, InReview = 4 }
public enum SolutionProvisioningState { None = 0, Blocked = 1, ProvisioningPending = 2, ProvisioningReady = 3, ProvisionComplete = 4 }
public enum DeploymentConnectorCategory { None = 0, Default = 1, Microsoft = 2 }
public enum SolutionAccess { None = 0, Reference = 1 }
public enum SolutionLicenseType { None = 0, LicenseLink = 1, LicenseDocument = 2, PrivacyPolicy = 3 }
public enum CustomizationGroupCategory { Default = 0, Summary = 1, CustomerSignoff = 2, DseSignoff = 3, CommonDataService = 4 }
public enum AX7PartnerOption { None = 0, PartnerProject = 1, CustomerPresalesExperience = 2, Implementation = 3, OnPremImplementation = 4 }
public enum DeploymentStatus { Undefined = 0, Succeeded = 1, Failed = 2, Canceled = 3, StateTransitionIncomplete = 4 }
public enum DeploymentState { Undefined = 0, Active = 1, Paused = 2, Finished = 3, Starting = 4, Stopping = 5, Stopped = 6, Deleting = 7, Deallocating = 8, Deallocated = 9, Deleted = 10, Servicing = 11, Recovering = 12, SafeMode = 13, Restoring = 14, Swapping = 15, SwapRollingBack = 16, RotatingSecrets = 17, CommitingSwap = 18, Swapped = 19, ServicingRollback = 20, DatabaseRestoreRollback = 21, Migrating = 22, RestartingServices = 23, DatabaseNeedsUpgrade = 24, ValidatingDataUpgrade = 25, ExecutingSQLCommand = 26, ExecutingGenevaAction = 27, MigratingToSF = 28, MigratedToSF = 29, CDSConfiguring = 30, ScalingOut = 31, InfrastructureMaintenance = 32, PreparingForMigration = 33, PreppedForMigration = 34, ConfiguringFirewallRules = 35 }
public enum LocalAgentEnums_DeploymentStatus { None = 0, Warning = 1, Failed = 2, StateTransitionIncomplete = 3 }
public enum LocalAgentEnums_DeploymentState { Undefined = 0, Active = 1, Deploying = 2, Deleting = 3, Inactive = 5, Preparing = 6, Downloading = 7, Prepared = 8 }
public enum DeploymentAction { Undefined = 0, Deploy = 1, Start = 2, Stop = 3, Update = 4, ScaleOut = 5, Configure = 6, Delete = 7, Restart = 8, Service = 9, PreService = 10, PostService = 11, MoveVMToMaintenancePool = 12, MoveVMToLivePool = 13, MarkStepComplete = 14, Rollback = 15, Abort = 16, Failover = 17, DeployDisasterRecovery = 18, RestoreDatabaseFromSourceToTargetServer = 19, Failback = 20, CleanupFailoverResources = 21, Resume = 22, SwapStaging = 23, SwapRollback = 24, SwapCommit = 25, ExecutePowershellScript = 26, RotateSecrets = 27, CreateJITAccount = 28, UpdateNetworkSecurityGroup = 29, ImportDatabase = 30, DataUpgrade = 31, RestartService = 32, ValidateDataUpgrade = 33, ExecuteSQLCommand = 34, Redeploy = 35, DataMovement = 36, ExecuteGenevaAction = 37, DataUpgradeRollback = 38 }
public enum EnvironmentGroup { Primary = 0, DisasterRecovery = 1, Staging = 2 }
public enum SaasEnvironmentType { none = 0, prod = 1, sandbox = 2, devtest = 3 }
public enum RefinedEnvironmentType { Unknown = 0, Production = 1, Sandbox = 2, Demo = 3, DevTestDev = 4, DevTestBuild = 5, DevTestDevAndBuild = 6, OnPremSandbox = 7, OnPremProduction = 8, HighAvailability = 9 }
public enum LcsEnvironmentServiceRequestStatus { None = 0, Requested = 1, RequestDenied = 2, RequestCancelled = 3, RequestAccepted = 4, InProgress = 5, Failed = 6, Succeeded = 7, SignedOff = 8, Aborted = 9, SignedOffWithIssues = 10, Preparation = 11, PostFailureCleanup = 12, PostCompletionCleanup = 13, PostCancellationCleanup = 14, Reserved = 15, RollbackSignedOff = 16, RollbackSignedOffWithIssues = 17, RollbackSucceeded = 18, RollbackFailed = 19, ValidationFailed = 20, ValidationSuccessful = 21, ReadyForValidation = 22 }
public enum ServicingWorkItemRequestType { None = 0, NewDeployment = 1, UpdateDeployment = 2, DbBackup = 3, DbUpgrade = 4, DbRefresh = 5, ProdPointInTimeDBRestore = 6, OtherType = 7, SandboxPointInTimeDBRestore = 8, EnvironmentUpgrade = 9, DbRefreshSandboxToProd = 10 }
public enum Types { None = 0, VMPasswords = 1, SQLPasswords = 2, StorageAccountKey = 4, Certificates = 8, AADCertificate = 16, SSLCertificates = 32 }
public enum DatabaseType { AX = 0, MR = 1 }
public enum StepStatus { NotStarted = 1, InProgress = 2, Completed = 3, ManuallyCompleted = 4, Failed = 5, EnvironmentIssue = 6, MarkingStepAsComplete = 7, RerunningStep = 8, NotApplicable = 9 }
public enum StepDetailsType { Servicing = 0, Rollback = 1, DataMovement = 2 }
public enum LcsEnvironmentActionStatus { NotStarted = 0, InProgress = 1, Completed = 2, Failed = 3, Unknown = 4, SignedOff = 5, Aborted = 6, SignedOffWithIssues = 7, InProgressManually = 8, CompletedManually = 9, PreparationFailed = 10, PreparationSucceeded = 11, PreparingEnvironment = 12, RollbackInProgress = 13, RollbackCompleted = 14, RollbackFailed = 15, RollbackSignedOff = 16, RollbackAborted = 17, RollbackSignedOffWithIssues = 18, ValidationFailed = 19, ValidationSuccessful = 20, ReadyForValidation = 22, PostCompletionCleanup = 23, PostFailureCleanup = 24, PostCancellationCleanup = 25 }
public enum DeploymentEnvironmentType { MicrosoftManagedIaas = 0, CustomerManagedIaas = 1, CustomerOnPrem = 2, MicrosoftManagedServiceFabric = 3 }
public enum UpgradeEnvironmentStatus { None = 0, EnvironmentDeploymentStarted = 1, EnvironmentDeploymentSucceeded = 2, EnvironmentDeploymentFailed = 3, DeployablePackageInstallationStarted = 4, DeployablePackageInstallationSucceeded = 5, DeployablePackageInstallationFailed = 6, DeployablePackageRollbackStarted = 7, DeployablePackageRollbackSucceeded = 8, DeployablePackageRollbackFailed = 9, SwapInStarted = 10, SwapInSucceeded = 11, SwapInFailed = 12, DataUpgradeStarted = 13, DataUpgradeSucceeded = 14, DataUpgradeFailed = 15, DataUpgradeValidationStarted = 16, DataUpgradeValidationSucceeded = 17, DataUpgradeValidationFailed = 18, CustomerValidationStarted = 19, CustomerValidationSucceeded = 20, CustomerValidationFailed = 21, SwapOutStarted = 22, SwapOutSucceeded = 23, SwapOutFailed = 24, EnvironmentDeallocationStarted = 25, EnvironmentDeallocationSucceeded = 26, EnvironmentDeallocationFailed = 27, EnvironmentDeleteStarted = 28, EnvironmentDeleteSucceeded = 29, EnvironmentDeleteFailed = 30, PointInTimeRestoreStarted = 31, PointInTimeRestoreSucceeded = 32, PointInTimeRestoreFailed = 33, DataUpgradePackageRollbackStarted = 34, DataUpgradePackageRollbackSucceeded = 35, DataUpgradePackageRollbackFailed = 36 }
public enum JITRequestAccessEnabledState { DisabledNoAccess = 0, Enabled = 1, DisabledAnotherOperationProcessing = 2, DisabledEnvironmentSwapState = 3, DisabledUnknown = 4 }
public enum CrmOptoOlProvisionEnvironmentEleven { ProvisionCrm2011 = 0, RunValidationService = 1, BackUpCrm2011 = 2, ProvisionCrm2013 = 3, BackUpCrm2013 = 4, ProvisionCrm2015 = 5, BackUpCrm2015 = 6 }
public enum CrmOptoOlProvisionEnvironmentThirteen { ProvisionCrm2013 = 0, RunValidationService = 1, BackUpCrm2013 = 2, ProvisionCrm2015 = 3, BackUpCrm2015 = 4 }
public enum CrmOptoOlProvisionEnvironmentFifteen { ProvisionCrm2015 = 0, RunValidationService = 1, BackUpCrm2015 = 2 }
public enum CRMOpToOlValidationRunStatus { Scheduled = 1, Running = 2, Completed = 3, PendingUpload = 4, Errored = 9 }
public enum CrmOptoOlProvisionEnvironment { CRM2011 = 0, CRM2013 = 1, CRM2015 = 2, CRM2016 = 3, CRMV09 = 4 }
public enum CrmDeploymentStatus { Undefined = 0, Succeded = 1, Failed = 2, Canceled = 3 }
public enum CRMOpToOlValidationRunType { None = 0, UpgradeAssessment = 1, CodeConversion = 2, OrgHealthCheck = 3, FinalValidationCheck = 4, OnlineMigration = 5 }
public enum CrmGetIdStatus { CrmVersion = 1, CrmStatus = 2 }
public struct PauseReasons { public const string Other = "Other"; public const string Holidays = "Holidays"; public const string UpComingGoLive = "UpComingGoLive"; public const string PendingUpgrade = "PendingUpgrade"; public const string IssueDuringValidation = "IssueDuringValidation"; public const string PendingValidation = "PendingValidation"; public const string CustomizationConflict = "CustomizationConflict"; public const string IsvReadiness = "IsvReadiness"; }
#endregion
}

30
2LCS/Forms/ChooseNSG.Designer.cs сгенерированный
Просмотреть файл

@ -41,9 +41,10 @@
// OkButton
//
this.OkButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.OkButton.Location = new System.Drawing.Point(398, 399);
this.OkButton.Location = new System.Drawing.Point(486, 479);
this.OkButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.OkButton.Name = "OkButton";
this.OkButton.Size = new System.Drawing.Size(182, 33);
this.OkButton.Size = new System.Drawing.Size(222, 40);
this.OkButton.TabIndex = 1;
this.OkButton.Text = "OK";
this.OkButton.UseVisualStyleBackColor = true;
@ -53,9 +54,10 @@
//
this.cancelButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(586, 399);
this.cancelButton.Location = new System.Drawing.Point(716, 479);
this.cancelButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(172, 33);
this.cancelButton.Size = new System.Drawing.Size(210, 40);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
@ -76,17 +78,18 @@
this.IpOrCidr,
this.Service,
this.Expiration});
this.nsgRulesDataGridView.Location = new System.Drawing.Point(12, 13);
this.nsgRulesDataGridView.Location = new System.Drawing.Point(15, 16);
this.nsgRulesDataGridView.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.nsgRulesDataGridView.MultiSelect = false;
this.nsgRulesDataGridView.Name = "nsgRulesDataGridView";
this.nsgRulesDataGridView.RowHeadersVisible = false;
this.nsgRulesDataGridView.RowHeadersWidth = 62;
this.nsgRulesDataGridView.RowTemplate.Height = 28;
this.nsgRulesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.nsgRulesDataGridView.Size = new System.Drawing.Size(1194, 380);
this.nsgRulesDataGridView.Size = new System.Drawing.Size(1459, 456);
this.nsgRulesDataGridView.TabIndex = 0;
this.nsgRulesDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.PackagesDataGridView_CellMouseDoubleClick);
this.nsgRulesDataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.PackagesDataGridView_ColumnHeaderMouseClick);
this.nsgRulesDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.NsgRulesDataGridView_CellMouseDoubleClick);
this.nsgRulesDataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.NsgRulesDataGridView_ColumnHeaderMouseClick);
//
// RuleName
//
@ -123,21 +126,22 @@
// ChooseNSG
//
this.AcceptButton = this.OkButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(1218, 444);
this.ClientSize = new System.Drawing.Size(1489, 533);
this.Controls.Add(this.nsgRulesDataGridView);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.OkButton);
this.Icon = global::LCS.Properties.Resources.favicon_blue;
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(780, 400);
this.MinimumSize = new System.Drawing.Size(948, 467);
this.Name = "ChooseNSG";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose machine to connect to";
this.Load += new System.EventHandler(this.ChoosePackage_Load);
this.Text = "Choose firewall rule to delete";
this.Load += new System.EventHandler(this.ChooseNSG_Load);
((System.ComponentModel.ISupportInitialize)(this.nsgRulesDataGridView)).EndInit();
this.ResumeLayout(false);

Просмотреть файл

@ -37,7 +37,7 @@ namespace LCS.Forms
Close();
}
private void ChoosePackage_Load(object sender, EventArgs e)
private void ChooseNSG_Load(object sender, EventArgs e)
{
nsgRulesDataGridView.AutoGenerateColumns = false;
if (!SystemInformation.TerminalServerSession)
@ -66,7 +66,7 @@ namespace LCS.Forms
Close();
}
private void PackagesDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
private void NsgRulesDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (nsgRulesDataGridView.SelectedRows.Count > 0)
{
@ -79,7 +79,7 @@ namespace LCS.Forms
Close();
}
private void PackagesDataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
private void NsgRulesDataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (nsgRulesDataGridView.DataSource == null) return;
_nsgRulesSource.DataSource = _sortAscending ? NetworkSecurityGroup.Rules.OrderBy(nsgRulesDataGridView.Columns[e.ColumnIndex].DataPropertyName).ToList() : NetworkSecurityGroup.Rules.OrderBy(nsgRulesDataGridView.Columns[e.ColumnIndex].DataPropertyName).Reverse().ToList();

22
2LCS/Forms/ChoosePackage.Designer.cs сгенерированный
Просмотреть файл

@ -48,9 +48,10 @@
// OkButton
//
this.OkButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.OkButton.Location = new System.Drawing.Point(398, 399);
this.OkButton.Location = new System.Drawing.Point(486, 479);
this.OkButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.OkButton.Name = "OkButton";
this.OkButton.Size = new System.Drawing.Size(182, 33);
this.OkButton.Size = new System.Drawing.Size(222, 40);
this.OkButton.TabIndex = 1;
this.OkButton.Text = "OK";
this.OkButton.UseVisualStyleBackColor = true;
@ -60,9 +61,10 @@
//
this.cancelButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(586, 399);
this.cancelButton.Location = new System.Drawing.Point(716, 479);
this.cancelButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(172, 33);
this.cancelButton.Size = new System.Drawing.Size(210, 40);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
@ -90,14 +92,15 @@
this.FileAssetDisplayVersion,
this.LcsEnvironmentActionId,
this.LcsEnvironmentId});
this.packagesDataGridView.Location = new System.Drawing.Point(12, 13);
this.packagesDataGridView.Location = new System.Drawing.Point(15, 16);
this.packagesDataGridView.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.packagesDataGridView.MultiSelect = false;
this.packagesDataGridView.Name = "packagesDataGridView";
this.packagesDataGridView.RowHeadersVisible = false;
this.packagesDataGridView.RowHeadersWidth = 62;
this.packagesDataGridView.RowTemplate.Height = 28;
this.packagesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.packagesDataGridView.Size = new System.Drawing.Size(1194, 380);
this.packagesDataGridView.Size = new System.Drawing.Size(1459, 456);
this.packagesDataGridView.TabIndex = 0;
this.packagesDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.PackagesDataGridView_CellMouseDoubleClick);
this.packagesDataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.PackagesDataGridView_ColumnHeaderMouseClick);
@ -203,16 +206,17 @@
//
// ChoosePackage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(1218, 444);
this.ClientSize = new System.Drawing.Size(1489, 533);
this.Controls.Add(this.packagesDataGridView);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.OkButton);
this.Icon = global::LCS.Properties.Resources.favicon_blue;
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(780, 400);
this.MinimumSize = new System.Drawing.Size(948, 467);
this.Name = "ChoosePackage";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;

87
2LCS/Forms/ChooseService.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,87 @@
namespace LCS.Forms
{
partial class ChooseService
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.OkButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// OkButton
//
this.OkButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.OkButton.Location = new System.Drawing.Point(70, 203);
this.OkButton.Margin = new System.Windows.Forms.Padding(4);
this.OkButton.Name = "OkButton";
this.OkButton.Size = new System.Drawing.Size(222, 40);
this.OkButton.TabIndex = 1;
this.OkButton.Text = "OK";
this.OkButton.UseVisualStyleBackColor = true;
this.OkButton.Click += new System.EventHandler(this.OkButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(300, 203);
this.cancelButton.Margin = new System.Windows.Forms.Padding(4);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(210, 40);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.CancelButton_Click);
//
// ChooseService
//
this.AcceptButton = this.OkButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(576, 256);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.OkButton);
this.Icon = global::LCS.Properties.Resources.favicon_blue;
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(600, 320);
this.Name = "ChooseService";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose service(s) to restart";
this.Load += new System.EventHandler(this.ChooseService_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button OkButton;
private System.Windows.Forms.Button cancelButton;
}
}

Просмотреть файл

@ -0,0 +1,73 @@
using LCS.JsonObjects;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Linq.Dynamic;
using System.Windows.Forms;
namespace LCS.Forms
{
public partial class ChooseService : Form
{
public List<ServiceToRestart> AvailableServices;
public List<ServiceToRestart> ServicesToRestart;
private const int CpNocloseButton = 0x200;
public ChooseService()
{
InitializeComponent();
}
internal bool Cancelled { get; private set; }
protected override CreateParams CreateParams
{
get
{
var myCp = base.CreateParams;
myCp.ClassStyle |= CpNocloseButton;
return myCp;
}
}
private void CancelButton_Click(object sender, EventArgs e)
{
Cancelled = true;
Close();
}
private void ChooseService_Load(object sender, EventArgs e)
{
ServicesToRestart = new List<ServiceToRestart>();
CheckBox box;
var i = 1;
foreach(var service in AvailableServices)
{
box = new CheckBox();
box.Tag = i.ToString();
box.Text = service.Label;
box.Name = service.Value;
box.AutoSize = true;
box.Location = new Point(20, i * 20);
Controls.Add(box);
i++;
}
}
private void OkButton_Click(object sender, EventArgs e)
{
foreach (var checkBox in Controls.OfType<CheckBox>().Where(c=>c.Checked))
{
ServicesToRestart.Add(new ServiceToRestart { Label = checkBox.Text, Value = checkBox.Name });
}
if (ServicesToRestart.Count == 0)
{
Cancelled = true;
}
Close();
}
}
}

Просмотреть файл

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

100
2LCS/Forms/MainForm.Designer.cs сгенерированный
Просмотреть файл

@ -128,6 +128,7 @@
this.saasDeleteMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saasAddNsgRule = new System.Windows.Forms.ToolStripMenuItem();
this.saasDeleteNsgRule = new System.Windows.Forms.ToolStripMenuItem();
this.saasRestartService = new System.Windows.Forms.ToolStripMenuItem();
this.saasRdpAndPasswordsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saasShowPasswordsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saasShowPasswordsPowershellMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -208,7 +209,7 @@
this.cheDataGridView.Name = "cheDataGridView";
this.cheDataGridView.ReadOnly = true;
this.cheDataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
this.cheDataGridView.Size = new System.Drawing.Size(1791, 890);
this.cheDataGridView.Size = new System.Drawing.Size(3146, 1534);
this.cheDataGridView.TabIndex = 0;
this.cheDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.CheDataGridView_CellMouseDoubleClick);
this.cheDataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.CheDataGridView_ColumnHeaderMouseClick);
@ -363,20 +364,20 @@
this.cheLcsProjectLinksToolStripMenuItem,
this.cheDeployPackageToolStripMenuItem});
this.cheInstanceContextMenu.Name = "instanceContextMenuStrip";
this.cheInstanceContextMenu.Size = new System.Drawing.Size(311, 328);
this.cheInstanceContextMenu.Size = new System.Drawing.Size(293, 328);
this.cheInstanceContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.InstanceContextMenu_Opening);
//
// cheLogonToAppToolStripMenuItem
//
this.cheLogonToAppToolStripMenuItem.Name = "cheLogonToAppToolStripMenuItem";
this.cheLogonToAppToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheLogonToAppToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheLogonToAppToolStripMenuItem.Text = "Logon to application";
this.cheLogonToAppToolStripMenuItem.Click += new System.EventHandler(this.LogonToApplicationToolStripMenuItem_Click);
//
// cheOpenRDPConnectionToolStripMenuItem
//
this.cheOpenRDPConnectionToolStripMenuItem.Name = "cheOpenRDPConnectionToolStripMenuItem";
this.cheOpenRDPConnectionToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheOpenRDPConnectionToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheOpenRDPConnectionToolStripMenuItem.Text = "Open RDP connection";
this.cheOpenRDPConnectionToolStripMenuItem.Click += new System.EventHandler(this.OpenRDPConnectionToolStripMenuItem_Click);
//
@ -388,8 +389,8 @@
this.cheDeallocateMenuItem,
this.cheDeleteMenuItem});
this.cheManageVirtualMachineToolStripMenuItem.Name = "cheManageVirtualMachineToolStripMenuItem";
this.cheManageVirtualMachineToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheManageVirtualMachineToolStripMenuItem.Text = "Manage virtual machine";
this.cheManageVirtualMachineToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheManageVirtualMachineToolStripMenuItem.Text = "Manage instance";
//
// cheStartInstanceMenuItem
//
@ -428,7 +429,7 @@
this.cheExportRDCManConnectionsMenuItem,
this.cheExportRDMConnectionsToolStripMenuItem});
this.cheRdpAndPasswordsToolStripMenuItem.Name = "cheRdpAndPasswordsToolStripMenuItem";
this.cheRdpAndPasswordsToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheRdpAndPasswordsToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheRdpAndPasswordsToolStripMenuItem.Text = "RDP and passwords";
//
// cheShowPasswordsMenuItem
@ -474,7 +475,7 @@
this.cheApplicationBinaryHotfixesToolStripMenuItem,
this.chePlatformHotfixesToolStripMenuItem});
this.cheAvailableHotfixesToolStripMenuItem.Name = "cheAvailableHotfixesToolStripMenuItem";
this.cheAvailableHotfixesToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheAvailableHotfixesToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheAvailableHotfixesToolStripMenuItem.Text = "Available hotfixes";
//
// cheMetadataHotfixesToolStripMenuItem
@ -501,7 +502,7 @@
// cheDetailedBuildInfoToolStripMenuItem
//
this.cheDetailedBuildInfoToolStripMenuItem.Name = "cheDetailedBuildInfoToolStripMenuItem";
this.cheDetailedBuildInfoToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheDetailedBuildInfoToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheDetailedBuildInfoToolStripMenuItem.Text = "Detailed build info";
this.cheDetailedBuildInfoToolStripMenuItem.Click += new System.EventHandler(this.DetailedBuildInfoToolStripMenuItem_Click);
//
@ -517,7 +518,7 @@
this.cheLaunchDynamicsRetailStorefrontToolStripMenuItem,
this.cheRetailServerURLToolStripMenuItem});
this.cheLcsInstanceLinksToolStripMenuItem.Name = "cheLcsInstanceLinksToolStripMenuItem";
this.cheLcsInstanceLinksToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheLcsInstanceLinksToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheLcsInstanceLinksToolStripMenuItem.Text = "LCS instance links";
//
// cheInstanceDetailsToolStripMenuItem
@ -589,7 +590,7 @@
this.cheProjectSettingsToolStripMenuItem,
this.cheProjectUsersToolStripMenuItem});
this.cheLcsProjectLinksToolStripMenuItem.Name = "cheLcsProjectLinksToolStripMenuItem";
this.cheLcsProjectLinksToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheLcsProjectLinksToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheLcsProjectLinksToolStripMenuItem.Text = "LCS project links";
//
// cheServiceRequestsToolStripMenuItem
@ -658,7 +659,7 @@
// cheDeployPackageToolStripMenuItem
//
this.cheDeployPackageToolStripMenuItem.Name = "cheDeployPackageToolStripMenuItem";
this.cheDeployPackageToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.cheDeployPackageToolStripMenuItem.Size = new System.Drawing.Size(292, 36);
this.cheDeployPackageToolStripMenuItem.Text = "Deploy package";
this.cheDeployPackageToolStripMenuItem.Click += new System.EventHandler(this.DeployPackageToolStripMenuItem_Click);
//
@ -678,14 +679,14 @@
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.mainMenuStrip.Name = "mainMenuStrip";
this.mainMenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
this.mainMenuStrip.Size = new System.Drawing.Size(1807, 42);
this.mainMenuStrip.Size = new System.Drawing.Size(3162, 74);
this.mainMenuStrip.TabIndex = 0;
this.mainMenuStrip.Text = "menuStrip1";
//
// loginToLcsMenuItem
//
this.loginToLcsMenuItem.Name = "loginToLcsMenuItem";
this.loginToLcsMenuItem.Size = new System.Drawing.Size(146, 36);
this.loginToLcsMenuItem.Size = new System.Drawing.Size(146, 34);
this.loginToLcsMenuItem.Text = "&Login to LCS";
this.loginToLcsMenuItem.Click += new System.EventHandler(this.LoginToLCSMenuItem_Click);
//
@ -693,7 +694,7 @@
//
this.changeProjectMenuItem.Enabled = false;
this.changeProjectMenuItem.Name = "changeProjectMenuItem";
this.changeProjectMenuItem.Size = new System.Drawing.Size(247, 36);
this.changeProjectMenuItem.Size = new System.Drawing.Size(247, 34);
this.changeProjectMenuItem.Text = "&Change project context";
this.changeProjectMenuItem.Click += new System.EventHandler(this.ChangeProjectMenuItem_Click);
//
@ -701,14 +702,14 @@
//
this.refreshMenuItem.Enabled = false;
this.refreshMenuItem.Name = "refreshMenuItem";
this.refreshMenuItem.Size = new System.Drawing.Size(294, 36);
this.refreshMenuItem.Size = new System.Drawing.Size(294, 34);
this.refreshMenuItem.Text = "&Refresh instances for project";
this.refreshMenuItem.Click += new System.EventHandler(this.RefreshMenuItem_Click);
//
// customLinksToolStripMenuItem
//
this.customLinksToolStripMenuItem.Name = "customLinksToolStripMenuItem";
this.customLinksToolStripMenuItem.Size = new System.Drawing.Size(213, 36);
this.customLinksToolStripMenuItem.Size = new System.Drawing.Size(213, 34);
this.customLinksToolStripMenuItem.Text = "Define c&ustom links";
this.customLinksToolStripMenuItem.Click += new System.EventHandler(this.CustomLinksToolStripMenuItem_Click);
//
@ -720,7 +721,7 @@
this.exportUpdateScheduleForAllProjectsToolStripMenuItem});
this.exportToolStripMenuItem.Enabled = false;
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(90, 36);
this.exportToolStripMenuItem.Size = new System.Drawing.Size(90, 34);
this.exportToolStripMenuItem.Text = "Export";
//
// exportProjectDataToolStripMenuItem1
@ -743,23 +744,23 @@
// allInstancesExportToolStripMenuItem
//
this.allInstancesExportToolStripMenuItem.Name = "allInstancesExportToolStripMenuItem";
this.allInstancesExportToolStripMenuItem.Size = new System.Drawing.Size(315, 40);
this.allInstancesExportToolStripMenuItem.Size = new System.Drawing.Size(254, 40);
this.allInstancesExportToolStripMenuItem.Text = "All instances";
this.allInstancesExportToolStripMenuItem.Click += new System.EventHandler(this.allInstancesExportToolStripMenuItem_Click);
this.allInstancesExportToolStripMenuItem.Click += new System.EventHandler(this.AllInstancesExportToolStripMenuItem_Click);
//
// cloudHostedInstancesExportToolStripMenuItem
//
this.cloudHostedInstancesExportToolStripMenuItem.Name = "cloudHostedInstancesExportToolStripMenuItem";
this.cloudHostedInstancesExportToolStripMenuItem.Size = new System.Drawing.Size(315, 40);
this.cloudHostedInstancesExportToolStripMenuItem.Size = new System.Drawing.Size(254, 40);
this.cloudHostedInstancesExportToolStripMenuItem.Text = "Cloud hosted";
this.cloudHostedInstancesExportToolStripMenuItem.Click += new System.EventHandler(this.cloudHostedInstancesExportToolStripMenuItem_Click);
this.cloudHostedInstancesExportToolStripMenuItem.Click += new System.EventHandler(this.CloudHostedInstancesExportToolStripMenuItem_Click);
//
// mSHostedInstancesExportToolStripMenuItem
//
this.mSHostedInstancesExportToolStripMenuItem.Name = "mSHostedInstancesExportToolStripMenuItem";
this.mSHostedInstancesExportToolStripMenuItem.Size = new System.Drawing.Size(315, 40);
this.mSHostedInstancesExportToolStripMenuItem.Size = new System.Drawing.Size(254, 40);
this.mSHostedInstancesExportToolStripMenuItem.Text = "MS hosted";
this.mSHostedInstancesExportToolStripMenuItem.Click += new System.EventHandler(this.mSHostedInstancesExportToolStripMenuItem_Click);
this.mSHostedInstancesExportToolStripMenuItem.Click += new System.EventHandler(this.MSHostedInstancesExportToolStripMenuItem_Click);
//
// exportUpdateScheduleForAllProjectsToolStripMenuItem
//
@ -772,21 +773,21 @@
//
this.logoutToolStripMenuItem.Enabled = false;
this.logoutToolStripMenuItem.Name = "logoutToolStripMenuItem";
this.logoutToolStripMenuItem.Size = new System.Drawing.Size(96, 36);
this.logoutToolStripMenuItem.Size = new System.Drawing.Size(96, 34);
this.logoutToolStripMenuItem.Text = "Logout";
this.logoutToolStripMenuItem.Click += new System.EventHandler(this.LogoutToolStripMenuItem_Click);
//
// cookieToolStripMenuItem
//
this.cookieToolStripMenuItem.Name = "cookieToolStripMenuItem";
this.cookieToolStripMenuItem.Size = new System.Drawing.Size(94, 36);
this.cookieToolStripMenuItem.Size = new System.Drawing.Size(94, 34);
this.cookieToolStripMenuItem.Text = "Cookie";
this.cookieToolStripMenuItem.Click += new System.EventHandler(this.CookieToolStripMenuItem_Click);
//
// parametersToolStripMenuItem
//
this.parametersToolStripMenuItem.Name = "parametersToolStripMenuItem";
this.parametersToolStripMenuItem.Size = new System.Drawing.Size(134, 36);
this.parametersToolStripMenuItem.Size = new System.Drawing.Size(134, 34);
this.parametersToolStripMenuItem.Text = "Parameters";
this.parametersToolStripMenuItem.Click += new System.EventHandler(this.ParametersToolStripMenuItem_Click);
//
@ -795,11 +796,11 @@
this.tabControl.Controls.Add(this.cheTabPage);
this.tabControl.Controls.Add(this.saasTabPage);
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl.Location = new System.Drawing.Point(0, 42);
this.tabControl.Location = new System.Drawing.Point(0, 130);
this.tabControl.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.Size = new System.Drawing.Size(1807, 933);
this.tabControl.Size = new System.Drawing.Size(3162, 1577);
this.tabControl.TabIndex = 1;
//
// cheTabPage
@ -809,7 +810,7 @@
this.cheTabPage.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cheTabPage.Name = "cheTabPage";
this.cheTabPage.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cheTabPage.Size = new System.Drawing.Size(1799, 896);
this.cheTabPage.Size = new System.Drawing.Size(3154, 1540);
this.cheTabPage.TabIndex = 0;
this.cheTabPage.Text = "Cloud-hosted instances";
this.cheTabPage.UseVisualStyleBackColor = true;
@ -821,7 +822,7 @@
this.saasTabPage.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.saasTabPage.Name = "saasTabPage";
this.saasTabPage.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.saasTabPage.Size = new System.Drawing.Size(1799, 898);
this.saasTabPage.Size = new System.Drawing.Size(3154, 1540);
this.saasTabPage.TabIndex = 1;
this.saasTabPage.Text = "MS-hosted environments";
this.saasTabPage.UseVisualStyleBackColor = true;
@ -858,7 +859,7 @@
this.saasDataGridView.Name = "saasDataGridView";
this.saasDataGridView.ReadOnly = true;
this.saasDataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
this.saasDataGridView.Size = new System.Drawing.Size(1791, 892);
this.saasDataGridView.Size = new System.Drawing.Size(3146, 1534);
this.saasDataGridView.TabIndex = 1;
this.saasDataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.SaasDataGridView_ColumnHeaderMouseClick);
this.saasDataGridView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DataGridView_MouseDown);
@ -1013,20 +1014,20 @@
this.saasLcsProjectLinksToolStripMenuItem,
this.saasDeployPackageToolStripMenuItem});
this.saasInstanceContextMenu.Name = "instanceContextMenuStrip";
this.saasInstanceContextMenu.Size = new System.Drawing.Size(311, 402);
this.saasInstanceContextMenu.Size = new System.Drawing.Size(296, 364);
this.saasInstanceContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.InstanceContextMenu_Opening);
//
// saasLogonToApplicationToolStripMenuItem
//
this.saasLogonToApplicationToolStripMenuItem.Name = "saasLogonToApplicationToolStripMenuItem";
this.saasLogonToApplicationToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasLogonToApplicationToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasLogonToApplicationToolStripMenuItem.Text = "Logon to application";
this.saasLogonToApplicationToolStripMenuItem.Click += new System.EventHandler(this.LogonToApplicationToolStripMenuItem_Click);
//
// saasOpenRdpConnectionToolStripMenuItem
//
this.saasOpenRdpConnectionToolStripMenuItem.Name = "saasOpenRdpConnectionToolStripMenuItem";
this.saasOpenRdpConnectionToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasOpenRdpConnectionToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasOpenRdpConnectionToolStripMenuItem.Text = "Open RDP Connection";
this.saasOpenRdpConnectionToolStripMenuItem.Click += new System.EventHandler(this.SaasOpenRdpConnectionToolStripMenuItem_Click);
//
@ -1038,10 +1039,11 @@
this.saasDeallocateMenuItem,
this.saasDeleteMenuItem,
this.saasAddNsgRule,
this.saasDeleteNsgRule});
this.saasDeleteNsgRule,
this.saasRestartService});
this.saasManageVirtualMachineToolStripMenuItem.Name = "saasManageVirtualMachineToolStripMenuItem";
this.saasManageVirtualMachineToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasManageVirtualMachineToolStripMenuItem.Text = "Manage virtual machine";
this.saasManageVirtualMachineToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasManageVirtualMachineToolStripMenuItem.Text = "Manage instance";
//
// saasStartInstanceMenuItem
//
@ -1085,6 +1087,13 @@
this.saasDeleteNsgRule.Text = "Delete firewall exception";
this.saasDeleteNsgRule.Click += new System.EventHandler(this.SaasDeleteNsgRule_Click);
//
// saasRestartService
//
this.saasRestartService.Name = "saasRestartService";
this.saasRestartService.Size = new System.Drawing.Size(359, 40);
this.saasRestartService.Text = "Restart service";
this.saasRestartService.Click += new System.EventHandler(this.SaasRestartService_Click);
//
// saasRdpAndPasswordsToolStripMenuItem
//
this.saasRdpAndPasswordsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1094,7 +1103,7 @@
this.saasExportRDCManConnectionsToolStripMenuItem,
this.saasExportRDMConnectionsToolStripMenuItem});
this.saasRdpAndPasswordsToolStripMenuItem.Name = "saasRdpAndPasswordsToolStripMenuItem";
this.saasRdpAndPasswordsToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasRdpAndPasswordsToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasRdpAndPasswordsToolStripMenuItem.Text = "RDP and passwords";
//
// saasShowPasswordsMenuItem
@ -1141,7 +1150,7 @@
this.saasPlatformBinaryHotfixesToolStripMenuItem,
this.saasCriticalMetadataHotfixesToolStripMenuItem});
this.saasAvailableHotfixesToolStripMenuItem.Name = "saasAvailableHotfixesToolStripMenuItem";
this.saasAvailableHotfixesToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasAvailableHotfixesToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasAvailableHotfixesToolStripMenuItem.Text = "Available hotfixes";
//
// saasApplicationMetadataHotfixesToolStripMenuItem
@ -1175,14 +1184,14 @@
// saasUpcomingUpdatesToolStripMenuItem
//
this.saasUpcomingUpdatesToolStripMenuItem.Name = "saasUpcomingUpdatesToolStripMenuItem";
this.saasUpcomingUpdatesToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasUpcomingUpdatesToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasUpcomingUpdatesToolStripMenuItem.Text = "Upcoming updates";
this.saasUpcomingUpdatesToolStripMenuItem.Click += new System.EventHandler(this.SaasUpcomingUpdatesToolStripMenuItem_Click);
//
// saasDetailedBuildInfoToolStripMenuItem
//
this.saasDetailedBuildInfoToolStripMenuItem.Name = "saasDetailedBuildInfoToolStripMenuItem";
this.saasDetailedBuildInfoToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasDetailedBuildInfoToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasDetailedBuildInfoToolStripMenuItem.Text = "Detailed build info";
this.saasDetailedBuildInfoToolStripMenuItem.Click += new System.EventHandler(this.DetailedBuildInfoToolStripMenuItem_Click);
//
@ -1198,7 +1207,7 @@
this.saasLaunchDynamicsRetailStorefrontToolStripMenuItem,
this.saasRetailServerURLToolStripMenuItem});
this.saasLcsInstanceLinksToolStripMenuItem1.Name = "saasLcsInstanceLinksToolStripMenuItem1";
this.saasLcsInstanceLinksToolStripMenuItem1.Size = new System.Drawing.Size(310, 36);
this.saasLcsInstanceLinksToolStripMenuItem1.Size = new System.Drawing.Size(295, 36);
this.saasLcsInstanceLinksToolStripMenuItem1.Text = "LCS instance links";
//
// saasInstanceDetailsToolStripMenuItem
@ -1270,7 +1279,7 @@
this.saasProjectSettingsToolStripMenuItem,
this.saasProjectUsersToolStripMenuItem});
this.saasLcsProjectLinksToolStripMenuItem.Name = "saasLcsProjectLinksToolStripMenuItem";
this.saasLcsProjectLinksToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasLcsProjectLinksToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasLcsProjectLinksToolStripMenuItem.Text = "LCS project links";
//
// saasServiceRequestsToolStripMenuItem
@ -1339,7 +1348,7 @@
// saasDeployPackageToolStripMenuItem
//
this.saasDeployPackageToolStripMenuItem.Name = "saasDeployPackageToolStripMenuItem";
this.saasDeployPackageToolStripMenuItem.Size = new System.Drawing.Size(310, 36);
this.saasDeployPackageToolStripMenuItem.Size = new System.Drawing.Size(295, 36);
this.saasDeployPackageToolStripMenuItem.Text = "Deploy package";
this.saasDeployPackageToolStripMenuItem.Click += new System.EventHandler(this.DeployPackageToolStripMenuItem_Click);
//
@ -1545,6 +1554,7 @@
private System.Windows.Forms.ToolStripMenuItem allInstancesExportToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cloudHostedInstancesExportToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mSHostedInstancesExportToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saasRestartService;
}
}

Просмотреть файл

@ -16,6 +16,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Xceed.Document.NET;
using Xceed.Words.NET;
using static LCS.NativeMethods;
namespace LCS.Forms
{
@ -40,6 +41,15 @@ namespace LCS.Forms
private List<CustomLink> Links;
private List<LcsProject> Projects;
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
public MainForm()
{
InitializeComponent();
@ -101,21 +111,21 @@ namespace LCS.Forms
throw new ArgumentNullException("window");
if (window.Handle == IntPtr.Zero)
throw new InvalidOperationException("Window does not yet exist");
if (!NativeMethods.IsWindowVisible(window.Handle))
if (!IsWindowVisible(window.Handle))
return false;
IntPtr hWnd = window.Handle;
HashSet<IntPtr> visited = new HashSet<IntPtr> { hWnd };
RECT thisRect = new RECT();
NativeMethods.GetWindowRect(hWnd, out thisRect);
GetWindowRect(hWnd, out thisRect);
while ((hWnd = NativeMethods.GetWindow(hWnd, GW_HWNDPREV)) != IntPtr.Zero && !visited.Contains(hWnd))
while ((hWnd = GetWindow(hWnd, GW_HWNDPREV)) != IntPtr.Zero && !visited.Contains(hWnd))
{
visited.Add(hWnd);
RECT testRect, intersection;
testRect = intersection = new RECT();
if (NativeMethods.IsWindowVisible(hWnd) && NativeMethods.GetWindowRect(hWnd, out testRect) && NativeMethods.IntersectRect(out intersection, ref thisRect, ref testRect))
if (IsWindowVisible(hWnd) && GetWindowRect(hWnd, out testRect) && IntersectRect(out intersection, ref thisRect, ref testRect))
{
return true;
}
@ -133,12 +143,12 @@ namespace LCS.Forms
CookieContainer cookies = null;
var datasize = 8192 * 16;
var cookieData = new StringBuilder(datasize);
if (!NativeMethods.InternetGetCookieEx(_lcsUrl, null, cookieData, ref datasize, InternetCookieHttponly, IntPtr.Zero))
if (!InternetGetCookieEx(_lcsUrl, null, cookieData, ref datasize, InternetCookieHttponly, IntPtr.Zero))
{
if (datasize < 0)
return null;
cookieData = new StringBuilder(datasize);
if (!NativeMethods.InternetGetCookieEx(
if (!InternetGetCookieEx(
_lcsUrl,
null, cookieData,
ref datasize,
@ -165,42 +175,40 @@ namespace LCS.Forms
private void ChangeProjectMenuItem_Click(object sender, EventArgs e)
{
using (var form = new ChooseProject())
using var form = new ChooseProject();
form.HttpClientHelper = _httpClientHelper;
form.ShowDialog();
if (!form.Cancelled && (form.LcsProject != null))
{
form.HttpClientHelper = _httpClientHelper;
form.ShowDialog();
if (!form.Cancelled && (form.LcsProject != null))
Projects = form.Projects;
if (_selectedProject == null || form.LcsProject.Id != _selectedProject.Id)
{
Projects = form.Projects;
if (_selectedProject == null || form.LcsProject.Id != _selectedProject.Id)
{
_cheInstancesSource.DataSource = null;
_cheInstancesSource.ResetBindings(false);
_saasInstancesSource.DataSource = null;
_saasInstancesSource.ResetBindings(false);
_selectedProject = form.LcsProject;
_cheInstancesSource.DataSource = null;
_cheInstancesSource.ResetBindings(false);
_saasInstancesSource.DataSource = null;
_saasInstancesSource.ResetBindings(false);
_selectedProject = form.LcsProject;
if (!Instances.Exists(x => x.LcsProjectId == _selectedProject.Id))
if (!Instances.Exists(x => x.LcsProjectId == _selectedProject.Id))
{
var instance = new ProjectInstance()
{
var instance = new ProjectInstance()
{
LcsProjectId = _selectedProject.Id,
};
Instances.Add(instance);
}
LcsProjectId = _selectedProject.Id,
};
Instances.Add(instance);
}
refreshMenuItem.Enabled = true;
exportToolStripMenuItem.Enabled = true;
_httpClientHelper.ChangeLcsProjectId(_selectedProject.Id.ToString());
_httpClientHelper.LcsProjectTypeId = _selectedProject.ProjectTypeId;
_cookies = _httpClientHelper.CookieContainer;
GetLcsProjectFromCookie();
SetLcsProjectText();
CreateProjectLinksMenuItems();
EnableDisableMenuItems();
RefreshChe(Properties.Settings.Default.autorefresh);
RefreshSaas(Properties.Settings.Default.autorefresh);
}
refreshMenuItem.Enabled = true;
exportToolStripMenuItem.Enabled = true;
_httpClientHelper.ChangeLcsProjectId(_selectedProject.Id.ToString());
_httpClientHelper.LcsProjectTypeId = _selectedProject.ProjectTypeId;
_cookies = _httpClientHelper.CookieContainer;
GetLcsProjectFromCookie();
SetLcsProjectText();
CreateProjectLinksMenuItems();
EnableDisableMenuItems();
RefreshChe(Properties.Settings.Default.autorefresh);
RefreshSaas(Properties.Settings.Default.autorefresh);
}
}
@ -311,8 +319,8 @@ namespace LCS.Forms
};
if (savefile.ShowDialog() == DialogResult.OK)
{
using (StreamWriter sw = new StreamWriter(savefile.FileName))
sw.Write(sb);
using StreamWriter sw = new StreamWriter(savefile.FileName);
sw.Write(sb);
}
Cursor = Cursors.Default;
}
@ -361,8 +369,8 @@ namespace LCS.Forms
};
if (savefile.ShowDialog() == DialogResult.OK)
{
using (StreamWriter sw = new StreamWriter(savefile.FileName))
sw.Write(sb);
using StreamWriter sw = new StreamWriter(savefile.FileName);
sw.Write(sb);
}
Cursor = Cursors.Default;
}
@ -401,18 +409,16 @@ namespace LCS.Forms
private void CookieToolStripMenuItem_Click(object sender, EventArgs e)
{
using (var form = new CookieEdit())
{
form.ShowDialog();
if (form.Cancelled || string.IsNullOrEmpty(form.Cookie)) return;
if (form.Cookie == Properties.Settings.Default.cookie) return;
Properties.Settings.Default.cookie = form.Cookie;
Properties.Settings.Default.projects = "";
Properties.Settings.Default.instances = "";
Properties.Settings.Default.Save();
MessageBox.Show("Application will now restart", "Message", MessageBoxButtons.OK);
Application.Restart();
}
using var form = new CookieEdit();
form.ShowDialog();
if (form.Cancelled || string.IsNullOrEmpty(form.Cookie)) return;
if (form.Cookie == Properties.Settings.Default.cookie) return;
Properties.Settings.Default.cookie = form.Cookie;
Properties.Settings.Default.projects = "";
Properties.Settings.Default.instances = "";
Properties.Settings.Default.Save();
MessageBox.Show("Application will now restart", "Message", MessageBoxButtons.OK);
Application.Restart();
}
private void CreateCustomLinksMenuItems()
@ -524,13 +530,11 @@ namespace LCS.Forms
private void CustomLinksToolStripMenuItem_Click(object sender, EventArgs e)
{
using (var form = new CustomLinks())
{
form.ShowDialog();
if (form.Cancelled) return;
RemoveCustomLinksMenuItems();
CreateCustomLinksMenuItems();
}
using var form = new CustomLinks();
form.ShowDialog();
if (form.Cancelled) return;
RemoveCustomLinksMenuItems();
CreateCustomLinksMenuItems();
}
private void DataGridView_MouseDown(object sender, MouseEventArgs e)
@ -596,22 +600,20 @@ namespace LCS.Forms
if (package == null)
{
var packages = _httpClientHelper.GetPagedDeployablePackageList(instance);
using (var form = new ChoosePackage())
using var form = new ChoosePackage();
form.Packages = packages;
form.ShowDialog();
if (!form.Cancelled && (form.DeployablePackage != null))
{
form.Packages = packages;
form.ShowDialog();
if (!form.Cancelled && (form.DeployablePackage != null))
{
package = form.DeployablePackage;
log.AppendLine($"Chosen package name: {package.Name}");
log.AppendLine($"Chosen package description: {package.Description}");
log.AppendLine($"Chosen package platform version: {package.PlatformVersion}");
log.AppendLine();
}
else
{
break;
}
package = form.DeployablePackage;
log.AppendLine($"Chosen package name: {package.Name}");
log.AppendLine($"Chosen package description: {package.Description}");
log.AppendLine($"Chosen package platform version: {package.PlatformVersion}");
log.AppendLine();
}
else
{
break;
}
}
if (package != null)
@ -646,12 +648,10 @@ namespace LCS.Forms
MessageBox.Show($"Request to get build info details. Please try again later.");
continue;
}
using (var form = new BuildInfoDetailsForm())
{
form.BuildInfo = buildInfo;
form.Text = $"Instance: {instance.InstanceId}, Build version: {buildInfo.BuildVersion}, Platform build: {buildInfo.InstalledPlatformBuild}";
form.ShowDialog();
}
using var form = new BuildInfoDetailsForm();
form.BuildInfo = buildInfo;
form.Text = $"Instance: {instance.InstanceId}, Build version: {buildInfo.BuildVersion}, Platform build: {buildInfo.InstalledPlatformBuild}";
form.ShowDialog();
}
Cursor = Cursors.Default;
}
@ -688,12 +688,6 @@ namespace LCS.Forms
}
Cursor = Cursors.Default;
}
enum LCSEnvironments
{
ALL = 0,
CHE = 1,
SAAS = 2
}
private void ExportListOfInstancesForAllProjects(LCSEnvironments _LCSEnvironments)
{
@ -719,59 +713,59 @@ namespace LCS.Forms
RefreshChe();
RefreshSaas();
if (_LCSEnvironments == LCSEnvironments.ALL || _LCSEnvironments == LCSEnvironments.SAAS)
if (_saasInstancesList != null && _saasInstancesList.Count > 0)
{
foreach (var _instance in _saasInstancesList)
if (_LCSEnvironments == LCSEnvironments.ALL || _LCSEnvironments == LCSEnvironments.SAAS)
if (_saasInstancesList != null && _saasInstancesList.Count > 0)
{
var exportedInstance = new ExportedInstance
foreach (var _instance in _saasInstancesList)
{
ProjectId = _project.Id.ToString(),
ProjectName = _project.Name,
Organization = _project.OrganizationName,
InstanceName = _instance.DisplayName,
EnvironmentId = _instance.EnvironmentId,
CurrentApplicationBuildVersion = _instance.CurrentApplicationBuildVersion,
CurrentApplicationReleaseName = _instance.CurrentApplicationReleaseName,
CurrentPlatformReleaseName = _instance.CurrentPlatformReleaseName,
CurrentPlatformVersion = _instance.CurrentPlatformVersion,
BuildInfo = _instance.BuildInfo,
TopologyType = _instance.TopologyType,
TopologyVersion = _instance.TopologyVersion,
TopologyName = _instance.TopologyName,
DeploymentStatus = _instance.DeploymentStatus,
HostingType = "MS hosted"
};
exportedInstances.Add(exportedInstance);
var exportedInstance = new ExportedInstance
{
ProjectId = _project.Id.ToString(),
ProjectName = _project.Name,
Organization = _project.OrganizationName,
InstanceName = _instance.DisplayName,
EnvironmentId = _instance.EnvironmentId,
CurrentApplicationBuildVersion = _instance.CurrentApplicationBuildVersion,
CurrentApplicationReleaseName = _instance.CurrentApplicationReleaseName,
CurrentPlatformReleaseName = _instance.CurrentPlatformReleaseName,
CurrentPlatformVersion = _instance.CurrentPlatformVersion,
BuildInfo = _instance.BuildInfo,
TopologyType = _instance.TopologyType,
TopologyVersion = _instance.TopologyVersion,
TopologyName = _instance.TopologyName,
DeploymentStatus = _instance.DeploymentStatus,
HostingType = "MS hosted"
};
exportedInstances.Add(exportedInstance);
}
}
}
if (_LCSEnvironments == LCSEnvironments.ALL || _LCSEnvironments == LCSEnvironments.CHE)
if (_cheInstancesList != null && _cheInstancesList.Count > 0)
{
foreach (var _instance in _cheInstancesList)
if (_cheInstancesList != null && _cheInstancesList.Count > 0)
{
var exportedInstance = new ExportedInstance
foreach (var _instance in _cheInstancesList)
{
ProjectId = _project.Id.ToString(),
ProjectName = _project.Name,
Organization = _project.OrganizationName,
InstanceName = _instance.DisplayName,
EnvironmentId = _instance.EnvironmentId,
CurrentApplicationBuildVersion = _instance.CurrentApplicationBuildVersion,
CurrentApplicationReleaseName = _instance.CurrentApplicationReleaseName,
CurrentPlatformReleaseName = _instance.CurrentPlatformReleaseName,
CurrentPlatformVersion = _instance.CurrentPlatformVersion,
BuildInfo = _instance.BuildInfo,
TopologyType = _instance.TopologyType,
TopologyVersion = _instance.TopologyVersion,
TopologyName = _instance.TopologyName,
DeploymentStatus = _instance.DeploymentStatus,
HostingType = "Cloud hosted"
};
exportedInstances.Add(exportedInstance);
var exportedInstance = new ExportedInstance
{
ProjectId = _project.Id.ToString(),
ProjectName = _project.Name,
Organization = _project.OrganizationName,
InstanceName = _instance.DisplayName,
EnvironmentId = _instance.EnvironmentId,
CurrentApplicationBuildVersion = _instance.CurrentApplicationBuildVersion,
CurrentApplicationReleaseName = _instance.CurrentApplicationReleaseName,
CurrentPlatformReleaseName = _instance.CurrentPlatformReleaseName,
CurrentPlatformVersion = _instance.CurrentPlatformVersion,
BuildInfo = _instance.BuildInfo,
TopologyType = _instance.TopologyType,
TopologyVersion = _instance.TopologyVersion,
TopologyName = _instance.TopologyName,
DeploymentStatus = _instance.DeploymentStatus,
HostingType = "Cloud hosted"
};
exportedInstances.Add(exportedInstance);
}
}
}
}
SaveFileDialog savefile = new SaveFileDialog
{
@ -783,11 +777,9 @@ namespace LCS.Forms
{
try
{
using (StreamWriter sw = new StreamWriter(savefile.FileName, false, Encoding.Unicode))
{
var csv = new CsvWriter(sw);
csv.WriteRecords(exportedInstances);
}
using StreamWriter sw = new StreamWriter(savefile.FileName, false, Encoding.Unicode);
var csv = new CsvWriter(sw);
csv.WriteRecords(exportedInstances);
}
catch (Exception ex)
{
@ -847,7 +839,7 @@ namespace LCS.Forms
tenantNameHeader.SpacingAfter(10d);
var tenantIdHeader = document.InsertParagraph("Tenant ID: " + plans.TenantId).FontSize(14d);
tenantIdHeader.SpacingAfter(10d);
if(plans.Plans.Count > 0)
if (plans.Plans.Count > 0)
{
//plans table
var plansColumnWidths = new float[] { 200f, 200f, 60f, 40f, 40f };
@ -974,11 +966,10 @@ namespace LCS.Forms
instanceHeader.InsertTableAfterSelf(instanceDetailsTable);
var instance = _httpClientHelper.GetHostedDeploymentDetail(saasInstance.EnvironmentId);
var rdpList = _httpClientHelper.GetRdpConnectionDetails(instance);
var rdpList = _httpClientHelper.GetRdpConnectionDetails(saasInstance);
if (rdpList.Count > 0)
{
var vms = document.InsertParagraph("RDP connections: " + instance.DisplayName.ToUpper()).FontSize(14d);
var vms = document.InsertParagraph("RDP connections: " + saasInstance.DisplayName.ToUpper()).FontSize(14d);
vms.SpacingBefore(20d);
vms.SpacingAfter(10d);
foreach (var rdpEntry in rdpList)
@ -1002,9 +993,9 @@ namespace LCS.Forms
document.InsertParagraph();
}
}
foreach (var vm in instance.Instances)
foreach (var vm in saasInstance.Instances)
{
var CredentialsDict = _httpClientHelper.GetCredentials(instance.EnvironmentId, vm.ItemName);
var CredentialsDict = _httpClientHelper.GetCredentials(saasInstance.EnvironmentId, vm.ItemName);
if (CredentialsDict.Count > 0)
{
var credentialsParagraph = document.InsertParagraph("Credentials for " + vm.MachineName).FontSize(14d);
@ -1243,12 +1234,10 @@ namespace LCS.Forms
MessageBox.Show($"There are no {label} available for {((CloudHostedInstance)row.DataBoundItem).DisplayName} instance.");
continue;
}
using (var form = new AvailableKBs())
{
form.Hotfixes = kbs;
form.Text = $"{kbs.Count} {label} available for {((CloudHostedInstance)row.DataBoundItem).DisplayName} instance.";
form.ShowDialog();
}
using var form = new AvailableKBs();
form.Hotfixes = kbs;
form.Text = $"{kbs.Count} {label} available for {((CloudHostedInstance)row.DataBoundItem).DisplayName} instance.";
form.ShowDialog();
}
Cursor = Cursors.Default;
}
@ -1287,30 +1276,28 @@ namespace LCS.Forms
private void LoginToLCSMenuItem_Click(object sender, EventArgs e)
{
WebBrowserHelper.FixBrowserVersion();
using (var form = new Login())
using var form = new Login();
form.ShowDialog();
if (form.Cancelled) return;
_cookies = GetUriCookieContainer();
if (_cookies == null) return;
_httpClientHelper = new HttpClientHelper(_cookies)
{
form.ShowDialog();
if (form.Cancelled) return;
_cookies = GetUriCookieContainer();
if (_cookies == null) return;
_httpClientHelper = new HttpClientHelper(_cookies)
{
LcsUrl = _lcsUrl,
LcsUpdateUrl = _lcsUpdateUrl,
LcsDiagUrl = _lcsDiagUrl
};
if (_selectedProject != null)
{
_httpClientHelper.ChangeLcsProjectId(_selectedProject.Id.ToString());
_httpClientHelper.LcsProjectTypeId = _selectedProject.ProjectTypeId;
}
changeProjectMenuItem.Enabled = true;
cheInstanceContextMenu.Enabled = true;
saasInstanceContextMenu.Enabled = true;
logoutToolStripMenuItem.Enabled = true;
loginToLcsMenuItem.Enabled = false;
ChangeProjectMenuItem_Click(null, null);
LcsUrl = _lcsUrl,
LcsUpdateUrl = _lcsUpdateUrl,
LcsDiagUrl = _lcsDiagUrl
};
if (_selectedProject != null)
{
_httpClientHelper.ChangeLcsProjectId(_selectedProject.Id.ToString());
_httpClientHelper.LcsProjectTypeId = _selectedProject.ProjectTypeId;
}
changeProjectMenuItem.Enabled = true;
cheInstanceContextMenu.Enabled = true;
saasInstanceContextMenu.Enabled = true;
logoutToolStripMenuItem.Enabled = true;
loginToLcsMenuItem.Enabled = false;
ChangeProjectMenuItem_Click(null, null);
}
private void LogonToApplicationToolStripMenuItem_Click(object sender, EventArgs e)
@ -1467,10 +1454,8 @@ namespace LCS.Forms
private void ParametersToolStripMenuItem_Click(object sender, EventArgs e)
{
using (var form = new Parameters())
{
form.ShowDialog();
}
using var form = new Parameters();
form.ShowDialog();
}
private string ParseCustomLink(string template, CloudHostedInstance instance)
@ -1602,19 +1587,17 @@ namespace LCS.Forms
private void SaasAddNsgRule_Click(object sender, EventArgs e)
{
using (var form = new AddNsg())
using var form = new AddNsg();
form.ShowDialog();
if (form.Cancelled || (form.Rule == null)) return;
Cursor = Cursors.WaitCursor;
var tasks = new List<Task>();
foreach (DataGridViewRow row in saasDataGridView.SelectedRows)
{
form.ShowDialog();
if (form.Cancelled || (form.Rule == null)) return;
Cursor = Cursors.WaitCursor;
var tasks = new List<Task>();
foreach (DataGridViewRow row in saasDataGridView.SelectedRows)
{
tasks.Add(Task.Run(() => new HttpClientHelper(_cookies) { LcsUrl = _lcsUrl, LcsUpdateUrl = _lcsUpdateUrl, LcsDiagUrl = _lcsDiagUrl, LcsProjectId = _selectedProject.Id.ToString() }.AddNsgRule((CloudHostedInstance)row.DataBoundItem, form.Rule.FirstOrDefault().Key, form.Rule.FirstOrDefault().Value)));
}
Task.WhenAll(tasks).Wait();
Cursor = Cursors.Default;
tasks.Add(Task.Run(() => new HttpClientHelper(_cookies) { LcsUrl = _lcsUrl, LcsUpdateUrl = _lcsUpdateUrl, LcsDiagUrl = _lcsDiagUrl, LcsProjectId = _selectedProject.Id.ToString() }.AddNsgRule((CloudHostedInstance)row.DataBoundItem, form.Rule.FirstOrDefault().Key, form.Rule.FirstOrDefault().Value)));
}
Task.WhenAll(tasks).Wait();
Cursor = Cursors.Default;
}
private void SaasDataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
@ -1637,21 +1620,19 @@ namespace LCS.Forms
if (nsgRule == null)
{
var networkSecurityGroup = _httpClientHelper.GetNetworkSecurityGroup(instance);
using (var form = new ChooseNSG())
using var form = new ChooseNSG();
form.NetworkSecurityGroup = networkSecurityGroup;
form.Text = $"Choose firewall rule to delete";
form.ShowDialog();
if (!form.Cancelled && (form.NSGRule != null))
{
form.NetworkSecurityGroup = networkSecurityGroup;
form.Text = $"Choose firewall rule to delete";
form.ShowDialog();
if (!form.Cancelled && (form.NSGRule != null))
{
nsgRule = form.NSGRule;
log.AppendLine($"Firewall rule to be deleted: {nsgRule.Name}, IP: {nsgRule.IpOrCidr}");
log.AppendLine();
}
else
{
break;
}
nsgRule = form.NSGRule;
log.AppendLine($"Firewall rule to be deleted: {nsgRule.Name}, IP: {nsgRule.IpOrCidr}");
log.AppendLine();
}
else
{
break;
}
}
if (nsgRule != null)
@ -1702,12 +1683,11 @@ namespace LCS.Forms
foreach (var saasInstance in _saasInstancesList)
{
var instance = _httpClientHelper.GetHostedDeploymentDetail(saasInstance.EnvironmentId);
sb.Append(
$@"
<group>
<properties>
<name>{instance.InstanceId}</name>
<name>{saasInstance.InstanceId}</name>
<expanded>True</expanded>
<comment />
<logonCredentials inherit=""FromParent"" />
@ -1719,7 +1699,7 @@ namespace LCS.Forms
<displaySettings inherit=""FromParent"" />
</properties>");
var rdpList = _httpClientHelper.GetRdpConnectionDetails(instance);
var rdpList = _httpClientHelper.GetRdpConnectionDetails(saasInstance);
foreach (var rdpEntry in rdpList)
{
sb.Append(
@ -1758,8 +1738,8 @@ namespace LCS.Forms
};
if (savefile.ShowDialog() == DialogResult.OK)
{
using (StreamWriter sw = new StreamWriter(savefile.FileName))
sw.Write(sb);
using StreamWriter sw = new StreamWriter(savefile.FileName);
sw.Write(sb);
}
Cursor = Cursors.Default;
}
@ -1775,8 +1755,7 @@ namespace LCS.Forms
foreach (var saasInstance in _saasInstancesList)
{
var instance = _httpClientHelper.GetHostedDeploymentDetail(saasInstance.EnvironmentId);
var rdpList = _httpClientHelper.GetRdpConnectionDetails(instance);
var rdpList = _httpClientHelper.GetRdpConnectionDetails(saasInstance);
foreach (var rdpEntry in rdpList)
{
sb.Append($@"
@ -1788,7 +1767,7 @@ namespace LCS.Forms
</RDP>
<ConnectionType>RDPConfigured</ConnectionType>
<ID>{Guid.NewGuid().ToString()}</ID>
<Name>{instance.InstanceId}-{rdpEntry.Machine}</Name>
<Name>{saasInstance.InstanceId}-{rdpEntry.Machine}</Name>
<OpenEmbedded>true</OpenEmbedded>
<Url>{rdpEntry.Address}:{rdpEntry.Port}</Url>
<UserName>{rdpEntry.Domain}\{rdpEntry.Username}</UserName>
@ -1809,8 +1788,8 @@ namespace LCS.Forms
};
if (savefile.ShowDialog() == DialogResult.OK)
{
using (StreamWriter sw = new StreamWriter(savefile.FileName))
sw.Write(sb);
using StreamWriter sw = new StreamWriter(savefile.FileName);
sw.Write(sb);
}
Cursor = Cursors.Default;
}
@ -2120,7 +2099,7 @@ namespace LCS.Forms
_selectedProject = _project;
_httpClientHelper.ChangeLcsProjectId(_project.Id.ToString());
SetLcsProjectText();
List<Datum> calendar = _httpClientHelper.GetUpcomingCalendars();
if (calendar != null || calendar.Count != 0)
{
@ -2143,11 +2122,9 @@ namespace LCS.Forms
{
try
{
using (StreamWriter sw = new StreamWriter(savefile.FileName, false, Encoding.Unicode))
{
var csv = new CsvWriter(sw);
csv.WriteRecords(exportedUpdates);
}
using StreamWriter sw = new StreamWriter(savefile.FileName, false, Encoding.Unicode);
var csv = new CsvWriter(sw);
csv.WriteRecords(exportedUpdates);
}
catch (Exception ex)
{
@ -2161,29 +2138,41 @@ namespace LCS.Forms
RefreshSaas(false);
}
private void allInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
private void AllInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.ALL);
}
private void cloudHostedInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
private void CloudHostedInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.CHE);
}
private void mSHostedInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
private void MSHostedInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.SAAS);
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
private void SaasRestartService_Click(object sender, EventArgs e)
{
public int left;
public int top;
public int right;
public int bottom;
using var form = new ChooseService();
form.AvailableServices = _httpClientHelper.GetServicesToRestart();
form.ShowDialog();
if (form.Cancelled || (form.ServicesToRestart == null)) return;
Cursor = Cursors.WaitCursor;
var tasks = new List<Task>();
foreach (DataGridViewRow row in saasDataGridView.SelectedRows)
{
foreach (var service in form.ServicesToRestart)
{
tasks.Add(Task.Run(() => new HttpClientHelper(_cookies) { LcsUrl = _lcsUrl, LcsUpdateUrl = _lcsUpdateUrl, LcsDiagUrl = _lcsDiagUrl, LcsProjectId = _selectedProject.Id.ToString() }.RestartService((CloudHostedInstance)row.DataBoundItem, service.Value)));
}
}
Task.WhenAll(tasks).Wait();
Cursor = Cursors.Default;
}
}
public static class StringExtension

Просмотреть файл

@ -112,11 +112,21 @@ namespace LCS
internal async Task<bool> AddNsgRule(CloudHostedInstance instance, string ruleName, string ipOrCidr)
{
var parameters = $"lcsEnvironmentId={instance.EnvironmentId}&newRuleName={ruleName}&newRuleIpOrCidr={ipOrCidr}&newRuleService=RDP";
string parameters, url;
if(GetDeploymentEnvironmentTypeInfo(instance.EnvironmentId) == DeploymentEnvironmentType.MicrosoftManagedServiceFabric)
{
parameters = $"lcsEnvironmentId={instance.EnvironmentId}&newRuleName={ruleName}&newRuleIpOrCidr={ipOrCidr}&newRuleService=AzureSQL";
url = $"{LcsUrl}/EnvironmentServicingV2/SFAddNetworkSecurityRule/{LcsProjectId}";
}
else
{
parameters = $"lcsEnvironmentId={instance.EnvironmentId}&newRuleName={ruleName}&newRuleIpOrCidr={ipOrCidr}&newRuleService=RDP";
url = $"{LcsUrl}/Environment/AddNetworkSecurityRule/{LcsProjectId}";
}
using (_stringContent = new StringContent(parameters, Encoding.UTF8, "application/x-www-form-urlencoded"))
{
SetRequestVerificationToken($"{LcsUrl}/V2");
var result = await _httpClient.PostAsync($"{LcsUrl}/Environment/AddNetworkSecurityRule/{LcsProjectId}", _stringContent);
var result = await _httpClient.PostAsync(url, _stringContent);
result.EnsureSuccessStatusCode();
var responseBody = result.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<Response>(responseBody);
@ -162,11 +172,20 @@ namespace LCS
internal async Task<string> DeleteNsgRule(CloudHostedInstance instance, string rule)
{
string url;
if(GetDeploymentEnvironmentTypeInfo(instance.EnvironmentId) == DeploymentEnvironmentType.MicrosoftManagedServiceFabric)
{
url = $"{LcsUrl}/EnvironmentServicingV2/SFDeleteNetworkSecurityRules/{LcsProjectId}";
}
else
{
url = $"{LcsUrl}/Environment/DeleteNetworkSecurityRules/{LcsProjectId}";
}
var parameters = $"lcsEnvironmentId={instance.EnvironmentId}&rulesToDelete%5B%5D={rule}";
using (_stringContent = new StringContent(parameters, Encoding.UTF8, "application/x-www-form-urlencoded"))
{
SetRequestVerificationToken($"{LcsUrl}/V2");
var result = await _httpClient.PostAsync($"{LcsUrl}/Environment/DeleteNetworkSecurityRules/{LcsProjectId}", _stringContent);
var result = await _httpClient.PostAsync(url, _stringContent);
result.EnsureSuccessStatusCode();
var responseBody = result.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<Response>(responseBody);
@ -403,7 +422,17 @@ namespace LCS
{
try
{
var result = _httpClient.GetAsync($"{LcsUrl}/Environment/GetNetworkSecurityGroup/{LcsProjectId}?lcsEnvironmentId={instance.EnvironmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result;
string url;
if(GetDeploymentEnvironmentTypeInfo(instance.EnvironmentId) == DeploymentEnvironmentType.MicrosoftManagedServiceFabric)
{
url = $"{LcsUrl}/EnvironmentServicingV2/SFGetNetworkSecurityGroup/{LcsProjectId}?lcsEnvironmentId={instance.EnvironmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}";
}
else
{
url = $"{LcsUrl}/Environment/GetNetworkSecurityGroup/{LcsProjectId}?lcsEnvironmentId={instance.EnvironmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}";
}
var result = _httpClient.GetAsync(url).Result;
result.EnsureSuccessStatusCode();
var responseBody = result.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<Response>(responseBody);
@ -551,15 +580,15 @@ namespace LCS
: response.Data == null ? null : JsonConvert.DeserializeObject<ProjectData>(response.Data.ToString());
}
internal CloudHostedInstance GetHostedDeploymentDetail(string environmentId)
internal CloudHostedInstance GetHostedDeploymentDetail(HostedDeploymentInstance instance)
{
if(LcsProjectTypeId != ProjectType.ServiceFabricImplementation)
if (instance.DeploymentEnvironmentType != DeploymentEnvironmentType.MicrosoftManagedServiceFabric)
{
return GetHostedDeploymentDetail(_httpClient.GetAsync($"{LcsUrl}/SaaSDeployment/GetDeploymentDetail/{LcsProjectId}/?environmentId={environmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
return GetHostedDeploymentDetail(_httpClient.GetAsync($"{LcsUrl}/SaaSDeployment/GetDeploymentDetail/{LcsProjectId}/?environmentId={instance.EnvironmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
}
else
{
return GetHostedDeploymentDetail(_httpClient.GetAsync($"{LcsUrl}/ServiceFabricDeployment/GetEnvironmentDetails/{LcsProjectId}/?environmentId={environmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
else
{
return GetHostedDeploymentDetail(_httpClient.GetAsync($"{LcsUrl}/ServiceFabricDeployment/GetEnvironmentDetails/{LcsProjectId}/?environmentId={instance.EnvironmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
}
}
@ -578,13 +607,11 @@ namespace LCS
{
if (LcsProjectTypeId != ProjectType.ServiceFabricImplementation)
{
var saasInstances = GetHostedInstances(_httpClient.GetAsync($"{LcsUrl}/SaasDeployment/GetDeploymentSummary/{LcsProjectId}?_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
return saasInstances.OrderBy(x => x.InstanceId).ToList();
return GetHostedInstances(_httpClient.GetAsync($"{LcsUrl}/SaasDeployment/GetDeploymentSummary/{LcsProjectId}?_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
}
else
{
var selfServiceInstances = GetHostedInstances(_httpClient.GetAsync($"{LcsUrl}/ServiceFabricDeployment/GetDeploymentSummary/{LcsProjectId}?_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
return selfServiceInstances.OrderBy(x => x.InstanceId).ToList();
return GetHostedInstances(_httpClient.GetAsync($"{LcsUrl}/ServiceFabricDeployment/GetDeploymentSummary/{LcsProjectId}?_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result);
}
}
@ -600,17 +627,20 @@ namespace LCS
MissingMemberHandling = MissingMemberHandling.Ignore
};
var list = new List<CloudHostedInstance>();
if (!response.Success) return list.OrderBy(x => x.InstanceId).ToList();
if (!response.Success) return list;
{
if (response.Data == null) return list.OrderBy(x => x.InstanceId).ToList();
var instances = JsonConvert.DeserializeObject<List<SaasInstance>>(response.Data.ToString(), settings);
if (instances == null) return list.OrderBy(x => x.InstanceId).ToList();
if (response.Data == null) return list;
var instances = JsonConvert.DeserializeObject<List<HostedInstance>>(response.Data.ToString(), settings);
if (instances == null) return list;
instances = instances.OrderBy(x => x.DisplayOrder).ToList();//Sort according to display order
foreach (var item in instances)
{
foreach (var instance in item.DeploymentInstances)
{
if (!instance.IsDeployed) continue;
var details = GetHostedDeploymentDetail(instance.EnvironmentId);
var details = GetHostedDeploymentDetail(instance);
if (details != null)
{
list.Add(details);
@ -618,7 +648,7 @@ namespace LCS
}
}
}
return list.OrderBy(x => x.InstanceId).ToList();
return list;
}
internal Response StartSandboxServicing(DeployablePackage package, string platformVersion)
@ -727,6 +757,50 @@ namespace LCS
return offset.TotalMinutes.ToString();
}
internal DeploymentEnvironmentType GetDeploymentEnvironmentTypeInfo(string environmentId)
{
var result = _httpClient.GetAsync($"{LcsUrl}/Environment/GetDeploymentEnvironmentTypeInfo/{LcsProjectId}?environmentId={environmentId}&_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result;
result.EnsureSuccessStatusCode();
var responseBody = result.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<Response>(responseBody);
if (response.Success && response.Data != null)
{
Enum.TryParse(response.Data.ToString(), out DeploymentEnvironmentType envType);
return envType;
}
else
{
return DeploymentEnvironmentType.MicrosoftManagedIaas;
}
}
internal List<ServiceToRestart> GetServicesToRestart()
{
var result = _httpClient.GetAsync($"{LcsUrl}//EnvironmentServicingV2/GetServicesToRestart/{LcsProjectId}?_={DateTimeOffset.Now.ToUnixTimeSeconds()}").Result;
result.EnsureSuccessStatusCode();
var responseBody = result.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<Response>(responseBody);
return !response.Success
? null
: response.Data == null ? null : JsonConvert.DeserializeObject<List<ServiceToRestart>>(response.Data.ToString());
}
internal async Task<ServiceRestartResponseData> RestartService(CloudHostedInstance instance, string serviceTorestart)
{
var parameters = $"lcsEnvironmentId={instance.EnvironmentId}&axServiceName={serviceTorestart}";
using (_stringContent = new StringContent(parameters, Encoding.UTF8, "application/x-www-form-urlencoded"))
{
SetRequestVerificationToken($"{LcsUrl}/V2");
var result = await _httpClient.PostAsync($"{LcsUrl}/EnvironmentServicingV2/RestartService/{LcsProjectId}", _stringContent);
result.EnsureSuccessStatusCode();
var responseBody = result.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<Response>(responseBody);
return !response.Success
? null
: response.Data == null ? null : JsonConvert.DeserializeObject<ServiceRestartResponseData>(response.Data.ToString());
}
}
/// <summary>
/// Dispose
/// </summary>

Просмотреть файл

@ -86,7 +86,7 @@ namespace LCS.JsonObjects
public string InstanceId { get; set; }
public Instance[] Instances { get; set; }
public DeploymentAction InternalDeploymentAction { get; set; }
public int InternalDeploymentStatus { get; set; }
public DeploymentStatus InternalDeploymentStatus { get; set; }
public bool IsARMTopology { get; set; }
public bool IsDiagnosticsEnabledEnvironment { get; set; }
public bool IsEnableMaintenanceMode { get; set; }
@ -102,7 +102,7 @@ namespace LCS.JsonObjects
public bool IsPublishedToD365 { get; set; }
public bool IsStagingDeploymentFailed { get; set; }
public bool IsStagingDeploymentSucceeded { get; set; }
public bool IsUpgradeSelfServeCancelledOrCompleted { get; set; }
public bool IsUpgradeSelfServeCancelledOrCompleted { get; set; }
public bool IsUpgradeSelfServeInProgress { get; set; }
public bool IsUpgradeTimeExpired { get; set; }
public object JITExpireTimeRemaining { get; set; }
@ -318,7 +318,7 @@ namespace LCS.JsonObjects
public string Name { get; set; }
public int OrgId { get; set; }
public string TelemetryId { get; set; }
public int Type { get; set; }
public OrganizationType Type { get; set; }
}
public class PackagesData
@ -444,13 +444,13 @@ namespace LCS.JsonObjects
public bool Success { get; set; }
}
public class SaasDeploymentInstance
public class HostedDeploymentInstance
{
public string AzureSubscriptionId { get; set; }
public object BuildNumber { get; set; }
public object CatalogName { get; set; }
public int ConnectorId { get; set; }
public int DeploymentEnvironmentType { get; set; }
public DeploymentEnvironmentType DeploymentEnvironmentType { get; set; }
public string DeploymentHealthSummary { get; set; }
public int DeploymentSkuId { get; set; }
public string DeploymentSkuType { get; set; }
@ -476,9 +476,9 @@ namespace LCS.JsonObjects
public int TopologyVersion { get; set; }
}
public class SaasInstance
public class HostedInstance
{
public List<SaasDeploymentInstance> DeploymentInstances { get; set; }
public List<HostedDeploymentInstance> DeploymentInstances { get; set; }
public string DeploymentSkuName { get; set; }
public int DisplayOrder { get; set; }
public object TopologyName { get; set; }
@ -561,4 +561,20 @@ namespace LCS.JsonObjects
public string Label { get; set; }
public string Value { get; set; }
}
public class ServiceToRestart
{
public string Label { get; set; }
public string Value { get; set; }
}
public class ServiceRestartResponseData
{
public string ActivityId { get; set; }
public string ErrorCode { get; set; }
public object errorList { get; set; }
public bool isSuccessful { get; set; }
public string Message { get; set; }
public string MessageTitle { get; set; }
}
}

Просмотреть файл

@ -39,7 +39,7 @@ namespace LCS
return 7000;
} // End Function GetEmbVersion
// End Sub FixBrowserVersion
// End Sub FixBrowserVersion
// End Sub FixBrowserVersion