• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CounterType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



CounterType类属于命名空间,在下文中一共展示了CounterType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ButtonToggler

        /// <summary>
        ///		Create a new <see cref="ButtonToggler"/> actor.
        /// </summary>
        /// <param name="performanceCountersController">
        ///		The actor that controls the <see cref="PerformanceCounterMonitor"/>s for various performance counters.
        /// </param>
        /// <param name="button">
        ///		The button controlled by the <see cref="ButtonToggler"/>.
        /// </param>
        /// <param name="counterType">
        ///		The type of performance counter represented by the button.
        /// </param>
        /// <param name="isToggled">
        ///		Is the button currently toggled ("On")?
        /// </param>
        public ButtonToggler(IActorRef performanceCountersController, Button button, CounterType counterType, bool isToggled = false)
        {
            if (performanceCountersController == null)
                throw new ArgumentNullException("performanceCountersController");

            if (button == null)
                throw new ArgumentNullException("button");

            if (counterType == CounterType.Unknown)
                throw new ArgumentOutOfRangeException(nameof(counterType), counterType, "Invalid performance counter type.");

            _performanceCountersController = performanceCountersController;
            _button = button;
            _counterType = counterType;
            _isToggled = isToggled;

            Receive<Toggle>(_ =>
            {
                if (Flip())
                {
                    _performanceCountersController.Tell(
                        new WatchCounterValue(_counterType)
                    );
                }
                else
                {
                    _performanceCountersController.Tell(
                        new UnwatchCounterValue(_counterType)
                    );
                }
            });
        }
开发者ID:tintoy,项目名称:akkadotnet-bootcamp-unit2,代码行数:47,代码来源:ButtonToggler.cs


示例2: AddCounter

 public void AddCounter(int counterId, CounterType counterType)
 {
     if (this.m_provider == null)
     {
         throw new InvalidOperationException(System.SR.GetString("Perflib_InvalidOperation_NoActiveProvider", new object[] { this.m_providerGuid }));
     }
     if (!PerfProviderCollection.ValidateCounterType(counterType))
     {
         throw new ArgumentException(System.SR.GetString("Perflib_Argument_InvalidCounterType", new object[] { counterType }), "counterType");
     }
     if (this.m_instanceCreated)
     {
         throw new InvalidOperationException(System.SR.GetString("Perflib_InvalidOperation_AddCounterAfterInstance", new object[] { this.m_counterSet }));
     }
     lock (this.m_lockObject)
     {
         if (this.m_instanceCreated)
         {
             throw new InvalidOperationException(System.SR.GetString("Perflib_InvalidOperation_AddCounterAfterInstance", new object[] { this.m_counterSet }));
         }
         if (this.m_idToCounter.ContainsKey(counterId))
         {
             throw new ArgumentException(System.SR.GetString("Perflib_Argument_CounterAlreadyExists", new object[] { counterId, this.m_counterSet }), "CounterId");
         }
         this.m_idToCounter.Add(counterId, counterType);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:27,代码来源:CounterSet.cs


示例3: WatchCounterValue

        /// <summary>
        ///		Create a new <see cref="WatchCounterValue"/> request message.
        /// </summary>
        /// <param name="counterType">
        ///		The type of target counter.
        /// </param>
        public WatchCounterValue(CounterType counterType)
        {
            if (counterType == CounterType.Unknown)
                throw new ArgumentOutOfRangeException(nameof(counterType), counterType, "Invalid performance counter type.");

            CounterType = counterType;
        }
开发者ID:tintoy,项目名称:akkadotnet-bootcamp-unit2,代码行数:13,代码来源:WatchCounterValue.cs


示例4: TimeCondition

 internal TimeCondition(ValueType valueType, CounterType counter, uint value, DayOfWeek dayOfWeek)
 {
     ValueType = valueType;
     CounterType = counter;
     Value = value;
     DayOfWeek = dayOfWeek;
 }
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:7,代码来源:TimeCondition.cs


示例5: ButtonToggleActor

 public ButtonToggleActor(IActorRef coordinator, Button myButton, CounterType myCounterType, bool isToggledOn = false)
 {
     this.coordinatorActor = coordinator;
     this.myButton = myButton;
     this.myCounterType = myCounterType;
     this.isToggledOn = isToggledOn;
 }
开发者ID:toff63,项目名称:akka-bootcamp,代码行数:7,代码来源:ButtonToggleActor.cs


示例6: ButtonToggleActor

 public ButtonToggleActor(IActorRef coordinatorActor, Button myButton, CounterType myCounterType, bool isToggledOn = false)
 {
     _coordinatorActor = coordinatorActor;
     _myButton = myButton;
     _isToggledOn = isToggledOn;
     _myCounterType = myCounterType;
 }
开发者ID:EthanSteiner,项目名称:akka-bootcamp,代码行数:7,代码来源:ButtonToggleActor.cs


示例7: SubscribePerformanceCounter

        /// <summary>
        ///		Create a new <see cref="SubscribePerformanceCounter"/> request message.
        /// </summary>
        /// <param name="counter">
        ///		The type of performance counter to subscribe to.
        /// </param>
        /// <param name="subscriber">
        ///		The actor to which notifications should be sent.
        /// </param>
        public SubscribePerformanceCounter(CounterType counter, IActorRef subscriber)
        {
            if (counter == CounterType.Unknown)
                throw new ArgumentOutOfRangeException(nameof(counter), counter, "Invalid performance counter type.");

            if (subscriber == null)
                throw new ArgumentNullException(nameof(subscriber));

            Counter = counter;
            Subscriber = subscriber;
        }
开发者ID:tintoy,项目名称:akkadotnet-bootcamp-unit2,代码行数:20,代码来源:SubscribePerformanceCounter.cs


示例8: Remove

        public void Remove(CounterType counterType, int? count = null)
        {
            var counters = _counters.Where(x => x.Type == counterType);

              if (count != null)
              {
            counters = counters.Take(count.Value);
              }

              foreach (var counter in counters.ToArray())
              {
            Remove(counter);
              }
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:14,代码来源:Counters.cs


示例9: Increment

        public int Increment(int itemId, int contextItemId, CounterType type = CounterType.Visits, CounterStoreType store = CounterStoreType.Database) {
            string key = String.Format("{0}.{1}.{2}", itemId, contextItemId, type);
            object counterLock = _locks.GetOrAdd(key, new object());
            lock (counterLock) {
                int counts = 0;
                switch (store) {
                    case CounterStoreType.Database:
                        CounterRecord counter = _repo.Value.Get(r => r.ForItemId == itemId &&
                                                                     r.InContextOfItemId == contextItemId &&
                                                                     r.Type == type);

                        if (counter == null) {
                            counter = new CounterRecord {
                                ForItemId = itemId,
                                InContextOfItemId = contextItemId,
                                Type = type,
                                Count = 0,
                                LastModified = DateTime.Now
                            };
                            _repo.Value.Create(counter);
                            _repo.Value.Flush();
                        }

                        counts = ++counter.Count;
                        counter.LastModified = DateTime.Now;
                        _repo.Value.Flush();
                        break;
                    case CounterStoreType.Session:
                        if (_context.Current() != null && _context.Current().Session != null) {
                            // ReSharper disable PossibleNullReferenceException
                            var dict = _context.Current().Session[SessionKey] as ConcurrentDictionary<string, SerializableCounter>;
                            // ReSharper restore PossibleNullReferenceException
                            SerializableCounter sessionCounter = dict.GetOrAdd(key, new SerializableCounter {
                                ForItemId = itemId,
                                InContextOfItemId = contextItemId,
                                Type = type,
                                Count = 0
                            });
                            counts = ++sessionCounter.Count;
                        }
                        break;
                    default:
                        break;
                }
                return counts;
            }
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:47,代码来源:CounterService.cs


示例10: Clicked

 public static void Clicked(CounterType type)
 {
     switch (type)
     {
         case CounterType.Happy:
             happyClicks++;
             break;
         case CounterType.Sad:
             sadClicks++;
             if (sadClicks >= 4)
             {
                 sadClicks = 0;
                 GetHappier();
             }
             break;
         default:
             break;
     }
 }
开发者ID:nanexcool,项目名称:ld29,代码行数:19,代码来源:Util.cs


示例11: ButtonToggleActor

        public ButtonToggleActor(IActorRef coordinatorActor, Button myButton, CounterType myCounterType, bool isToggledOn = false)
        {
            if (coordinatorActor == null)
            {
                throw new ArgumentNullException(nameof(coordinatorActor));
            }
            if (myButton == null)
            {
                throw new ArgumentNullException(nameof(myButton));
            }
            if (!Enum.IsDefined(typeof (CounterType), myCounterType))
            {
                throw new ArgumentOutOfRangeException(nameof(myCounterType));
            }

            _coordinatorActor = coordinatorActor;
            _myButton = myButton;
            _isToggledOn = isToggledOn;
            _myCounterType = myCounterType;
        }
开发者ID:jdarsie,项目名称:akka-bootcamp,代码行数:20,代码来源:ButtonToggleActor.cs


示例12: OnTriggerEnter

 void OnTriggerEnter(Collider collider)
 {
     switch (collider.tag)
     {
         case "PerfectCounter":
             counterType = CounterType.PerfectCounter;
             break;
         case "GoodCounter":
             counterType = CounterType.GoodCounter;
             break;
         case "OkayCounter":
             counterType = CounterType.OkayCounter;
             break;
         case "Player":
             scoreManager.ManageChallenge("down");
             missSound.Play();
             battle.ResetPostions();
             break;
     }
 }
开发者ID:Orthak,项目名称:CounterPoint,代码行数:20,代码来源:Counter.cs


示例13: Main

        static void Main(string[] args)
        {
           _serverProcId = "IPCTestServer";
           if (args.Any())
              _counterType = (CounterType) int.Parse(args[0]);
               else
            _counterType = CounterType.CPU;

            if(args.Length == 3)
                _counterType |= (CounterType)int.Parse(args[2]);
            ManualResetEvent resetEvent = new ManualResetEvent(false);

            _IPCClientThread = new Thread(ClientThreadLoop);
            _IPCClientThread.Start(resetEvent);



            Console.ReadLine();
            resetEvent.Set();
        }
开发者ID:Code-Codex,项目名称:Codex.IPC,代码行数:20,代码来源:Program.cs


示例14: IncrementCounter

		static public void IncrementCounter (CounterType which)
		{
			++counters [(int) which];
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:4,代码来源:report.cs


示例15: UnsubscribeCounter

 public UnsubscribeCounter(CounterType counter, IActorRef subscriber)
 {
     Subscriber = subscriber;
     Counter = counter;
 }
开发者ID:patchandthat,项目名称:AkkaBootcamp,代码行数:5,代码来源:ChartingMessages.cs


示例16: CreateWeekCondition

 public static YearCondition CreateWeekCondition(byte weeks, DayOfWeek dayOfWeek, CounterType type, ushort year)
 {
     return new YearCondition(ValueType.Week, weeks, dayOfWeek, type, year);
 }
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:4,代码来源:YearCondition.cs


示例17: RemoveCounter

        public void RemoveCounter(int itemId, int contextItemId, CounterType type, CounterStoreType store) {
            string key = String.Format("{0}.{1}.{2}", itemId, contextItemId, type);
            object counterLock = _locks.GetOrAdd(key, new object());
            lock (counterLock) {
                switch (store) {
                    case CounterStoreType.Database:

                        CounterRecord counter = _repo.Value.Get(r => r.ForItemId == itemId &&
                                                                     r.InContextOfItemId == contextItemId &&
                                                                     r.Type == type);

                        if (counter != null) {
                            _repo.Value.Delete(counter);
                            _repo.Value.Flush();
                        }


                        break;
                    case CounterStoreType.Session:
                        if (_context.Current() != null) {
                            // ReSharper disable PossibleNullReferenceException
                            var dict = _context.Current().Session[SessionKey] as ConcurrentDictionary<string, SerializableCounter>;
                            // ReSharper restore PossibleNullReferenceException
                            SerializableCounter c;
                            if (dict != null) {
                                dict.TryRemove(key, out c);
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:34,代码来源:CounterService.cs


示例18: GetCounter

        public int GetCounter(int itemId, int contextItemId, CounterType type, CounterStoreType store) {
            int counts = 0;
            switch (store) {
                case CounterStoreType.Database:

                    CounterRecord counter = _repo.Value.Get(r => r.ForItemId == itemId &&
                                                                 r.InContextOfItemId == contextItemId &&
                                                                 r.Type == type);

                    counts = counter == null ? 0 : counter.Count;
                    break;
                case CounterStoreType.Session:
                    if (_context.Current() != null) {
                        string key = String.Format("{0}.{1}.{2}", itemId, contextItemId, type);
                        // ReSharper disable PossibleNullReferenceException
                        var dict = _context.Current().Session[SessionKey] as ConcurrentDictionary<string, SerializableCounter>;
                        // ReSharper restore PossibleNullReferenceException
                        SerializableCounter c;
                        counts = dict.TryGetValue(key, out c) ? c.Count : 0;
                    }
                    break;
                default:
                    break;
            }
            return counts;
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:26,代码来源:CounterService.cs


示例19: Unwatch

 public Unwatch(CounterType counter)
 {
     Counter = counter;
 }
开发者ID:ymccready,项目名称:akka-bootcamp,代码行数:4,代码来源:PerformanceCounterCoordinatorActor.cs


示例20: CounterInfo

 /// <summary>
 /// Constructor
 /// </summary>
 public CounterInfo(int id, CounterType type, string name)
 {
     Id = id;
     Type = type;
     Name = name;
 }
开发者ID:40a,项目名称:PowerShell,代码行数:9,代码来源:CounterSetRegistrarBase.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Country类代码示例发布时间:2022-05-24
下一篇:
C# Counter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap