本文整理汇总了C#中ScheduledTask.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ScheduledTask.GetType方法的具体用法?C# ScheduledTask.GetType怎么用?C# ScheduledTask.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScheduledTask
的用法示例。
在下文中一共展示了ScheduledTask.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInvoke
/// <summary>
/// Agent that runs a scheduled task
/// </summary>
protected override void OnInvoke(ScheduledTask task)
{
Debug.WriteLine("[ScheduledAgentImpl] ScheduledAgentImpl has been invoked with argument of type {0}.", task.GetType());
// Indicate that an agent has started running
AgentHost.OnAgentStarted();
VoipHttpIncomingCallTask incomingCallTask = task as VoipHttpIncomingCallTask;
if (incomingCallTask != null)
{
this.isIncomingCallAgent = true;
// Parse the the incoming push notification payload
Notification pushNotification;
using (MemoryStream ms = new MemoryStream(incomingCallTask.MessageBody))
{
XmlSerializer xs = new XmlSerializer(typeof(Notification));
pushNotification = (Notification)xs.Deserialize(ms);
}
Debug.WriteLine("[{0}] Incoming call from caller {1}, number {2}", ScheduledAgentImpl.incomingCallAgentId, pushNotification.Name, pushNotification.Number);
// Initiate incoming call processing
// If you want to pass in additional information such as pushNotification.Number, you can
bool incomingCallProcessingStarted = BackEnd.Globals.Instance.CallController.OnIncomingCallReceived(pushNotification.Name, pushNotification.Number, this.OnIncomingCallDialogDismissed);
if (!incomingCallProcessingStarted)
{
// For some reasons, the incoming call processing was not started.
// There is nothing more to do.
this.Complete();
return;
}
}
else
{
VoipKeepAliveTask keepAliveTask = task as VoipKeepAliveTask;
if (keepAliveTask != null)
{
this.isIncomingCallAgent = false;
// Refresh tokens, get new certs from server, etc.
BackEnd.Globals.Instance.DoPeriodicKeepAlive();
this.Complete();
}
else
{
throw new InvalidOperationException(string.Format("Unknown scheduled task type {0}", task.GetType()));
}
}
}
示例2: OnInvoke
protected override void OnInvoke(ScheduledTask task)
{
Debug.WriteLine("[LinphoneScheduledAgent] ScheduledAgentImpl has been invoked with argument of type {0}.", task.GetType());
AgentHost.OnAgentStarted();
VoipHttpIncomingCallTask incomingCallTask = task as VoipHttpIncomingCallTask;
if (incomingCallTask != null)
{
this.isIncomingCallAgent = true;
Debug.WriteLine("[IncomingCallAgent] Received VoIP Incoming Call task");
BackgroundManager.Instance.OopServer.CallController.IncomingCallViewDismissed = OnIncomingCallDialogDismissed;
BackgroundManager.Instance.InitLinphoneCore();
}
else
{
VoipKeepAliveTask keepAliveTask = task as VoipKeepAliveTask;
if (keepAliveTask != null)
{
this.isIncomingCallAgent = false;
Debug.WriteLine("[KeepAliveAgent] Keep Alive task");
if (DeviceNetworkInformation.IsNetworkAvailable)
{
var server = BackgroundManager.Instance.OopServer;
InitManager.CreateLinphoneCore(server, this, OutputTraceLevel.Message);
server.LinphoneCore.NetworkReachable = true;
server.LinphoneCore.IterateEnabled = true;
Debug.WriteLine("[KeepAliveAgent] Linphone Core created");
}
else
{
Debug.WriteLine("[KeepAliveAgent] Not connected, can't refresh register");
base.NotifyComplete();
}
}
else
{
throw new InvalidOperationException(string.Format("Unknown scheduled task type {0}", task.GetType()));
}
}
}
示例3: OnInvoke
protected override void OnInvoke(ScheduledTask task)
{
Debug.WriteLine("[Mediastreamer2ScheduledAgent] ScheduledAgentImpl has been invoked with argument of type {0}.", task.GetType());
VoipHttpIncomingCallTask incomingCallTask = task as VoipHttpIncomingCallTask;
if (incomingCallTask != null)
{
this.isIncomingCallAgent = true;
Debug.WriteLine("[IncomingCallAgent] Received VoIP Incoming Call task");
}
else
{
VoipKeepAliveTask keepAliveTask = task as VoipKeepAliveTask;
if (keepAliveTask != null)
{
this.isIncomingCallAgent = false;
Debug.WriteLine("[KeepAliveAgent] Keep Alive task");
base.NotifyComplete();
}
else
{
throw new InvalidOperationException(string.Format("Unknown scheduled task type {0}", task.GetType()));
}
}
}
示例4: OnInvoke
/// <summary>
/// Agent that runs a scheduled task
/// </summary>
protected override void OnInvoke(ScheduledTask task)
{
var incomingCallTask = task as VoipHttpIncomingCallTask;
if (incomingCallTask != null)
{
// Parse the the incoming push notification payload
IncomingCallInfo pushNotification;
using (var ms = new MemoryStream(incomingCallTask.MessageBody))
{
var xs = new XmlSerializer(typeof(IncomingCallInfo));
pushNotification = (IncomingCallInfo)xs.Deserialize(ms);
}
String defaultContactImageUri = Package.Current.InstalledLocation.Path + @"\Assets\DefaultContactImage.jpg";
String logoUrl = Package.Current.InstalledLocation.Path + @"\Assets\ApplicationIcon.png";
VoipPhoneCall callObj;
var callCoordinator = VoipCallCoordinator.GetDefault();
callCoordinator.RequestNewIncomingCall("/Views/SplashScreenPage.xaml?incomingCall=" + pushNotification.Number,
pushNotification.Name, pushNotification.Number, new Uri(defaultContactImageUri),
"VoipTranslator.Client.WinPhone", new Uri(defaultContactImageUri), "VoIP Translator", new Uri(logoUrl), VoipCallMedia.Audio,
TimeSpan.FromMinutes(5), out callObj);
callObj.AnswerRequested += callObj_AnswerRequested;
callObj.RejectRequested += callObj_RejectRequested;
}
else
{
var keepAliveTask = task as VoipKeepAliveTask;
if (keepAliveTask != null)
{
this.Complete();
}
else
{
throw new InvalidOperationException(string.Format("Unknown scheduled task type {0}", task.GetType()));
}
}
}