本文整理匯總了C#中System.Windows.Forms.Message.AssignFrom方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.AssignFrom方法的具體用法?C# Message.AssignFrom怎麽用?C# Message.AssignFrom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.Message
的用法示例。
在下文中一共展示了Message.AssignFrom方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CopyFromPins
protected bool CopyFromPins(Message message, int index, bool checkPinForChange = false)
{
var hasCopied = false;
foreach (string fieldName in FPins.Keys)
{
// don't change if pin data still the same
if (!checkPinForChange || FPins[fieldName].ToISpread().IsChanged)
{
var pinSpread = FPins[fieldName].ToISpread();
var invalidBin = pinSpread == null || pinSpread.SliceCount == 0 || pinSpread[0] == null;
if (invalidBin)
{
if (message.Fields.Contains(fieldName))
{
message[fieldName].Clear(); // to be or not to be?
hasCopied = true;
}
}
else
{
var bin = pinSpread[index] as IEnumerable;
var type = Formular[fieldName].Type;
// don't change if pin data equals the message data, because doing so will flag the message dirty.
if (!message.Fields.Contains(fieldName) || !message[fieldName].Equals(bin))
{
message.AssignFrom(fieldName, bin, type);
hasCopied = true;
}
}
}
}
return hasCopied;
}