本文整理汇总了C#中System.Windows.Controls.WrapPanel.SetResourceReference方法的典型用法代码示例。如果您正苦于以下问题:C# WrapPanel.SetResourceReference方法的具体用法?C# WrapPanel.SetResourceReference怎么用?C# WrapPanel.SetResourceReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.WrapPanel
的用法示例。
在下文中一共展示了WrapPanel.SetResourceReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisualMessage
public VisualMessage( string StreamerNick, SmilesDataDase Db, ChatMessage Data )
{
this.Data = Data;
List<Uri> Urls = new List<Uri>();
string UserText = Data.Text;// HttpUtility.HtmlDecode(Data.Text.Replace(":s:", " :s:").Replace(" ", " "));
UserText = UriDetector.Replace(
UserText,
new MatchEvaluator(( m ) => {
Urls.Add(new Uri(m.Value, UriKind.RelativeOrAbsolute));
return LinkReplacer + " ";
})
);
// parse text
WrapPanel wp = new WrapPanel() {
Orientation = System.Windows.Controls.Orientation.Horizontal,
};
List<string> ttt = new List<string>();
// Тоже странный кусок:
int nxd = UserText.IndexOf("<b>");
if (nxd >= 0) {
int nxd2 = UserText.IndexOf("</b>");
TalkTo = UserText.Substring(nxd + 3, nxd2 - nxd - 3);
if (UserText.Length <= (nxd2 + 6)) {
UserText = "";
} else {
UserText = UserText.Substring(nxd2 + 6);
}
if (TalkTo == StreamerNick) {
wp.SetResourceReference(WrapPanel.StyleProperty, "StreamerContainer");
} else {
wp.SetResourceReference(WrapPanel.StyleProperty, "NormalTextContainer");
}
ttt.Add(TalkTo + ",");
} else {
TalkTo = "";
}
ttt.AddRange(UserText.Split(' '));
// if (UseLabel) {
Label name = new Label() { Content = Data.Name + ": " };
name.SetResourceReference(Label.StyleProperty, "LabelNameStyle");
wp.Children.Add(name);
int linkIndex = 0;
for (int j = 0; j < ttt.Count; ++j) {
if (ttt[j] == LinkReplacer) {
Label link = new Label() {
Content = "link ",
Cursor = Cursors.Hand,
ToolTip = Urls[linkIndex],
Tag = Urls[linkIndex]
};
link.SetResourceReference(Label.StyleProperty, "LabelLinkStyle");
link.MouseLeftButtonUp += ( sender, b ) => {
Uri u = ((Label)sender).Tag as Uri;
System.Diagnostics.Process.Start(u.ToString());
};
wp.Children.Add(link);
linkIndex++;
} else {
//if (j != (ttt.Count - 1))
ttt[j] += ' ';
if (CreateSmile(Db, ttt[j], wp)) {
// Ура смайл ебать есть
} else {
Label txt = new Label() { Content = ttt[j] };
if (TalkTo + ", " == ttt[j]) {
txt.SetResourceReference(Label.StyleProperty, "LabelNameTextStyle");
} else {
txt.SetResourceReference(Label.StyleProperty, "LabelTextStyle");
}
wp.Children.Add(txt);
}
}
}
//} else {
// TextBlock name = new TextBlock() { Text = Data.Name + ": " };
// name.SetResourceReference(TextBlock.StyleProperty, "NameStyle");
// wp.Children.Add(name);
// int linkIndex = 0;
// for (int j = 0; j < ttt.Count; ++j) {
// if (ttt[j] == LinkReplacer) {
// TextBlock link = new TextBlock() {
// Text = "link ",
// Cursor = Cursors.Hand,
// ToolTip = Urls[linkIndex],
// Tag = Urls[linkIndex]
//.........这里部分代码省略.........