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


C# Priority类代码示例

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


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

示例1: Instance

        private static INetworkService Instance(Priority priority)
        {
            Func<HttpMessageHandler, INetworkService> createClient = messageHandler =>
            {
                // service registration
                var networkServiceSettings = new RefitSettings
                {
                    JsonSerializerSettings = new JsonSerializerSettings
                    {
                        NullValueHandling = NullValueHandling.Ignore,
                        Error = (sender, args) => Debug.WriteLine(args)
                    }
                };

                var client = new HttpClient(messageHandler)
                {
                    BaseAddress = new Uri("http://vmkrcmar21.informatik.tu-muenchen.de/wordpress/")
                };

                return RestService.For<INetworkService>(client, networkServiceSettings);
            };

            return
                new SafeNetworkService(
                    createClient(new RateLimitedHttpMessageHandler(new NativeMessageHandler(), priority)));
        }
开发者ID:Integreat,项目名称:app-cross_platform,代码行数:26,代码来源:IntegreatModule.cs

示例2: Log

        public void Log(string message, Category category, Priority priority)
        {
            lock (this)
            {
                Trace.WriteLine(message, category.ToString());
                var data = new LogMessage();
                data.Message = message;
                data.Category = category;
                data.Priority = priority;

                try
                {
                    if (!container.IsRegistered<LogViewer>()) throw new NotImplementedException();

                    var aggregator = container.Resolve<IEventAggregator>();
                    while (failedMessages.Any())
                    {
                        var item = failedMessages.Dequeue();
                        aggregator.GetEvent<LogEvent>().Publish(item);
                    }
                    aggregator.GetEvent<LogEvent>().Publish(data);
                }
                catch (Exception)
                {
                    failedMessages.Enqueue(data);
                }
            }
        }
开发者ID:winleaks,项目名称:AzureDNS,代码行数:28,代码来源:AppLogger.cs

示例3: Play

 public static void Play(string filename, Priority priority)
 {
     if (filename != null && filename != "")
     {
         SoundClip newSound;
         switch (priority)
         {
             case Priority.High:
                 newSound = new SoundClip(GameRef.Content, filename);
                 HighPrioritySounds.Add(newSound);
                 newSound.Play(volume, false);
                 break;
             case Priority.Normal:
                 if (NormalSounds.Count < MaxNormalSounds)
                 {
                     newSound = new SoundClip(GameRef.Content, filename);
                     NormalSounds.Add(newSound);
                     newSound.Play(volume, false);
                 }
                 break;
             case Priority.WindNoise:
                 newSound = new SoundClip(GameRef.Content, filename);
                 WindNoise = newSound;
                 newSound.Play(volume, true);
                 break;
         }
     }
     Update();
 }
开发者ID:AnyKey,项目名称:tojam4,代码行数:29,代码来源:SoundEffectEngine.cs

示例4: LogException

 public void LogException(string message, Exception exception, Priority priority)
 {
     _bootLogger.Log(String.Format("{0}|{1}: {2}",
                     FormatString(Category.Exception.ToString(), 9),
                    FormatString(priority.ToString(), 6),
                    message), exception);
 }
开发者ID:christal1980,项目名称:wingsoa,代码行数:7,代码来源:ServerBootLoggerAdapter.cs

示例5: Register

 /// <summary>
 /// Register this event
 /// </summary>
 /// <param name="method">This is the delegate that will get called when this event occurs</param>
 /// <param name="priority">The priority (imporantce) of this call</param>
 /// <param name="plugin">The plugin object that is registering the event</param>
 public static void Register(Group.GroupSave method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnGroupSaveEvent(method, priority, plugin));
     Organize();
 }
开发者ID:EricKilla,项目名称:MCForge-Vanilla,代码行数:13,代码来源:OnGroupSaveEvent.cs

示例6: Register

 /// <summary>
 /// Register this event
 /// </summary>
 /// <param name="method">This is the delegate that will get called when this event occurs</param>
 /// <param name="priority">The priority (imporantce) of this call</param>
 /// <param name="plugin">The plugin object that is registering the event</param>
 public static void Register(Server.OnConsoleCommand method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnConsoleCommandEvent(method, priority, plugin));
     Organize();
 }
开发者ID:PinEvil,项目名称:MCForge-Vanilla,代码行数:13,代码来源:OnConsoleCommandEvent.cs

示例7: Main

        static void Main(string[] args)
        {
            int i;
            SortedArr<double> srt1 = new
               SortedArr<double>(doubleIsGreater, doubleIsEqual);

            srt1.add(22.2);
            srt1.add(66.6);
            srt1.add(22.2);
            srt1.add(33.3);
            srt1.add(55.5);
            srt1.add(77.7);
            srt1.add(11.1);
            srt1.add(44.4);
            srt1.delete(55.5);

            Console.WriteLine("\nsrt1:");
            for (i = 0; i < srt1.N; i++)
                Console.WriteLine(srt1.Geti(i));

            Priority<int> pri1 = new Priority<int>(intIsGreater, intIsEqual);
            pri1.add(11);
            pri1.add(33);
            pri1.add(77);
            pri1.add(44);
            pri1.add(55);
            pri1.add(66);
            pri1.add(22);

            Console.WriteLine("\npri1:");
            while (pri1.N > 0)
                Console.WriteLine(pri1.removeMax());
        }
开发者ID:saharki,项目名称:OOPHW,代码行数:33,代码来源:Class1.cs

示例8: InsertElement

        public int InsertElement(int Index, int Minutes, Priority Priority)
        {
            Time UsableTime = Times.ElementAt(Index);

            //
            if ((int)UsableTime.Span.TotalMinutes == Minutes) {
                UsableTime.Priority = Priority;
                Times.RemoveAt(Index);
                Times.Insert(Index, UsableTime);
                return 0;
            }
            else if ((int)UsableTime.Span.TotalMinutes < Minutes) {
                Time NewTime1 = new Time();
                Time NewTime2 = new Time();

                NewTime2.Span = new TimeSpan(0, (int)UsableTime.Span.TotalMinutes - Minutes, 0);
                NewTime1.Span = new TimeSpan(0, (int)UsableTime.Span.TotalMinutes - (int)UsableTime.Span.TotalMinutes, 0);
                NewTime2.Priority = Priority.FREE;
                NewTime1.Priority = Priority;

                Times.RemoveAt(Index);
                Times.Insert(Index, NewTime1);
                Times.Insert(Index++, NewTime2);
                return 0;
            }
            else {
                UsableTime.Priority = Priority;
                Times.RemoveAt(Index);
                Times.Insert(Index, UsableTime);
                return Minutes - (int) UsableTime.Span.TotalMinutes;
            }
        }
开发者ID:Kratos-Athene,项目名称:WhatTodo,代码行数:32,代码来源:TimeList.cs

示例9: Register

 public static void Register(Player.OnSpritChange method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnPlayerSprintEvent(method, priority, plugin));
     Organize();
 }
开发者ID:Defuseninja,项目名称:ForgeCraft,代码行数:7,代码来源:OnPlayerSprintEvent.cs

示例10: PriorityFrame

 public PriorityFrame(Priority priority, int streamId)
 {
     Contract.Assert(streamId != 0);
     StreamId = streamId;
     Priority = priority;
     FrameType = FrameType.Priority;
 }
开发者ID:nunnun,项目名称:http2-katana,代码行数:7,代码来源:PriorityFrame.cs

示例11: Log

 public void Log(string message, Category category, Priority priority)
 {
     if(category >= CurrentCategory)
     {
         EventAggregator.Value.Publish(new LoggingEvent(message, category, priority));
     }
 }
开发者ID:BGCX262,项目名称:zxd-svn-to-git,代码行数:7,代码来源:EventLoggerFacade.cs

示例12: StatisticColumn

 private StatisticColumn(string columnName, Func<Statistics, double> calc, Priority priority, bool isTimeColumn = true)
 {
     this.calc = calc;
     this.priority = priority;
     this.isTimeColumn = isTimeColumn;
     ColumnName = columnName;
 }
开发者ID:alexandrnikitin,项目名称:BenchmarkDotNet,代码行数:7,代码来源:StatisticColumn.cs

示例13: GetRemoteConference

        public async Task<ConferenceDto> GetRemoteConference(Priority priority, string slug)
        {
            ConferenceDto conference = null;

            Task<ConferenceDto> getConferenceTask;
            switch (priority)
            {
                case Priority.Background:
                    getConferenceTask = _apiService.Background.GetConference(slug);
                    break;
                case Priority.UserInitiated:
                    getConferenceTask = _apiService.UserInitiated.GetConference(slug);
                    break;
                case Priority.Speculative:
                    getConferenceTask = _apiService.Speculative.GetConference(slug);
                    break;
                default:
                    getConferenceTask = _apiService.UserInitiated.GetConference(slug);
                    break;
            }

            if (CrossConnectivity.Current.IsConnected)
            {
                conference = await Policy
                    .Handle<Exception>()
                    .RetryAsync(retryCount: 5)
                    .ExecuteAsync(async () => await getConferenceTask);
            }

            return conference;
        }
开发者ID:laxmikantmishra,项目名称:ResilientServices,代码行数:31,代码来源:ConferencesService.cs

示例14: GetRemoteConferencesAsync

 private async Task<List<ConferenceDto>> GetRemoteConferencesAsync(Priority priority)
 {
     List<ConferenceDto> conferences = null;
     Task<List<ConferenceDto>> getConferencesTask;
     switch (priority)
     {
         case Priority.Background:
             getConferencesTask = _apiService.Background.GetConferences();
             break;
         case Priority.UserInitiated:
             getConferencesTask = _apiService.UserInitiated.GetConferences();
             break;
         case Priority.Speculative:
             getConferencesTask = _apiService.Speculative.GetConferences();
             break;
         default:
             getConferencesTask = _apiService.UserInitiated.GetConferences();
             break;
     }
     
     if (CrossConnectivity.Current.IsConnected)
     {
         conferences = await Policy
               .Handle<WebException>()
               .WaitAndRetry
               (
                 retryCount:5, 
                 sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
               )
               .ExecuteAsync(async () => await getConferencesTask);
     }
     return conferences;
 }
开发者ID:laxmikantmishra,项目名称:ResilientServices,代码行数:33,代码来源:ConferencesService.cs

示例15: GetRemoteEventsAsync

        public async Task<List<Event>> GetRemoteEventsAsync (Priority priority)
        {
            List<Event> events = new List<Event> ();
            Task<List<Event>> getEventsTask;

            switch (priority) {
            case Priority.Background:
                getEventsTask = _apiService.Background.GetEvents (ApiService.Device);
                break;
            case Priority.UserInitiated:
                getEventsTask = _apiService.UserInitiated.GetEvents (ApiService.Device);
                break;
            case Priority.Speculative:
                getEventsTask = _apiService.Speculative.GetEvents (ApiService.Device);
                break;
            default:
                getEventsTask = _apiService.Background.GetEvents (ApiService.Device);
                break;
            }

            if (CrossConnectivity.Current.IsConnected)
            {
                events = await Policy
                    .Handle<WebException> ()
                    .WaitAndRetryAsync (5, retryAttempt => TimeSpan.FromSeconds (Math.Pow (2, retryAttempt)))
                    .ExecuteAsync (async () => await getEventsTask);
            }

            return events;
        }
开发者ID:dbeattie71,项目名称:HDP-Mobil,代码行数:30,代码来源:EventsService.cs


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