static CheckinDialog Create( WorkspaceInfo wkInfo, List<string> paths, IAssetStatusCache assetStatusCache, MetaCache metaCache, bool isGluonMode, ProgressControlsForDialogs progressControls, IWorkspaceWindow workspaceWindow, ViewHost viewHost, GuiMessage.IGuiMessage guiMessage, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher) { var instance = CreateInstance<CheckinDialog>(); instance.IsResizable = true; instance.minSize = new Vector2(520, 370); instance.mWkInfo = wkInfo; instance.mPaths = paths; instance.mAssetStatusCache = assetStatusCache; instance.mMetaCache = metaCache; instance.mIsGluonMode = isGluonMode; instance.mProgressControls = progressControls; instance.mWorkspaceWindow = workspaceWindow; instance.mViewHost = viewHost; instance.mGuiMessage = guiMessage; instance.mMergeViewLauncher = mergeViewLauncher; instance.mGluonViewSwitcher = gluonViewSwitcher; instance.mEnterKeyAction = instance.OkButtonAction; instance.mEscapeKeyAction = instance.CancelButtonAction; return instance; }
void BuildComponents() { mEmailField = this.Q <TextField>("email"); mPasswordField = this.Q <TextField>("password"); mEmailNotificationLabel = this.Q <Label>("emailNotification"); mPasswordNotificationLabel = this.Q <Label>("passwordNotification"); mSignInButton = this.Q <Button>("signIn"); mBackButton = this.Q <Button>("back"); mProgressContainer = this.Q <VisualElement>("progressContainer"); mSignInButton.clicked += SignInButton_Clicked; mBackButton.clicked += BackButton_Clicked; mEmailField.FocusOnceLoaded(); mProgressControls = new ProgressControlsForDialogs(new VisualElement[] { mSignInButton }); mProgressContainer.Add((VisualElement)mProgressControls); this.SetControlText <Label>("signInLabel", PlasticLocalization.Name.SignInWithEmail); this.SetControlLabel <TextField>("email", PlasticLocalization.Name.Email); this.SetControlLabel <TextField>("password", PlasticLocalization.Name.Password); this.SetControlText <Button>("signIn", PlasticLocalization.Name.SignIn); this.SetControlText <Button>("back", PlasticLocalization.Name.BackButton); }
static RepositoryExplorerDialog Create( ProgressControlsForDialogs progressControls, string defaultServer) { var instance = CreateInstance <RepositoryExplorerDialog>(); instance.mEscapeKeyAction = instance.CancelButtonAction; instance.mProgressControls = progressControls; instance.BuildComponents(defaultServer); return(instance); }
static SSOCredentialsDialog Create( string server, ProgressControlsForDialogs progressControls) { var instance = CreateInstance <SSOCredentialsDialog>(); instance.mServer = server; instance.mProgressControls = progressControls; instance.mEnterKeyAction = instance.OkButtonWithValidationAction; instance.mEscapeKeyAction = instance.CancelButtonAction; return(instance); }
static CreateRepositoryDialog Create( ProgressControlsForDialogs progressControls, string proposedServer) { var instance = CreateInstance <CreateRepositoryDialog>(); instance.mEnterKeyAction = instance.OkButtonWithValidationAction; instance.mEscapeKeyAction = instance.CancelButtonAction; instance.mProgressControls = progressControls; instance.BuildComponents(proposedServer); return(instance); }
static RepositoryExplorerDialog Create( IPlasticWebRestApi plasticWebRestApi, ProgressControlsForDialogs progressControls, string defaultServer, GuiMessage.IGuiMessage guiMessage) { var instance = CreateInstance <RepositoryExplorerDialog>(); instance.mGuiMessage = guiMessage; instance.mEscapeKeyAction = instance.CancelButtonAction; instance.mProgressControls = progressControls; instance.BuildComponents(defaultServer, plasticWebRestApi); return(instance); }
Panel CreateContentPanel() { StackPanel result = new StackPanel(); ValidationProgressPanel validationPanel = new ValidationProgressPanel(); Panel headerPanel = CreateHeaderPanel(); mWebErrorPanel = new WebErrorPanel(); mUserTextBox = WebControlBuilder.CreateTextBox( GitMasterLocalization.GetString( GitMasterLocalization.Name.LoginPanelUserWatermark)); mUserErrorLabel = WebControlBuilder.CreateErrorLabel(); mPasswordTextBox = WebControlBuilder.CreatePasswordTextBox( GitMasterLocalization.GetString( GitMasterLocalization.Name.LoginPanelPasswordWatermark)); mPasswordErrorLabel = WebControlBuilder.CreateErrorLabel(); mTeamInvitationCodeTextBox = WebControlBuilder.CreateTextBox( GitMasterLocalization.GetString( GitMasterLocalization.Name.LoginPanelTeamInvitationCodeWatermark)); mLoginButton = WebControlBuilder.CreateMainActionButton( GitMasterLocalization.GetString( GitMasterLocalization.Name.LoginButtonUppercase)); mLoginButton.Click += LoginButton_Click; WebEntriesPacker.AddRelatedComponents( result, headerPanel, mWebErrorPanel, mUserTextBox, mUserErrorLabel, mPasswordTextBox, mPasswordErrorLabel, mTeamInvitationCodeTextBox, validationPanel, mLoginButton); mProgressControls = new ProgressControlsForDialogs( validationPanel, new UIElement[] { mLoginButton }); mLoginButton.IsDefault = true; return(result); }
static CheckinMergeNeededDialog Create( RepositorySpec repSpec, BranchInfo currentBranchInfo, ProgressControlsForDialogs progressControls) { var instance = CreateInstance <CheckinMergeNeededDialog>(); instance.mRepSpec = repSpec; instance.mCurrentBranchInfo = currentBranchInfo; instance.mProgressControls = progressControls; instance.mEnterKeyAction = instance.MergeButtonAction; instance.mEscapeKeyAction = instance.CancelButtonAction; return(instance); }
void BuildComponents() { VisualElement root = rootVisualElement; root.Clear(); InitializeLayoutAndStyles(); mRequireMessageLabel = root.Q <Label>("requireMessage"); mMessageLabel = root.Q <Label>("message"); mDownloadCloudEditionButton = root.Q <Button>("downloadCloudEdition"); mDownloadEnterpriseButton = root.Q <Button>("downloadEnterpriseEdition"); mCancelButton = root.Q <Button>("cancel"); mProgressControlsContainer = root.Q <VisualElement>("progressControlsContainer"); root.Q <Label>("title").text = PlasticLocalization.GetString(PlasticLocalization.Name.InstallPlasticSCM); mDownloadCloudEditionButton.text = PlasticLocalization.GetString(PlasticLocalization.Name.DownloadCloudEdition); mDownloadCloudEditionButton.clicked += DownloadCloudEditionButton_Clicked; if (EditionToken.IsCloudEdition()) { mDownloadEnterpriseButton.AddToClassList("display-none"); DownloadPlasticExeWindow window = GetWindow <DownloadPlasticExeWindow>(); } else { mMessageLabel.text = PlasticLocalization.GetString( PlasticLocalization.Name.WhichVersionInstall); mDownloadEnterpriseButton.text = PlasticLocalization.GetString( PlasticLocalization.Name.DownloadEnterpriseEdition); mDownloadEnterpriseButton.clicked += DownloadEnterpriseEditionButton_Clicked; } mCancelButton.text = PlasticLocalization.GetString(PlasticLocalization.Name.CancelButton); mCancelButton.clicked += CancelButton_Clicked; mProgressControls = new ProgressControlsForDialogs( new VisualElement[] { mDownloadCloudEditionButton, mDownloadEnterpriseButton, mCancelButton }); mProgressControlsContainer.Add(mProgressControls); }
static UpdateReportDialog Create( WorkspaceInfo wkInfo, IList reportLines, ProgressControlsForDialogs progressControls) { var instance = CreateInstance <UpdateReportDialog>(); instance.mWkInfo = wkInfo; instance.mReportLines = reportLines; instance.mProgressControls = progressControls; instance.mEscapeKeyAction = instance.CloseButtonAction; instance.BuildComponenets(wkInfo); instance.SetReportLines(reportLines); return(instance); }
static RenameBranchDialog Create( RepositorySpec repSpec, BranchInfo branchInfo, ProgressControlsForDialogs progressControls) { var instance = CreateInstance <RenameBranchDialog>(); instance.mRepSpec = repSpec; instance.mBranchInfo = branchInfo; instance.mBranchName = BranchRenameUserInfo.GetShortBranchName(branchInfo.BranchName); instance.mTitle = PlasticLocalization.GetString( PlasticLocalization.Name.RenameBranchTitle); instance.mProgressControls = progressControls; return(instance); }
static void RunInstaller( string installerPath, ProgressControlsForDialogs progressControls, INotify notify) { progressControls.ProgressData.ProgressPercent = -1; ((IProgressControls)progressControls).ShowProgress( PlasticLocalization.GetString(PlasticLocalization.Name.InstallingProgress)); notify.InstallationStarted(); MacOSConfigWorkaround configWorkaround = new MacOSConfigWorkaround(); IThreadWaiter waiter = ThreadWaiter.GetWaiter(); waiter.Execute( /*threadOperationDelegate*/ delegate { configWorkaround.CreateClientConfigIfNeeded(); Process installerProcess = LaunchInstaller.ForPlatform(installerPath); if (installerProcess != null) { installerProcess.WaitForExit(); } configWorkaround.DeleteClientConfigIfNeeded(); }, /*afterOperationDelegate*/ delegate { notify.InstallationFinished(); ((IProgressControls)progressControls).HideProgress(); if (waiter.Exception != null) { ((IProgressControls)progressControls).ShowError( waiter.Exception.Message); return; } File.Delete(installerPath); }); }
static GetRestorePathDialog Create( ProgressControlsForDialogs progressControls, string wkPath, string restorePath, string explanation, bool isDirectory, bool showSkipButton) { var instance = CreateInstance <GetRestorePathDialog>(); instance.mWkPath = wkPath; instance.mRestorePath = restorePath; instance.mExplanation = explanation; instance.mIsDirectory = isDirectory; instance.mShowSkipButton = showSkipButton; instance.mEnterKeyAction = instance.OkButtonWithValidationAction; instance.mEscapeKeyAction = instance.CancelButtonAction; instance.mProgressControls = progressControls; return(instance); }
internal CreateOrganizationPanel( CloudEditionWelcomeWindow parentWindow, VisualElement parentPanel, IPlasticWebRestApi restApi) { mParentWindow = parentWindow; mParentPanel = parentPanel; mRestApi = restApi; InitializeLayoutAndStyles(); BuildComponents(); var progressControls = new ProgressControlsForDialogs(new VisualElement[] { mCreateButton, mBackButton }); mProgressControls = progressControls; mGettingDatacentersProgressContainer.Add(progressControls); GetDatacenters.Run( mRestApi, mProgressControls, this); }
static MigrationDialog Create( string unityAccessToken, string projectPath, string organizationName, RepId repId, long changesetId, long branchId, Action afterWorkspaceMigratedAction, ProgressControlsForDialogs progressControls) { var instance = CreateInstance <MigrationDialog>(); instance.IsResizable = false; instance.mUnityAccessToken = unityAccessToken; instance.mProjectPath = projectPath; instance.mOrganizationName = organizationName; instance.mRepId = repId; instance.mChangesetId = changesetId; instance.mBranchId = branchId; instance.mAfterWorkspaceMigratedAction = afterWorkspaceMigratedAction; instance.mProgressControls = progressControls; instance.mEscapeKeyAction = instance.CloseButtonAction; return(instance); }
void BuildComponents() { mUserNameTextField = this.Q <TextField>("emailField"); mUserNameTextField.label = PlasticLocalization.GetString( PlasticLocalization.Name.Email); mUserNameTextField.RegisterValueChangedCallback( UserNameTextBox_TextChanged); mUserNotificationLabel = this.Q <Label>("emailNotification"); mPasswordTextField = this.Q <TextField>("passwordField"); mPasswordTextField.label = PlasticLocalization.GetString( PlasticLocalization.Name.Password); mPasswordTextField.RegisterValueChangedCallback( PasswordTextBox_TextChanged); mConfirmPasswordTextField = this.Q <TextField>("confirmPasswordField"); mConfirmPasswordTextField.label = PlasticLocalization.GetString( PlasticLocalization.Name.ConfirmPassword); mConfirmPasswordTextField.RegisterValueChangedCallback( ConfirmPasswordTextBox_TextChanged); mPasswordNotificationLabel = this.Q <Label>("passwordNotificationLabel"); mConfirmPasswordNotificationLabel = this.Q <Label>("confirmPasswordNotificationLabel"); mSignUpButton = this.Q <Button>("signUp"); mSignUpButton.text = PlasticLocalization.GetString(PlasticLocalization.Name.SignUp); mSignUpButton.clicked += SignUpButton_Clicked; string[] signUpText = PlasticLocalization.GetString( PlasticLocalization.Name.SignUpAgreeToShort).Split('{', '}'); Label signUpAgreePt1 = this.Q <Label>("signUpAgreePt1"); signUpAgreePt1.text = signUpText[0]; mTermsOfServiceButton = this.Q <Button>("termsOfService"); mTermsOfServiceButton.text = PlasticLocalization.GetString(PlasticLocalization.Name.TermsOfService); mTermsOfServiceButton.clicked += TermsOfServiceButton_Clicked; Label signUpAgreePt2 = this.Q <Label>("signUpAgreePt2"); signUpAgreePt2.text = signUpText[2]; mPrivacyPolicyButton = this.Q <Button>("privacyPolicy"); mPrivacyPolicyButton.text = PlasticLocalization.GetString(PlasticLocalization.Name.PrivacyPolicy); mPrivacyPolicyButton.clicked += PrivacyPolicyButton_Clicked; this.SetControlImage("unityIcon", Images.Name.ButtonSsoSignInUnity); mSignUpWithUnityButton = this.Q <Button>("unityIDButton"); mSignUpWithUnityButton.text = PlasticLocalization.GetString(PlasticLocalization.Name.SignInWithUnityID); mSignUpWithUnityButton.clicked += SignUpWithUnityButton_clicked; this.SetControlText <Label>("privacyStatementText", PlasticLocalization.Name.PrivacyStatementText, PlasticLocalization.GetString(PlasticLocalization.Name.PrivacyStatement)); mPrivacyPolicyStatementButton = this.Q <Button>("privacyStatement"); mPrivacyPolicyStatementButton.text = PlasticLocalization.GetString( PlasticLocalization.Name.PrivacyStatement); mPrivacyPolicyStatementButton.clicked += PrivacyPolicyStatementButton_Clicked; // TODO: add controls to disable and disable control logic mProgressControls = new ProgressControlsForDialogs(new VisualElement[] { mSignUpButton, mSignUpWithUnityButton }); mProgressContainer = this.Q <VisualElement>("progressContainer"); mProgressContainer.Add((VisualElement)mProgressControls); }
internal static void Run( Edition plasticEdition, string installerDestinationPath, ProgressControlsForDialogs progressControls, INotify notify) { ((IProgressControls)progressControls).ShowProgress( PlasticLocalization.GetString(PlasticLocalization.Name.DownloadingProgress)); NewVersionResponse plasticVersion = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(); waiter.Execute( /*threadOperationDelegate*/ delegate { plasticVersion = WebRestApiClient.PlasticScm. GetLastVersion(plasticEdition); if (plasticVersion == null) { return; } string installerUrl = GetInstallerUrl( plasticVersion.Version, plasticEdition == Edition.Cloud); DownloadInstaller( installerUrl, installerDestinationPath, progressControls); if (!PlatformIdentifier.IsMac()) { return; } installerDestinationPath = UnZipMacOsPackage( installerDestinationPath); }, /*afterOperationDelegate*/ delegate { ((IProgressControls)progressControls).HideProgress(); if (waiter.Exception != null) { ((IProgressControls)progressControls).ShowError( waiter.Exception.Message); return; } if (plasticVersion == null) { ((IProgressControls)progressControls).ShowError( PlasticLocalization.GetString(PlasticLocalization.Name.ConnectingError)); return; } if (!File.Exists(installerDestinationPath)) { return; } RunInstaller( installerDestinationPath, progressControls, notify); }); }
static void DownloadInstaller( string url, string destinationPath, ProgressControlsForDialogs progressControls) { int bytesProcessed = 0; Stream remoteStream = null; Stream localStream = null; WebResponse response = null; try { WebRequest request = WebRequest.Create(url); response = request.GetResponse(); long totalBytes = response.ContentLength; if (File.Exists(destinationPath) && new FileInfo(destinationPath).Length == totalBytes) { UnityEngine.Debug.LogFormat( PlasticLocalization.GetString(PlasticLocalization.Name.SkippingDownloadFileExists), destinationPath); return; } remoteStream = response.GetResponseStream(); localStream = File.Create(destinationPath); byte[] buffer = new byte[100 * 1024]; int bytesRead; do { bytesRead = remoteStream.Read(buffer, 0, buffer.Length); localStream.Write(buffer, 0, bytesRead); bytesProcessed += bytesRead; progressControls.ProgressData.ProgressPercent = GetProgressBarPercent.ForTransfer( bytesProcessed, totalBytes) / 100f; } while (bytesRead > 0); } finally { if (response != null) { response.Close(); } if (remoteStream != null) { remoteStream.Close(); } if (localStream != null) { localStream.Close(); } } }