本文整理汇总了C#中Selector类的典型用法代码示例。如果您正苦于以下问题:C# Selector类的具体用法?C# Selector怎么用?C# Selector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Selector类属于命名空间,在下文中一共展示了Selector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OfType_Matches_Control_With_TemplatedParent
public void OfType_Matches_Control_With_TemplatedParent()
{
var control = new Control1 { TemplatedParent = new Mock<ITemplatedControl>().Object };
var target = new Selector().OfType<Control1>();
Assert.True(target.Match(control).ImmediateResult);
}
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_OfType.cs
示例2: OfType_Doesnt_Match_Control_Of_Wrong_Type
public void OfType_Doesnt_Match_Control_Of_Wrong_Type()
{
var control = new Control2();
var target = new Selector().OfType<Control1>();
Assert.False(target.Match(control).ImmediateResult);
}
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_OfType.cs
示例3: should_return_all_the_weather_with_max_diff
public void should_return_all_the_weather_with_max_diff()
{
var weathers = new List<Weather> { new Weather(1, 5f), new Weather(2, 15f), new Weather(3, 15f) };
var maxDiffDays = new Selector().SelectWeather(weathers);
Assert.Equal(2, maxDiffDays.Count);
}
开发者ID:r00e,项目名称:goodGoodStudy,代码行数:7,代码来源:DataMungingFacts.cs
示例4: CalloutView
public CalloutView (string text, PointF pt, NSObject target, Selector sel) : base(_initframe)
{
SetAnchorPoint (pt);
Initialize ();
Text = text;
AddButtonTarget (target, sel);
}
开发者ID:21Off,项目名称:21Off,代码行数:7,代码来源:CalloutView.cs
示例5: OfType_Matches_Control_Of_Correct_Type
public void OfType_Matches_Control_Of_Correct_Type()
{
var control = new Control1();
var target = new Selector().OfType<Control1>();
Assert.True(target.Match(control).ImmediateResult);
}
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_OfType.cs
示例6: Name_Doesnt_Match_Control_Of_Wrong_Name
public void Name_Doesnt_Match_Control_Of_Wrong_Name()
{
var control = new Control1 { Name = "foo" };
var target = new Selector().Name("bar");
Assert.False(target.Match(control).ImmediateResult);
}
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_Name.cs
示例7: FillTreeWithData
protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
{
object manager = Activator.CreateInstance(_managerType, new object[] { provider });
DbConnection connection = (DbConnection)context.Instance;
ObjectSelectorEditor.SelectorNode node;
_selector = selector;
_selector.Clear();
if (manager != null)
{
int items = (int)_managerType.InvokeMember("GetConnectionCount", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, null);
string dataProvider;
string connectionString;
string connectionName;
for (int n = 0; n < items; n++)
{
connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
connectionName = (string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
dataProvider = (string)_managerType.InvokeMember("GetProvider", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
if (String.Compare(dataProvider, "System.Data.SQLite", StringComparison.OrdinalIgnoreCase) == 0)
{
node = selector.AddNode(connectionName, connectionString, null);
if (String.Compare(connectionString, connection.ConnectionString, StringComparison.OrdinalIgnoreCase) == 0)
selector.SelectedNode = node;
}
}
selector.AddNode("<New Connection...>", this, null);
}
}
开发者ID:CuneytKukrer,项目名称:TestProject,代码行数:33,代码来源:SQLiteConnectionStringEditor.cs
示例8: Run
/// <summary>
/// Runs the code example.
/// </summary>
/// <param name="user">The AdWords user.</param>
public void Run(AdWordsUser user) {
// Get the ManagedCustomerService.
ManagedCustomerService managedCustomerService = (ManagedCustomerService) user.GetService(
AdWordsService.v201509.ManagedCustomerService);
// Create selector.
Selector selector = new Selector();
selector.fields = new String[] {
ManagedCustomer.Fields.CustomerId, ManagedCustomer.Fields.Name
};
try {
// Get results.
ManagedCustomerPage page = managedCustomerService.get(selector);
// Display serviced account graph.
if (page.entries != null) {
// Create map from customerId to customer node.
Dictionary<long, ManagedCustomerTreeNode> customerIdToCustomerNode =
new Dictionary<long, ManagedCustomerTreeNode>();
// Create account tree nodes for each customer.
foreach (ManagedCustomer customer in page.entries) {
ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
node.Account = customer;
customerIdToCustomerNode.Add(customer.customerId, node);
}
// For each link, connect nodes in tree.
if (page.links != null) {
foreach (ManagedCustomerLink link in page.links) {
ManagedCustomerTreeNode managerNode =
customerIdToCustomerNode[link.managerCustomerId];
ManagedCustomerTreeNode childNode = customerIdToCustomerNode[link.clientCustomerId];
childNode.ParentNode = managerNode;
if (managerNode != null) {
managerNode.ChildAccounts.Add(childNode);
}
}
}
// Find the root account node in the tree.
ManagedCustomerTreeNode rootNode = null;
foreach (ManagedCustomer account in page.entries) {
if (customerIdToCustomerNode[account.customerId].ParentNode == null) {
rootNode = customerIdToCustomerNode[account.customerId];
break;
}
}
// Display account tree.
Console.WriteLine("CustomerId, Name");
Console.WriteLine(rootNode.ToTreeString(0, new StringBuilder()));
} else {
Console.WriteLine("No serviced accounts were found.");
}
} catch (Exception e) {
throw new System.ApplicationException("Failed to create ad groups.", e);
}
}
开发者ID:markgmarkg,项目名称:googleads-dotnet-lib,代码行数:64,代码来源:GetAccountHierarchy.cs
示例9: Name_Matches_Control_With_Correct_Name
public void Name_Matches_Control_With_Correct_Name()
{
var control = new Control1 { Name = "foo" };
var target = new Selector().Name("foo");
Assert.True(target.Match(control).ImmediateResult);
}
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_Name.cs
示例10: Native
internal Native(IntPtr target, Selector selector, IntPtr imp, MethodSignature sig)
{
Contract.Requires(selector != null, "selector is null");
Contract.Requires(target == IntPtr.Zero || imp != IntPtr.Zero, "imp is null");
m_target = target;
if (m_target != IntPtr.Zero)
{
if (ms_stackFrames == null)
ms_stackFrames = new Dictionary<MethodSignature, StackFrame>(); // note that we have to do this here so each thread gets its own dictionary
m_selector = selector;
m_imp = imp;
m_sig = sig ?? new MethodSignature(target, (IntPtr) selector);
if (!ms_stackFrames.TryGetValue(m_sig, out m_stackFrame))
{
m_stackFrame = new StackFrame(m_sig);
ms_stackFrames.Add(m_sig, m_stackFrame);
}
Ffi.FillBuffer(m_stackFrame.ArgBuffers[0], target, "@");
Ffi.FillBuffer(m_stackFrame.ArgBuffers[1], m_selector, ":");
}
}
开发者ID:afrog33k,项目名称:mobjc,代码行数:26,代码来源:Native.cs
示例11: OnStart
protected override void OnStart()
{
collection = new ObservableCollection<int>();
var scene = new ReactiveScene();
var layer = new ReactiveLayer2D();
var layout = new LinearPanel()
{
ItemSpan = new Vector2DF(0, 36),
};
var selector = new Selector<int, Control>(CreateController(), layout);
selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png");
selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel);
selector.Loop = true;
font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 255, 255, 255), 0, new Color(0, 0, 0, 255));
CollectionBinderForSelector<int>.Bind(selector, collection, c => new ListItem()
{
Font = font,
Text = $"追加アイテム{c}",
}, false);
Engine.ChangeScene(scene);
scene.AddLayer(layer);
layer.AddObject(selector);
}
开发者ID:NumAniCloud,项目名称:Nac.Altseed,代码行数:28,代码来源:CollectionBinderTest.cs
示例12: Stylesheet
public Stylesheet(String stylesheet)
{
char currentChar = '\0';
StringBuilder buffer = new StringBuilder();
for (int i = 0, j = 0; i < stylesheet.Length; i++, j++)
{
currentChar = stylesheet[i];
switch (currentChar)
{
case ' ':
continue;
case '{':
{
int endIndex = stylesheet.IndexOf('}', i);
String block = stylesheet.Substring(i, endIndex - i);
Selector selector = new Selector(buffer.ToString().Trim(), block);
this.selectors.Add(selector);
i = endIndex - 1;
buffer.Clear();
continue;
}
default:
buffer.Append(currentChar);
break;
}
}
}
开发者ID:krikelin,项目名称:SpiderView,代码行数:27,代码来源:CSS.cs
示例13: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (provider != null)
{
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc == null)
{
return value;
}
if (this.selector == null)
{
this.selector = new Selector(this);
DesignerUtils.ApplyTreeViewThemeStyles(this.selector);
}
this.prevValue = value;
this.currValue = value;
this.FillTreeWithData(this.selector, context, provider);
this.selector.Start(edSvc, value);
edSvc.DropDownControl(this.selector);
this.selector.Stop();
if (this.prevValue != this.currValue)
{
value = this.currValue;
}
}
return value;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:ObjectSelectorEditor.cs
示例14: FillTreeWithData
/// <summary>
/// Main method.
/// </summary>
/// <param name="selector"></param>
/// <param name="context"></param>
/// <param name="provider"></param>
/// <exception cref="System.ArgumentNullException">selector or context or provider</exception>
protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
{
selector.ThrowIfNull(nameof(selector));
context.ThrowIfNull(nameof(context));
provider.ThrowIfNull(nameof(provider));
// Base method, clear the selector
base.FillTreeWithData(selector, context, provider);
// Scroll through the pages
MultiPanel panel = (MultiPanel)context.Instance;
foreach (MultiPanelPage page in panel.Controls)
{
SelectorNode node = new SelectorNode(page.Name, page);
selector.Nodes.Add(node);
if (page != panel.SelectedPage)
continue;
selector.SelectedNode = node;
return;
}
}
开发者ID:,项目名称:,代码行数:32,代码来源:
示例15: should_return_all_the_score_with_max_diff
public void should_return_all_the_score_with_max_diff()
{
var scores = new List<Score> { new Score("Arsenal", 43), new Score("Derby", 43), new Score("Ipswich", 23) };
var maxDiffTeams = new Selector().SelectScore(scores);
Assert.Equal(2, maxDiffTeams.Count);
}
开发者ID:r00e,项目名称:goodGoodStudy,代码行数:7,代码来源:DataMungingFacts.cs
示例16: OnStart
protected override void OnStart()
{
var layout = new LinearPanel()
{
ItemSpan = new Vector2DF(0, 36),
};
var selector = new Selector<int, Control>(CreateController(), layout);
selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel);
selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png");
selector.IsControllerUpdated = true;
var font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 0, 0, 255), 0, new Color(0, 0, 0, 0));
var size = selector.Cursor.Texture.Size;
var scroll = new ScrollLayer()
{
Position = new Vector2DF(30, 30),
CameraSize = new Vector2DF(200, 200),
BindingAreaRange = new RectF(0, 25, 200, 150),
BoundaryStartingPosition = new Vector2DF(0, 0),
BoundaryEndingPosition = layout.ItemSpan * 10 + new Vector2DF(200, 0),
};
var areaChanged = selector.OnSelectionChanged
.Select(c => selector.GetItemForChocie(c).Position)
.Select(p => new RectF(p.X, p.Y, size.X, size.Y));
scroll.SubscribeSeeingArea(areaChanged);
var scene = new Scene();
Engine.ChangeScene(scene);
scene.AddLayer(scroll);
scroll.AddObject(selector);
for(int i = 0; i < 10; i++)
{
var obj = new TextObject2D()
{
Font = font,
Text = $"アイテム{i}",
};
selector.AddChoice(i, obj);
}
var heart1 = new TextureObject2D()
{
Position = scroll.BoundaryEndingPosition - new Vector2DF(50, 50),
Texture = Engine.Graphics.CreateTexture2D("Heart.png"),
};
scroll.AddObject(heart1);
var heart2 = new TextureObject2D()
{
Position = scroll.BoundaryStartingPosition - new Vector2DF(0, 50),
Texture = Engine.Graphics.CreateTexture2D("Heart.png"),
};
scroll.AddObject(heart2);
var viewer = new ScrollBoundViewer(scroll);
scroll.AddObject(viewer);
}
开发者ID:NumAniCloud,项目名称:Nac.Altseed,代码行数:59,代码来源:ScrollTest.cs
示例17: Name_Doesnt_Match_Control_With_TemplatedParent
public void Name_Doesnt_Match_Control_With_TemplatedParent()
{
var control = new Control1 { TemplatedParent = new Mock<ITemplatedControl>().Object };
var target = new Selector().Name("foo");
var activator = target.Match(control);
Assert.False(target.Match(control).ImmediateResult);
}
开发者ID:Arlorean,项目名称:Perspex,代码行数:8,代码来源:SelectorTests_Name.cs
示例18: ColorMixerVIewModel
public ColorMixerVIewModel(Slider red, Slider green, Slider blue)
{
CurrentColor = "Click me";
selector = new Selector(red, green, blue);
clickMeCommand=new ClickMeCommand(selector);
selector.ColorChanged += selector_ColorChanged;
selector.CurrentColor += selector_CurrentColor;
}
开发者ID:denmerc,项目名称:Presentations,代码行数:8,代码来源:ColorMixerVIewModel.cs
示例19: Show
public static void Show (this IMTMBProgressHUD This, Selector method, NSObject target, NSObject aObject, bool animated)
{
if (method == null)
throw new ArgumentNullException ("method");
if (target == null)
throw new ArgumentNullException ("target");
ApiDefinition.Messaging.void_objc_msgSend_IntPtr_IntPtr_IntPtr_bool (This.Handle, Selector.GetHandle ("showWhileExecuting:onTarget:withObject:animated:"), method.Handle, target.Handle, aObject == null ? IntPtr.Zero : aObject.Handle, animated);
}
开发者ID:iamIcarus,项目名称:MBProgressHUD_Bindings,代码行数:8,代码来源:MTMBProgressHUD.g.cs
示例20: DisplayNameForKeyValue
/// <summary>
/// Mapping for displayNameForKey:value
/// </summary>
/// <remarks>As of writing, MonoTouch doesn't yet map this function. The following code was taken from
/// http://stackoverflow.com/questions/7577535/iphone-obtaining-a-list-of-countries-from-monotouch</remarks>
public static string DisplayNameForKeyValue(this NSLocale locale, string key, string value)
{
IntPtr handle = locale.Handle;
IntPtr selDisplayNameForKeyValue = new Selector ("displayNameForKey:value:").Handle;
NSString nsKey = new NSString(key);
NSString nsValue = new NSString(value);
return NSString.FromHandle (MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr (handle, selDisplayNameForKeyValue, nsKey.Handle, nsValue.Handle));
}
开发者ID:cwenham,项目名称:SpendingConsequences,代码行数:13,代码来源:CurrencyPickerModel.cs
注:本文中的Selector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论