当前位置: 首页>>代码示例>>C#>>正文


C# Selector类代码示例

本文整理汇总了C#中Selector的典型用法代码示例。如果您正苦于以下问题:C# Selector类的具体用法?C# Selector怎么用?C# Selector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Selector类属于命名空间,在下文中一共展示了Selector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Selector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。