CheckinProgress.cs
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using Codice.Client.BaseCommands;
using Codice.Client.BaseCommands.CheckIn.Progress;
using Codice.Client.Commands.CheckIn;
using Codice.CM.Common;
using PlasticGui;
using PlasticGui.WorkspaceWindow;
namespace Unity.PlasticSCM.Editor.Developer
{
internal class CheckinProgress
{
internal bool CancelPressed;
internal CheckinProgress(WorkspaceInfo wkInfo, WorkspaceWindow workspaceWindow)
{
mWkInfo = wkInfo;
mWorkspaceWindow = workspaceWindow;
mWorkspaceWindow.Progress.CanCancelProgress = true;
mProgressRender = new CheckinUploadProgressRender(
PlasticLocalization.GetString(
PlasticLocalization.Name.CheckinProgressMultiThreadUploading),
PlasticLocalization.GetString(
PlasticLocalization.Name.CheckinProgressMultiThreadNumOfBlocks),
PlasticLocalization.GetString(PlasticLocalization.Name.CheckinProgressUploadingFiles),
PlasticLocalization.GetString(
PlasticLocalization.Name.CheckinProgressUploadingFileData),
PlasticLocalization.GetString(PlasticLocalization.Name.CheckinProgressOf),
PlasticLocalization.GetString(
PlasticLocalization.Name.RemainingProgressMessage));
}
internal void Refresh(
CheckinStatus checkinStatus,
BuildProgressSpeedAndRemainingTime.ProgressData progressData)
{
if (checkinStatus == null)
return;
var progress = mWorkspaceWindow.Progress;
progress.ProgressHeader = checkinStatus.StatusString;
if (checkinStatus.Status >= EnumCheckinStatus.eciConfirming)
progress.CanCancelProgress = false;
if (checkinStatus.Status == EnumCheckinStatus.eciCancelling)
return;
int nowTicks = Environment.TickCount;
progress.TotalProgressMessage = mProgressRender.GetUploadSize(
checkinStatus.TransferredSize, checkinStatus.TotalSize, progressData);
progress.TotalProgressPercent = GetProgressBarPercent.ForTransfer(
checkinStatus.TransferredSize, checkinStatus.TotalSize) / 100f;
progress.ShowCurrentBlock = mProgressRender.
NeedShowCurrentBlockForCheckinStatus(checkinStatus, nowTicks);
string currentFileInfo = mProgressRender.GetCurrentFileInfo(
checkinStatus.CurrentCheckinBlock, mWkInfo.ClientPath);
progress.ProgressHeader = currentFileInfo;
float fileProgressBarValue = GetProgressBarPercent.ForTransfer(
checkinStatus.CurrentCheckinBlock.UploadedSize,
checkinStatus.CurrentCheckinBlock.BlockSize) / 100f;
progress.CurrentBlockProgressPercent = fileProgressBarValue;
progress.CurrentBlockProgressMessage = mProgressRender.GetCurrentBlockUploadSize(
checkinStatus.CurrentCheckinBlock, nowTicks);
}
CheckinUploadProgressRender mProgressRender;
WorkspaceWindow mWorkspaceWindow;
WorkspaceInfo mWkInfo;
}
}