本文整理汇总了C#中MessageDialog.GrabFocus方法的典型用法代码示例。如果您正苦于以下问题:C# MessageDialog.GrabFocus方法的具体用法?C# MessageDialog.GrabFocus怎么用?C# MessageDialog.GrabFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageDialog
的用法示例。
在下文中一共展示了MessageDialog.GrabFocus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowChallengeDialog
private void ShowChallengeDialog(MatchChallenge mc)
{
StringBuilder buf = new StringBuilder ();
string rating;
if (mc.OpponentsRating != 0)
rating = mc.OpponentsRating.
ToString ();
else
rating = "----";
buf.Append (String.
Format
("<big><b>{0} ({1}) wants to play a {2} game</b></big>\n",
mc.Opponent, rating,
mc.Category));
buf.Append (String.
Format
("<b><u>Time:</u> {0} </b><i>mins</i>, <b><u>Increment:</u></b> {1}\n",
mc.Time, mc.Increment));
if (mc.Color != null)
buf.Append (String.
Format
("\n<b><u>Color:</u></b> {0}\n",
mc.Color));
buf.Append
("\n\n<b>Do you want to play?</b>");
MessageDialog dlg = new MessageDialog (null,
DialogFlags.
Modal,
MessageType.
Question,
ButtonsType.
YesNo,
true,
buf.
ToString
());
dlg.Modal = false;
dlg.GrabFocus ();
int ret = dlg.Run ();
if (ret == (int) ResponseType.Yes)
client.CommandSender.
SendCommand ("accept");
else if (ret == (int) ResponseType.No)
client.CommandSender.
SendCommand ("decline");
dlg.Hide ();
dlg.Dispose ();
}