本文整理汇总了C#中IProgress.WriteMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IProgress.WriteMessage方法的具体用法?C# IProgress.WriteMessage怎么用?C# IProgress.WriteMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgress
的用法示例。
在下文中一共展示了IProgress.WriteMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreProjectFile
private void RestoreProjectFile(IProgress progress)
{
WasUpdated = true;
progress.WriteMessage("Rebuild project file '{0}'", ProjectFilename);
FLExProjectUnifier.PutHumptyTogetherAgain(progress, _writeVerbose, _fwdataPathname);
progress.WriteMessage("Finished rebuilding project file '{0}'", ProjectFilename);
}
示例2: FlattenDomain
internal static void FlattenDomain(IProgress progress, bool writeVerbose, SortedDictionary<string, XElement> highLevelData, SortedDictionary<string, XElement> sortedData, string rootDir)
{
var generalBaseDir = Path.Combine(rootDir, SharedConstants.General);
if (!Directory.Exists(generalBaseDir))
return;
// Do in reverse order from nesting.
if (writeVerbose)
{
progress.WriteVerbose("Collecting the general data....");
progress.WriteVerbose("Collecting the language project data....");
}
else
{
progress.WriteMessage("Collecting the general data....");
progress.WriteMessage("Collecting the language project data....");
}
GeneralDomainBoundedContext.FlattenContext(highLevelData, sortedData, generalBaseDir);
if (writeVerbose)
progress.WriteVerbose("Collecting the user-defined list data....");
else
progress.WriteMessage("Collecting the user-defined list data....");
UserDefinedListsBoundedContextService.FlattenContext(highLevelData, sortedData, generalBaseDir);
}
示例3: WriteNestedDomainData
internal static void WriteNestedDomainData(IProgress progress, bool writeVerbose, string rootDir,
IDictionary<string, XElement> wellUsedElements,
IDictionary<string, SortedDictionary<string, byte[]>> classData,
Dictionary<string, string> guidToClassMapping)
{
var generalBaseDir = Path.Combine(rootDir, SharedConstants.General);
if (!Directory.Exists(generalBaseDir))
Directory.CreateDirectory(generalBaseDir);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
if (writeVerbose)
{
progress.WriteVerbose("Writing the general data....");
progress.WriteVerbose("Writing user-defined list data....");
}
else
{
progress.WriteMessage("Writing the general data....");
progress.WriteMessage("Writing user-defined list data....");
}
UserDefinedListsBoundedContextService.NestContext(generalBaseDir, wellUsedElements, classData, guidToClassMapping);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
if (writeVerbose)
progress.WriteVerbose("Writing language project data....");
else
progress.WriteMessage("Writing language project data....");
GeneralDomainBoundedContext.NestContext(generalBaseDir, wellUsedElements, classData, guidToClassMapping);
}
示例4: PrepareForInitialCommit
/// <summary>
/// Allow the client to do something right before the initial local commit.
/// </summary>
public void PrepareForInitialCommit(IProgress progress)
{
if (!_needToNestMainFile)
return; // Only nest it one time.
progress.WriteMessage("Split up project file: {0}", ProjectFilename);
FLExProjectSplitter.PushHumptyOffTheWall(progress, _writeVerbose, _fwdataPathname);
progress.WriteMessage("Finished splitting up project file: {0}", ProjectFilename);
_needToNestMainFile = false;
}
示例5: PutHumptyTogetherAgain
internal static void PutHumptyTogetherAgain(IProgress progress, bool writeVerbose, string mainFilePathname)
{
Guard.AgainstNull(progress, "progress");
FileWriterService.CheckPathname(mainFilePathname);
using (var tempFile = new TempFile())
{
using (var writer = XmlWriter.Create(tempFile.Path, new XmlWriterSettings // NB: These are the FW bundle of settings, not the canonical settings.
{
OmitXmlDeclaration = false,
CheckCharacters = true,
ConformanceLevel = ConformanceLevel.Document,
Encoding = new UTF8Encoding(false),
Indent = true,
IndentChars = (""),
NewLineOnAttributes = false
}))
{
var pathRoot = Path.GetDirectoryName(mainFilePathname);
// NB: The method calls are strictly ordered.
// Don't even think of changing them.
if (writeVerbose)
progress.WriteVerbose("Processing data model version number....");
else
progress.WriteMessage("Processing data model version number....");
UpgradeToVersion(writer, pathRoot);
if (writeVerbose)
progress.WriteVerbose("Processing custom properties....");
else
progress.WriteMessage("Processing custom properties....");
WriteOptionalCustomProperties(writer, pathRoot);
var sortedData = BaseDomainServices.PutHumptyTogetherAgain(progress, writeVerbose, pathRoot);
if (writeVerbose)
progress.WriteVerbose("Writing temporary fwdata file....");
else
progress.WriteMessage("Writing temporary fwdata file....");
foreach (var rtElement in sortedData.Values)
FileWriterService.WriteElement(writer, rtElement);
writer.WriteEndElement();
}
//Thread.Sleep(2000); In case it blows (access denied) up again on Sue's computer.
if (writeVerbose)
progress.WriteVerbose("Copying temporary fwdata file to main file....");
else
progress.WriteMessage("Copying temporary fwdata file to main file....");
File.Copy(tempFile.Path, mainFilePathname, true);
}
SplitFileAgainIfNeeded(progress, writeVerbose, mainFilePathname);
}
示例6: WriteNestedDomainData
internal static void WriteNestedDomainData(IProgress progress, bool writeVerbose, string rootDir,
IDictionary<string, XElement> wellUsedElements,
IDictionary<string, SortedDictionary<string, byte[]>> classData,
Dictionary<string, string> guidToClassMapping)
{
/*
BC 1. ScrRefSystem (no owner)
Books prop owns seq of ScrBookRef (which has all basic props).
No other props.
[Put all in one file in a subfolder of Scripture?]
[[Nesting]]
BC 2. CheckLists prop on LP that holds col of CmPossibilityList items.
Each CmPossibilityList will hold ChkTerm (called ChkItem in model file) objects (derived from CmPossibility)
[Store each list in a file. Put all lists in subfolder.]
[[Nesting]]
BC 3. Scripture (owned by LP)
Leave in:
Resources prop owns col of CmResource. [Leave.]
Extract:
BC 4. ArchivedDrafts prop owns col of ScrDraft. [Each ScrDraft goes in its own file. Archived stuff goes into subfolder of Scripture.]
BC 5. Styles props owns col of StStyle. [Put styles in subfolder and one for each style.]
BC 6. ImportSettings prop owns col of ScrImportSet. [Put sets in subfolder and one for each set.]
BC 7. NoteCategories prop owns one CmPossibilityList [Put list in its own file.]
BC 8. ScriptureBooks prop owns seq of ScrBook. [Put each book in its own folder (named for its cononical order number).]
BC 9. BookAnnotations prop owns seq of ScrBookAnnotations. [Put each ScrBookAnnotations in corresponding subfolder along with optional book.]
*/
var scriptureBaseDir = Path.Combine(rootDir, SharedConstants.Other);
if (!Directory.Exists(scriptureBaseDir))
Directory.CreateDirectory(scriptureBaseDir);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
if (writeVerbose)
progress.WriteVerbose("Writing the other data....");
else
progress.WriteMessage("Writing the other data....");
ScriptureReferenceSystemBoundedContextService.NestContext(scriptureBaseDir, classData, guidToClassMapping);
var langProj = wellUsedElements[SharedConstants.LangProject];
FLExProjectSplitter.CheckForUserCancelRequested(progress);
ScriptureCheckListsBoundedContextService.NestContext(langProj, scriptureBaseDir, classData, guidToClassMapping);
// These are intentionally out of order from the above numbering scheme.
var scrAsBytes = classData[SharedConstants.Scripture].Values.FirstOrDefault();
// // Lela Teli-3 has null.
if (scrAsBytes != null)
{
var scripture = Utilities.CreateFromBytes(scrAsBytes);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
ArchivedDraftsBoundedContextService.NestContext(scripture.Element(SharedConstants.ArchivedDrafts), scriptureBaseDir, classData, guidToClassMapping);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
ScriptureStylesBoundedContextService.NestContext(scripture.Element(SharedConstants.Styles), scriptureBaseDir, classData, guidToClassMapping);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
ImportSettingsBoundedContextService.NestContext(scripture.Element(SharedConstants.ImportSettings), scriptureBaseDir, classData, guidToClassMapping);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
ScriptureBoundedContextService.NestContext(langProj, scripture, scriptureBaseDir, classData, guidToClassMapping);
}
RemoveFolderIfEmpty(scriptureBaseDir);
}
示例7: CompressImage
public static void CompressImage(string path, IProgress progress)
{
progress.WriteStatus("Compressing image: " + Path.GetFileName(path));
var pngoutPath = FileLocator.GetFileDistributedWithApplication("optipng.exe");
var result = CommandLineRunner.Run(pngoutPath, "\"" + path + "\"", Encoding.UTF8, Path.GetDirectoryName(path), 300, progress,
(s) => progress.WriteMessage(s));
}
示例8: FlattenDomain
internal static void FlattenDomain(
IProgress progress, bool writeVerbose,
SortedDictionary<string, XElement> highLevelData,
SortedDictionary<string, XElement> sortedData,
string rootDir)
{
var scriptureBaseDir = Path.Combine(rootDir, SharedConstants.Other);
if (!Directory.Exists(scriptureBaseDir))
return;
if (writeVerbose)
progress.WriteVerbose("Collecting the other data....");
else
progress.WriteMessage("Collecting the other data....");
ScriptureReferenceSystemBoundedContextService.FlattenContext(highLevelData, sortedData, scriptureBaseDir);
ScriptureCheckListsBoundedContextService.FlattenContext(highLevelData, sortedData, scriptureBaseDir);
// Have to flatten the main Scripture context before the rest, since the main context owns the other four.
// The main obj gets stuffed into highLevelData, so the owned stuff can have owner guid restored.
ScriptureBoundedContextService.FlattenContext(highLevelData, sortedData, scriptureBaseDir);
if (highLevelData.ContainsKey(SharedConstants.Scripture))
{
ArchivedDraftsBoundedContextService.FlattenContext(highLevelData, sortedData, scriptureBaseDir);
ScriptureStylesBoundedContextService.FlattenContext(highLevelData, sortedData, scriptureBaseDir);
ImportSettingsBoundedContextService.FlattenContext(highLevelData, sortedData, scriptureBaseDir);
}
}
示例9: SpinSenseOffToItsOwnEntry
/// <summary>
/// Note, this isn't very ambitious. The only thing the new entry will have is the lexeme form and the new sense, not any other traits/fields
/// </summary>
/// <param name="repo"> </param>
/// <param name="sense"></param>
private static void SpinSenseOffToItsOwnEntry(LiftLexEntryRepository repo, LexSense sense, IProgress progress)
{
var existingEntry = (LexEntry) sense.Parent;
progress.WriteMessage("Splitting off {0} ({1}) into its own entry", existingEntry.LexicalForm.GetFirstAlternative(), sense.Definition.GetFirstAlternative());
LexEntry newEntry = repo.CreateItem();
newEntry.LexicalForm.MergeIn(existingEntry.LexicalForm);
existingEntry.Senses.Remove(sense);
newEntry.Senses.Add(sense);
sense.Parent = newEntry;
repo.SaveItem(existingEntry);
repo.SaveItem(newEntry);
}
示例10: FlattenDomain
internal static void FlattenDomain(IProgress progress, bool writeVerbose,
SortedDictionary<string, XElement> highLevelData,
SortedDictionary<string, XElement> sortedData,
string rootDir)
{
var linguisticsBaseDir = Path.Combine(rootDir, SharedConstants.Linguistics);
if (!Directory.Exists(linguisticsBaseDir))
return;
// Do in reverse order from nesting.
if (writeVerbose)
{
progress.WriteVerbose("Collecting the linguistics data....");
progress.WriteVerbose("Collecting the phonology data....");
}
else
{
progress.WriteMessage("Collecting the linguistics data....");
progress.WriteMessage("Collecting the phonology data....");
}
PhonologyBoundedContextService.FlattenContext(highLevelData, sortedData, linguisticsBaseDir);
if (writeVerbose)
progress.WriteVerbose("Collecting the discourse data....");
else
progress.WriteMessage("Collecting the discourse data....");
DiscourseAnalysisBoundedContextService.FlattenContext(highLevelData, sortedData, linguisticsBaseDir);
if (writeVerbose)
progress.WriteVerbose("Collecting the wordform and punctuation data....");
else
progress.WriteMessage("Collecting the wordform and punctuation data....");
WordformInventoryBoundedContextService.FlattenContext(highLevelData, sortedData, linguisticsBaseDir);
if (writeVerbose)
progress.WriteVerbose("Collecting the text corpus data....");
else
progress.WriteMessage("Collecting the text corpus data....");
TextCorpusBoundedContextService.FlattenContext(highLevelData, sortedData, linguisticsBaseDir);
// MorphologyAndSyntaxBoundedContextService and ReversalBoundedContextService, both *must* have LexiconBoundedContextService done before them,
// since they re-add stuff to LexDb that they removed
if (writeVerbose)
progress.WriteVerbose("Collecting the lexical data....");
else
progress.WriteMessage("Collecting the lexical data....");
LexiconBoundedContextService.FlattenContext(highLevelData, sortedData, linguisticsBaseDir);
if (writeVerbose)
progress.WriteVerbose("Collecting the morphology and syntax data....");
else
progress.WriteMessage("Collecting the morphology and syntax data....");
MorphologyAndSyntaxBoundedContextService.FlattenContext(highLevelData, sortedData, linguisticsBaseDir);
if (writeVerbose)
progress.WriteVerbose("Collecting the reversal data....");
else
progress.WriteMessage("Collecting the reversal data....");
ReversalBoundedContextService.FlattenContext(highLevelData, sortedData, linguisticsBaseDir);
}
示例11: Encode
public void Encode(string sourcePath, string destPathWithoutExtension, IProgress progress)
{
LocateAndRememberLAMEPath();
if (RobustFile.Exists(destPathWithoutExtension + ".mp3"))
RobustFile.Delete(destPathWithoutExtension + ".mp3");
progress.WriteMessage(LocalizationManager.GetString("LameEncoder.Progress", " Converting to mp3", "Appears in progress indicator"));
//-a downmix to mono
string arguments = string.Format("-a \"{0}\" \"{1}.mp3\"", sourcePath, destPathWithoutExtension);
//ClipRepository.RunCommandLine(progress, _pathToLAME, arguments);
ExecutionResult result = CommandLineRunner.Run(_pathToLAME, arguments, null, 60, progress);
result.RaiseExceptionIfFailed("");
}
示例12: WriteNestedDomainData
internal static void WriteNestedDomainData(IProgress progress, bool writeVerbose, string rootDir,
IDictionary<string, XElement> wellUsedElements,
IDictionary<string, SortedDictionary<string, byte[]>> classData,
Dictionary<string, string> guidToClassMapping)
{
var anthropologyBaseDir = Path.Combine(rootDir, SharedConstants.Anthropology);
if (!Directory.Exists(anthropologyBaseDir))
Directory.CreateDirectory(anthropologyBaseDir);
FLExProjectSplitter.CheckForUserCancelRequested(progress);
if (writeVerbose)
progress.WriteVerbose("Writing the anthropology data....");
else
progress.WriteMessage("Writing the anthropology data....");
AnthropologyBoundedContextService.NestContext(anthropologyBaseDir, wellUsedElements, classData, guidToClassMapping);
}
示例13: FlattenDomain
internal static void FlattenDomain(
IProgress progress, bool writeVerbose,
SortedDictionary<string, XElement> highLevelData,
SortedDictionary<string, XElement> sortedData,
string pathRoot)
{
var anthropologyBaseDir = Path.Combine(pathRoot, SharedConstants.Anthropology);
if (!Directory.Exists(anthropologyBaseDir))
return; // Nothing to do.
if (writeVerbose)
progress.WriteVerbose("Collecting the anthropology data....");
else
progress.WriteMessage("Collecting the anthropology data....");
AnthropologyBoundedContextService.FlattenContext(highLevelData, sortedData, anthropologyBaseDir);
}
示例14: UploadBook
public static string UploadBook(string bucketName, string bookZipPath, IProgress progress)
{
try
{
using(var s3Client = new BloomS3Client(bucketName))
{
var url = s3Client.UploadSingleFile(bookZipPath, progress);
progress.WriteMessage("Upload Success");
return url;
}
}
catch (WebException e)
{
progress.WriteError("There was a problem uploading your book: "+e.Message);
throw;
}
catch (AmazonS3Exception e)
{
if (e.Message.Contains("The difference between the request time and the current time is too large"))
{
progress.WriteError(LocalizationManager.GetString("PublishTab.Upload.TimeProblem",
"There was a problem uploading your book. This is probably because your computer is set to use the wrong timezone or your system time is badly wrong. See http://www.di-mgt.com.au/wclock/help/wclo_setsysclock.html for how to fix this."));
}
else
{
progress.WriteError("There was a problem uploading your book: " + e.Message);
}
throw;
}
catch (AmazonServiceException e)
{
progress.WriteError("There was a problem uploading your book: " + e.Message);
throw;
}
catch (Exception e)
{
progress.WriteError("There was a problem uploading your book.");
progress.WriteError(e.Message.Replace("{", "{{").Replace("}", "}}"));
progress.WriteVerbose(e.StackTrace);
throw;
}
}
示例15: AttemptToReplaceMissingImage
private bool AttemptToReplaceMissingImage(string missingFile, string pathToFolderOfReplacementImages, IProgress progress)
{
try
{
foreach (var imageFilePath in Directory.GetFiles(pathToFolderOfReplacementImages, missingFile))
{
File.Copy(imageFilePath, Path.Combine(_folderPath, missingFile));
progress.WriteMessage(string.Format("Replaced image {0} from a copy in {1}", missingFile,
pathToFolderOfReplacementImages));
return true;
}
foreach (var dir in Directory.GetDirectories(pathToFolderOfReplacementImages))
{
// doesn't really matter
// if (dir == _folderPath)
// {
// progress.WriteMessage("Skipping the directory of this book");
// }
if (AttemptToReplaceMissingImage(missingFile, dir, progress))
return true;
}
return false;
}
catch (Exception error)
{
progress.WriteException(error);
return false;
}
}