本文整理汇总了C#中Source.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Source.GetProperty方法的具体用法?C# Source.GetProperty怎么用?C# Source.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source.GetProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainTest
public void MainTest()
{
var callCount = 0;
var source = new Source();
using (Trigger.Create(source.GetProperty(o => o.Value), p => ++callCount))
{
++source.Value;
Assert.AreEqual(1, callCount);
++source.Value;
Assert.AreEqual(2, callCount);
}
++source.Value;
Assert.AreEqual(2, callCount);
}
示例2: UpdateSourceContents
private void UpdateSourceContents (Source source)
{
if (source == null) {
return;
}
// Connect the source models to the views if possible
ISourceContents contents = source.GetProperty<ISourceContents> ("Nereid.SourceContents",
source.GetInheritedProperty<bool> ("Nereid.SourceContentsPropagate"));
view_container.ClearHeaderWidget ();
view_container.ClearFooter ();
if (contents != null) {
if (view_container.Content != contents) {
view_container.Content = contents;
}
view_container.Content.SetSource (source);
view_container.Show ();
} else if (source is ITrackModelSource) {
view_container.Content = composite_view;
view_container.Content.SetSource (source);
view_container.Show ();
} else if (source is Hyena.Data.IObjectListModel) {
if (object_view == null) {
object_view = new ObjectListSourceContents ();
}
view_container.Content = object_view;
view_container.Content.SetSource (source);
view_container.Show ();
} else {
view_container.Hide ();
}
// Associate the view with the model
if (view_container.Visible && view_container.Content is ITrackModelSourceContents) {
ITrackModelSourceContents track_content = view_container.Content as ITrackModelSourceContents;
source.Properties.Set<IListView<TrackInfo>> ("Track.IListView", track_content.TrackView);
}
var title_widget = source.Properties.Get<Widget> ("Nereid.SourceContents.TitleWidget");
if (title_widget != null) {
Hyena.Log.Warning ("Nereid.SourceContents.TitleWidget is no longer used (from {0})", source.Name);
}
Widget header_widget = null;
if (source.Properties.Contains ("Nereid.SourceContents.HeaderWidget")) {
header_widget = source.Properties.Get<Widget> ("Nereid.SourceContents.HeaderWidget");
}
if (header_widget != null) {
view_container.SetHeaderWidget (header_widget);
}
Widget footer_widget = null;
if (source.Properties.Contains ("Nereid.SourceContents.FooterWidget")) {
footer_widget = source.Properties.Get<Widget> ("Nereid.SourceContents.FooterWidget");
}
if (footer_widget != null) {
view_container.SetFooter (footer_widget);
}
}
示例3: UpdateSourceContents
private void UpdateSourceContents(Source source)
{
if (source == null) {
return;
}
// Connect the source models to the views if possible
ISourceContents contents = source.GetProperty<ISourceContents> ("Nereid.SourceContents",
source.GetInheritedProperty<bool> ("Nereid.SourceContentsPropagate"));
bool remove_margins = false;
view_container.ClearFooter ();
if (contents != null) {
if (view_container.Content != contents) {
view_container.Content = contents;
}
view_container.Content.SetSource (source);
view_container.Show ();
remove_margins = contents is Cubano.NowPlaying.NowPlayingInterface ||
contents.GetType ().FullName == "Banshee.NowPlaying.NowPlayingInterface";
} else if (source is ITrackModelSource) {
view_container.Content = composite_view;
view_container.Content.SetSource (source);
view_container.Show ();
} else if (source is Hyena.Data.IObjectListModel) {
if (object_view == null) {
object_view = new ObjectListSourceContents ();
}
view_container.Content = object_view;
view_container.Content.SetSource (source);
view_container.Show ();
} else {
view_container.Hide ();
}
// Associate the view with the model
if (view_container.Visible && view_container.Content is ITrackModelSourceContents) {
ITrackModelSourceContents track_content = view_container.Content as ITrackModelSourceContents;
source.Properties.Set<IListView<TrackInfo>> ("Track.IListView", track_content.TrackView);
}
header.Visible = source.Properties.Contains ("Nereid.SourceContents.HeaderVisible") ?
source.Properties.Get<bool> ("Nereid.SourceContents.HeaderVisible") : true;
Widget footer_widget = null;
if (source.Properties.Contains ("Nereid.SourceContents.FooterWidget")) {
footer_widget = source.Properties.Get<Widget> ("Nereid.SourceContents.FooterWidget");
}
if (footer_widget != null) {
view_container.SetFooter (footer_widget);
}
ConfigureMargins (remove_margins);
}