本文整理汇总了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)));
}
示例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);
}
}
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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());
}
示例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;
}
}
示例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();
}
示例10: PriorityFrame
public PriorityFrame(Priority priority, int streamId)
{
Contract.Assert(streamId != 0);
StreamId = streamId;
Priority = priority;
FrameType = FrameType.Priority;
}
示例11: Log
public void Log(string message, Category category, Priority priority)
{
if(category >= CurrentCategory)
{
EventAggregator.Value.Publish(new LoggingEvent(message, category, priority));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}