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


C# CounterType类代码示例

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


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


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