本文整理汇总了C#中Operation.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Operation.ToString方法的具体用法?C# Operation.ToString怎么用?C# Operation.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatOperationCustomDataFail
public void FormatOperationCustomDataFail()
{
Operation operation = new Operation();
operation.Id = 42;
operation.Comment = "Brand!!!";
string format = "{Id}, {MichGibtsNicht}";
string resultExpected = string.Format("{0}, {1}", operation.Id, "");
string result = operation.ToString(format);
Assert.AreEqual(resultExpected, result);
}
示例2: FormatOperationCustomData
public void FormatOperationCustomData()
{
string cdexpr1 = "ort";
string cdexpr1value = "12345";
string cdexpr2 = "myfunny.little.weird.expression";
int cdexpr2value = 42;
string resultExpected = string.Format("{0} - {1}", cdexpr1value, cdexpr2value);
Operation operation = new Operation();
operation.CustomData[cdexpr1] = cdexpr1value;
operation.CustomData[cdexpr2] = cdexpr2value;
string format = string.Format("{{{0}}} - {{{1}}}", cdexpr1, cdexpr2);
string result = operation.ToString(format);
Assert.AreEqual(resultExpected, result);
}
示例3: CreateOperationNode
/// <exception cref="ArgumentNullException">
/// <paramref name="parentNode"/> is null.-or-
/// <paramref name="operation"/> is null.
/// </exception>
protected TreeNode CreateOperationNode(TreeNode parentNode, Operation operation)
{
if (parentNode == null)
throw new ArgumentNullException("parentNode");
if (operation == null)
throw new ArgumentNullException("operation");
TreeNode child = parentNode.Nodes.Add(operation.GetUmlDescription());
int imageIndex = Icons.GetImageIndex(operation);
child.Tag = operation;
child.ImageIndex = imageIndex;
child.SelectedImageIndex = imageIndex;
child.ToolTipText = operation.ToString();
return child;
}
示例4: StringBuilder
void IJob.Execute(IJobContext context, Operation operation)
{
StringBuilder messageText = new StringBuilder();
messageText.AppendFormat("Ort: {0}, ", operation.GetDestinationLocation());
if (!string.IsNullOrWhiteSpace(operation.Picture))
{
messageText.AppendFormat("{0}; ", operation.Picture);
}
if (!string.IsNullOrWhiteSpace(operation.Comment))
{
messageText.AppendFormat("{0}", operation.Comment);
}
string format = SettingsManager.Instance.GetSetting("SMSJob", "MessageFormat").GetString();
string text = operation.ToString(format);
// Truncate the string if it is too long
text = messageText.ToString().Truncate(160, true, true);
// Invoke the provider-send asynchronous because it is a web request and may take a while
_provider.Send(_userName, _password, _recipients.Select(r => r.PhoneNumber), text);
}
示例5: GetName
public string GetName(Operation operation)
{
if (operation == null) throw new ArgumentNullException(nameof(operation));
return GetName(operation.Id) ?? operation.ToString();
}
示例6: ExecuteOperation
private void ExecuteOperation(Operation currOp)
{
this.DeleteFurniture(currOp.FurnitureOldData, false);
this.DrawFurniture(currOp.FurnitureNewData, currOp.Furniture.ID, false);
operationsStack.Items.Add(currOp.ToString());
}
示例7: PerformOperation
public static void PerformOperation(long playerInfoId, Operation op, string param, bool ignoreCommand)
{
if (Program.LicenseExpired == true)
return;
try
{
if (playerInfoId != ActiveBgMusic.Id)
{
// Foreground sound infos
SoundPlayerInfo playerInfo;
switch (op)
{
case Operation.Show:
OperationHelper.Show(getPidForPlayerInfoId(playerInfoId));
break;
case Operation.Minimize:
OperationHelper.Minimize(getPidForPlayerInfoId(playerInfoId));
break;
case Operation.IgnoreForAutoMute:
playerInfo = FindPlayerInfo(playerInfoId);
if (playerInfo != null)
{
SmartVolManagerPackage.BgMusicManager.FgMusicIgnore[playerInfo.Id] = true;
SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict[playerInfo.ShortProcessName] = true;
MuteFmConfigUtil.InitIgnoreForAutoMute(SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict, SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
UpdateFgMusicState();
}
break;
case Operation.NoIgnoreForAutoMute:
playerInfo = FindPlayerInfo(playerInfoId);
if (playerInfo != null)
{
SmartVolManagerPackage.BgMusicManager.FgMusicIgnore[playerInfo.Id] = false;
SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict[playerInfo.ShortProcessName] = false;
MuteFmConfigUtil.InitIgnoreForAutoMute(SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict, SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
UpdateFgMusicState();
}
break;
default:
string[] sessionInstanceIdentifiers = getSessionInstanceIdentifiers(playerInfoId);
foreach (string sessionInstanceIdentifier in sessionInstanceIdentifiers)
{
switch (op)
{
case Operation.Mute:
FgMusicMuted[playerInfoId] = true;
MuteFm.SmartVolManagerPackage.SoundServer.PerformOperation(sessionInstanceIdentifier, OperationEnum.Mute.ToString(), null, null, new PostVolumeOp(delegate() { UpdateFgMusicState(); }));
break;
case Operation.Unmute:
FgMusicMuted[playerInfoId] = false;
MuteFm.SmartVolManagerPackage.SoundServer.PerformOperation(sessionInstanceIdentifier, OperationEnum.Unmute.ToString(), null, null, new PostVolumeOp(delegate() { UpdateFgMusicState(); }));
break;
case Operation.SetVolumeTo:
FgMusicVol[playerInfoId] = float.Parse(param);
MuteFm.SmartVolManagerPackage.SoundServer.PerformOperation(sessionInstanceIdentifier, OperationEnum.SetVolumeTo.ToString(), param, null, new PostVolumeOp(delegate() { UpdateFgMusicState(); }));
break;
case Operation.SetVolumeToNoFade:
FgMusicVol[playerInfoId] = float.Parse(param);
MuteFm.SmartVolManagerPackage.SoundServer.PerformOperation(sessionInstanceIdentifier, OperationEnum.SetVolumeToNoFade.ToString(), param, null, new PostVolumeOp(delegate() { UpdateFgMusicState(); }));
break;
}
}
break;
}
// TODO: update state via postoperation in all of the above
}
else
{
MuteFm.SmartVolManagerPackage.SoundEventLogger.LogBg(op.ToString());
switch (op)
{
case Operation.Play:
case Operation.ChangeMusic:
PerformOperation(playerInfoId, Operation.Unmute, null, ignoreCommand); //todo is this trying to unmute before loaded???
//if (_runCommand(ActiveBgMusic.PlayCommand))
//{
// Update MusicState(BgMusicState.Play);
//}
break;
case Operation.Pause:
if (_runCommand(ActiveBgMusic.PauseCommand))
UpdateBgMusicState(BgMusicState.Pause);
break;
case Operation.Mute:
Mute(new PostVolumeOp(delegate() { FadingThreadCount--; }), 0);
break;
case Operation.Stop:
if (ActiveBgMusic.IsWeb == false)
{
//.........这里部分代码省略.........