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


C# ScheduledTask.GetType方法代码示例

本文整理汇总了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()));
                }
            }
        }
开发者ID:Hitchhikrr,项目名称:VOIP4WP7,代码行数:54,代码来源:ScheduledAgentImpl.cs

示例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()));
                }
            }
        }
开发者ID:jgabrams,项目名称:linphone-windows10,代码行数:41,代码来源:LinphoneScheduledAgent.cs

示例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()));
         }
     }
 }
开发者ID:andrey-utkin,项目名称:mediastreamer2,代码行数:24,代码来源:Mediastreamer2ScheduledAgent.cs

示例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()));
                }
            }
        }
开发者ID:Bootz,项目名称:VoIP_Project_Archives_Testing,代码行数:41,代码来源:ScheduledAgentImpl.cs


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