static void OnHelpLinkClicked( HelpPanel helpPanel, HelpLink helpLink) { HelpLink.LinkType linkType; string content; if (!HelpLinkData.TryGet(helpLink.Link, out linkType, out content)) { return; } switch (linkType) { case HelpLink.LinkType.Action: GuiMessage.ShowInformation( "An ACTION link has been clicked:\n" + content); break; case HelpLink.LinkType.Help: helpPanel.Show( content == "sample1" ? Images.Name.GenericBuho1 : Images.Name.GenericBuhoShe1, content == "sample1" ? TestingHelpData.GetSample1() : TestingHelpData.GetSample2()); break; case HelpLink.LinkType.Link: Process.Start(content); break; } }
static void InviteMemberButton_clicked(object obj) { WorkspaceInfo wkInfo = (WorkspaceInfo)obj; CurrentUserAdminCheckResponse response = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(50); waiter.Execute( /*threadOperationDelegate*/ delegate { RepositorySpec repSpec = PlasticGui.Plastic.API.GetRepositorySpec(wkInfo); ServerProfile serverProfile = CmConnection.Get().GetProfileManager().GetProfileForServer(repSpec.Server) ?? ClientConfig.Get().GetDefaultProfile(); string authToken = CmConnection.Get() .BuildWebApiTokenForCloudEditionForProfileAndOrg( serverProfile); response = WebRestApiClient.PlasticScm.IsUserAdmin( ServerOrganizationParser.GetOrganizationFromServer(repSpec.Server), authToken); }, /*afterOperationDelegate*/ delegate { if (waiter.Exception != null) { ExceptionsHandler.LogException( "IsUserAdmin", waiter.Exception); return; } if (response.Error != null) { Debug.LogErrorFormat( "Error checking if the user is the organization admin: {0}", string.Format("Unable to get IsUserAdminResponse: {0} [code {1}]", response.Error.Message, response.Error.ErrorCode)); return; } if (response.IsCurrentUserAdmin) { Application.OpenURL("https://www.plasticscm.com/dashboard/cloud/" + response.OrganizationName + "/users-and-groups"); return; } GuiMessage.ShowInformation( PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersTitle), PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersMessage)); }); }
internal bool CheckOperationInProgress() { if (IsOperationInProgress()) { GuiMessage.ShowInformation( PlasticLocalization.GetString(PlasticLocalization.Name.OperationRunning), PlasticLocalization.GetString(PlasticLocalization.Name.OperationInProgress)); return(true); } return(false); }
static void InviteMemberButton_clicked(object obj) { RepositorySpec repSpec = (RepositorySpec)obj; string organizationName = ServerOrganizationParser. GetOrganizationFromServer(repSpec.Server); CurrentUserAdminCheckResponse response = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(50); waiter.Execute( /*threadOperationDelegate*/ delegate { ServerProfile serverProfile = CmConnection.Get(). GetProfileManager().GetProfileForServer(repSpec.Server); string authToken = serverProfile != null ? CmConnection.Get(). BuildWebApiTokenForCloudEditionForUser( serverProfile.Server, serverProfile.GetSEIDWorkingMode(), serverProfile.SecurityConfig): CmConnection.Get(). BuildWebApiTokenForCloudEditionForUser( repSpec.Server, ClientConfig.Get().GetSEIDWorkingMode(), ClientConfig.Get().GetSecurityConfig()); if (string.IsNullOrEmpty(authToken)) { authToken = CmConnection.Get(). BuildWebApiTokenForCloudEditionDefaultUser(); } if (string.IsNullOrEmpty(authToken)) { return; } response = WebRestApiClient.PlasticScm.IsUserAdmin( organizationName, authToken); }, /*afterOperationDelegate*/ delegate { if (waiter.Exception != null) { ExceptionsHandler.LogException( "IsUserAdmin", waiter.Exception); OpenCloudDashboardUsersGroupsUrl(organizationName); return; } if (response == null) { mLog.DebugFormat( "Error checking if the user is the organization admin for {0}", organizationName); OpenCloudDashboardUsersGroupsUrl(organizationName); return; } if (response.Error != null) { mLog.DebugFormat( "Error checking if the user is the organization admin: {0}", string.Format("Unable to get IsUserAdminResponse: {0} [code {1}]", response.Error.Message, response.Error.ErrorCode)); OpenCloudDashboardUsersGroupsUrl(organizationName); return; } if (response.IsCurrentUserAdmin) { OpenCloudDashboardUsersGroupsUrl(response.OrganizationName); return; } GuiMessage.ShowInformation( PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersTitle), PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersMessage)); }); }