コード例 #1
0
        void OnGet(object sender, System.EventArgs e)
        {
            var requests = new List <GetRequest>();

            for (int row = 0; row < listStore.RowCount; row++)
            {
                var isChecked = listStore.GetValue(row, isSelectedField);
                if (isChecked)
                {
                    var item    = listStore.GetValue(row, itemField);
                    var spec    = new ItemSpec(item.ServerPath, item.ItemType == ItemType.File ? RecursionType.None : RecursionType.Full);
                    var version = (int)versionBox.SelectedItem == 0 ? new ChangesetVersionSpec(Convert.ToInt32(changeSetNumber.Value)) : VersionSpec.Latest;
                    requests.Add(new GetRequest(spec, version));
                    if (forceGet.State == CheckBoxState.On)
                    {
                        workspace.ResetDownloadStatus(item.ItemId);
                    }
                }
            }
            var option = GetOptions.None;

            if (forceGet.State == CheckBoxState.On)
            {
                option |= GetOptions.GetAll;
            }
//            if (overrideGet.State == CheckBoxState.On)
//                option |= GetOptions.Overwrite;
            using (var progress = VersionControlService.GetProgressMonitor("Get", VersionControlOperationType.Pull))
            {
                progress.Log.WriteLine("Start downloading items. GetOption: " + option);
                foreach (var request in requests)
                {
                    progress.Log.WriteLine(request);
                }
                workspace.Get(requests, option, progress);
                progress.ReportSuccess("Finish Downloading.");
            }
            Respond(Command.Ok);
        }