Exemple #1
0
        void CheckInFiles(FileBasedProject project, Guid[] fileIds)
        {
            #region "CheckInFiles"

            project.CheckinFiles(fileIds, "Checkout overridden to auto-translate file", null);

            #endregion
        }
Exemple #2
0
        void UploadAndCheckInFiles(FileBasedProject project, Guid[] fileIds, bool cancelledByUser)
        {
            #region "UploadAndCheckInFilesWithEventHandler"
            project.CheckinFiles(fileIds, "This is where you add a check in comment",
                                 (obj, evt) => Console.WriteLine(evt.StatusMessage + " " + evt.PercentComplete + "% complete"));
            #endregion

            #region "UploadAndCheckInFilesWithNullEventHandler"
            project.CheckinFiles(fileIds, "This is where you add a check in comment",
                                 (obj, evt) => Console.WriteLine(evt.StatusMessage + " " + evt.PercentComplete + "% complete"));
            #endregion

            #region "UploadAndCheckInFilesWithEventHandlerAndCancelation"
            project.CheckinFiles(fileIds, "This is where you add a check in comment",
                                 (obj, evt) =>
            {
                Console.WriteLine(evt.StatusMessage + " " + evt.PercentComplete + "% complete");

                if (cancelledByUser)
                {
                    evt.Cancel = true;
                }
            });
            #endregion

            #region "UploadAndCheckInNewSourceFiles"

            Guid[] sourceFileIds = project.GetSourceLanguageFiles()
                                   .Where(file => file.LocalFileState == LocalFileState.New)
                                   .GetIds();

            project.CheckinFiles(sourceFileIds, "New Source Files",
                                 (obj, evt) =>
            {
                Console.WriteLine(evt.StatusMessage + " " + evt.PercentComplete + "% complete");

                if (cancelledByUser)
                {
                    evt.Cancel = true;
                }
            });
            #endregion

            #region "UploadAndCheckInNewTargetFiles"

            Guid[] targetFileIds = project.GetSourceLanguageFiles()
                                   .Where(file => file.LocalFileState == LocalFileState.New)
                                   .GetIds();

            project.CheckinFiles(targetFileIds, "New Target Files",
                                 (obj, evt) =>
            {
                Console.WriteLine(evt.StatusMessage + " " + evt.PercentComplete + "% complete");

                if (cancelledByUser)
                {
                    evt.Cancel = true;
                }
            });
            #endregion
        }