本文整理汇总了C#中ActivityParameterDictionary.GetParamValue方法的典型用法代码示例。如果您正苦于以下问题:C# ActivityParameterDictionary.GetParamValue方法的具体用法?C# ActivityParameterDictionary.GetParamValue怎么用?C# ActivityParameterDictionary.GetParamValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActivityParameterDictionary
的用法示例。
在下文中一共展示了ActivityParameterDictionary.GetParamValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EstablishConnectionToScanner
public NextActivityKey EstablishConnectionToScanner(
WorkflowExecutionContext context, ActivityParameterDictionary parameters)
{
var maxTryCount = parameters.GetParamValue("MaxTryCount", 3);
var delay = TimeSpan.Parse(parameters.GetParamValue("Delay", "0:0:5"));
if (!_scannerManager.EstablishConnectionToScanner(maxTryCount, delay))
return BpcNextActivityKeys.No;
var errorId = parameters.GetParamValueOrThrow<string>("ErrorId");
_workflowManager.ResetErrorCounter(errorId);
return BpcNextActivityKeys.Yes;
}
示例2: Mock
public NextActivityKey Mock(
WorkflowExecutionContext context, ActivityParameterDictionary parameters)
{
_logger.LogInfo(Message.Common_Information, parameters.GetParamValue("Text", "-"));
context.Sleep(TimeSpan.FromMilliseconds(500));
return context.DefaultNextActivityKey;
}
示例3: PrepareParamsForSaySelectedMarks
public NextActivityKey PrepareParamsForSaySelectedMarks(
WorkflowExecutionContext context, ActivityParameterDictionary parameters)
{
if (_lastVotingResult == null ||
_lastVotingResult.SectionsMarks == null)
{
PhraseTextFormat = "";
PhraseFormat = "";
PhraseSounds = new string[] { };
PhraseParams = new object[] { };
return context.DefaultNextActivityKey;
}
var textFormatSb = new StringBuilder(parameters.GetParamValue("Text", ""));
var phraseFormatSb = new StringBuilder();
var phraseParams = new List<object>();
var sounds = new List<string>();
var firstSound = parameters.GetParamValue<string>("Sound", null);
if (firstSound != null)
{
phraseFormatSb.Append("{s0}");
sounds.Add(firstSound);
}
if (_lastVotingResult.SectionsMarks.Length == 1)
{
GetPositionsInSection(_lastVotingResult.SectionsMarks[0], false,
textFormatSb, phraseFormatSb, sounds, phraseParams);
}
else
{
int sectionNum = 1;
foreach (var section in _lastVotingResult.SectionsMarks)
{
textFormatSb.AppendFormat("Секция {{p{0}}}: ", phraseParams.Count);
phraseFormatSb.AppendFormat("{{s{0}}}{{p{1}}}", sounds.Count, phraseParams.Count);
sounds.Add("section");
phraseParams.Add(sectionNum++);
GetPositionsInSection(section, true, textFormatSb, phraseFormatSb, sounds, phraseParams);
textFormatSb.Append("; ");
}
if (textFormatSb.Length > 0)
textFormatSb.Length -= 2;
}
PhraseTextFormat = textFormatSb.ToString();
PhraseFormat = phraseFormatSb.ToString();
PhraseSounds = sounds.ToArray();
PhraseParams = phraseParams.ToArray();
return context.DefaultNextActivityKey;
}
示例4: PrintReport
public NextActivityKey PrintReport(
WorkflowExecutionContext context, ActivityParameterDictionary parameters)
{
_scannerManager.SetIndicator(parameters.GetParamValue<string>("Text"));
_printerJob.Copies = CopiesNumber;
var printResult = _isPrinterRemote
? _syncManager.RemoteScanner.PrintReport(_printerJob)
: _printingManager.PrintReport(_printerJob);
CopiesNumber = 1;
return !printResult
? BpcNextActivityKeys.No
: BpcNextActivityKeys.Yes;
}
示例5: TransmitDecisionToSlaveScanner
public NextActivityKey TransmitDecisionToSlaveScanner(
WorkflowExecutionContext context, ActivityParameterDictionary parameters)
{
var hasConflict = parameters.GetParamValue<bool>("HasConflict");
if (hasConflict)
_logger.LogInfo(Message.WorkflowHasConflict);
if (_syncManager.ScannerRole == ScannerRole.Master && _syncManager.IsRemoteScannerConnected)
{
_syncManager.RemoteScanner.PutData(HASCONFLICT_DATANAME, hasConflict);
}
return context.DefaultNextActivityKey;
}
示例6: SayPhraseAndExit
private NextActivityKey SayPhraseAndExit(
WorkflowExecutionContext context,
ActivityParameterDictionary parameters,
string exitTypeParamName)
{
SayPhrase(context, parameters);
var exitType = parameters.GetParamValue(exitTypeParamName, ApplicationExitType.RestartApplication);
CoreApplication.Instance.Exit(exitType);
context.Sleep(Timeout.Infinite);
return context.DefaultNextActivityKey;
}
示例7: SayAndReadValue
private NextActivityKey SayAndReadValue(
WorkflowExecutionContext context, ActivityParameterDictionary parameters,
WaitHandle okEvent, WaitHandle cancelEvent)
{
RaiseOutputStarting(InfoType.Question);
var silent = NeedSilent(parameters);
var composer = CreatePhraseComposer(parameters, silent);
var text = composer.ComposeText();
LastReadedValue = parameters.GetParamValue<object>("Value") == null
? null
: parameters.GetParamValue<long>("Value").ToString();
var passwordChar = parameters.GetParamValue("PasswordChar", ReadValueContext.NULL_PASSWORD_CHAR);
var readValueMode = parameters.GetParamValue("ReadValueMode", ReadValueMode.CutLeadingZero);
var helpComposer = CreateHelpPhraseComposer(parameters);
var helpSounds = helpComposer.ComposePhrase();
var readValueContext = new ReadValueContext(
context, _scannerManager.IndicatorLength, text, LastReadedValue, passwordChar, readValueMode);
var readValueThread = new Thread(ReadValueMethod);
var required = parameters.GetParamValue("Required", false);
try
{
readValueThread.Start(readValueContext);
var sounds = silent ? new string[] { } : composer.ComposePhrase();
var repeatTimeout = GetRepeatTimeout(parameters);
var startTimeout = GetStartTimeout(parameters);
var nextActivityKeyResolver = GetNextActivityKeyResolver(parameters);
while (true)
{
int occurredEventIndex;
var result = SayAndWaitEvents(
context, "", sounds, null, helpSounds,
silent, false, new[] { okEvent, cancelEvent },
startTimeout, repeatTimeout, nextActivityKeyResolver, out occurredEventIndex);
if (occurredEventIndex == 0)
{
if (required && string.IsNullOrEmpty(readValueContext.Value))
continue;
LastReadedValue = readValueContext.Value;
}
return result;
}
}
finally
{
readValueContext.StopReadingEvent.Set();
readValueThread.Join(TimeSpan.FromSeconds(1));
}
}
示例8: NeedSilent
private bool NeedSilent(ActivityParameterDictionary parameters)
{
var silentOnSlave = parameters.GetParamValue("SilentOnSlave", false);
var silent = parameters.GetParamValue("Silent", false);
return
silentOnSlave && _syncManager.ScannerRole == ScannerRole.Slave
|| silent;
}
示例9: NeedIgnoreButtons
private bool NeedIgnoreButtons(ActivityParameterDictionary parameters)
{
var ignoreButtonsOnSlave = parameters.GetParamValue("IgnoreButtonsOnSlave", false);
return ignoreButtonsOnSlave && _syncManager.ScannerRole == ScannerRole.Slave;
}
示例10: CreatePhraseComposer
private PhraseComposer CreatePhraseComposer(
ActivityParameterDictionary parameters, bool forComposeTextOnly)
{
var composer = new PhraseComposer(_soundManager)
{
TextFormat = parameters.GetParamValue("TextFormat", string.Empty),
Parameters = parameters.GetParamValueAsArray("Parameters")
};
if (!forComposeTextOnly)
{
composer.PhraseFormat = parameters.GetParamValue("PhraseFormat", "{s*}");
composer.Sounds = parameters.GetParamValueAsArray<string>("Sounds");
}
return composer;
}
示例11: CreateHelpPhraseComposer
private PhraseComposer CreateHelpPhraseComposer(ActivityParameterDictionary parameters)
{
var composer = new PhraseComposer(_soundManager)
{
TextFormat = parameters.GetParamValue("HelpTextFormat", string.Empty),
Parameters = parameters.GetParamValueAsArray("HelpParameters"),
PhraseFormat = parameters.GetParamValue("HelpPhraseFormat", "{s*}"),
Sounds = parameters.GetParamValueAsArray("HelpSounds", new string[0])
};
return composer;
}
示例12: GetTimeout
private static int GetTimeout(
ActivityParameterDictionary parameters, string parameterName, int defaultValue)
{
var paramValue = parameters.GetParamValue<string>(parameterName);
if (string.IsNullOrEmpty(paramValue))
return defaultValue;
if (paramValue == "Infinite")
return Timeout.Infinite;
try
{
var timeout = Convert.ToInt32(TimeSpan.Parse(paramValue).TotalMilliseconds);
if (timeout > 0)
return timeout;
throw new ApplicationException(string.Format("Параметр '{0}' должен быть больше 0", parameterName));
}
catch (Exception ex)
{
throw new Exception(
string.Format("Некорректное значение параметра '{0}': {1}", parameterName, paramValue), ex);
}
}
示例13: GetNextActivityKeyResolver
private static NextActivityKeyResolver GetNextActivityKeyResolver(ActivityParameterDictionary parameters)
{
return parameters.GetParamValue("NextActivityKeyResolver",
new NextActivityKeyResolver(DefaultNextActivityKeyResolver));
}
示例14: SayAndReadValueCancelIsBack
public NextActivityKey SayAndReadValueCancelIsBack(
WorkflowExecutionContext context, ActivityParameterDictionary parameters)
{
var okEvent = parameters.GetParamValue("OK", (WaitHandle)KeyPressedWaitHandle.YesPressed);
var cancelEvent = parameters.GetParamValue("Cancel", (WaitHandle)KeyPressedWaitHandle.GoBackPressed);
return SayAndReadValue(context, parameters, okEvent, cancelEvent);
}
示例15: ReportError
public NextActivityKey ReportError(WorkflowExecutionContext context, ActivityParameterDictionary parameters)
{
var errorId = parameters.GetParamValueOrThrow<string>("ErrorId");
var maxRestartCount = parameters.GetParamValue("MaxRestartCount", 5);
var secondMaxRestartCount = parameters.GetParamValue("SecondMaxRestartCount", 5);
RaiseOutputStarting(InfoType.Warning);
var newErrorCount = _workflowManager.IncreaseErrorCounter(errorId);
if (newErrorCount <= maxRestartCount)
{
return SayPhraseAndExit(context, parameters, "ExitType");
}
if (newErrorCount <= secondMaxRestartCount + maxRestartCount)
{
return SayPhraseAndExit(context, parameters, "SecondExitType");
}
var composer = CreatePhraseComposer(parameters, false);
var text = composer.ComposeText();
var sounds = composer.ComposePhrase(new[] { "contact_technical_support" });
var helpComposer = CreateHelpPhraseComposer(parameters);
var helpText = helpComposer.ComposeText();
var helpSounds = helpComposer.ComposePhrase();
int occurredEventIndex;
return SayAndWaitEvents(
context,
text, sounds, helpText, helpSounds,
false, false,
new WaitHandle[] {}, 0, Timeout.Infinite,
null, out occurredEventIndex);
}