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


C# HttpNotificationChannel.BindToShellTile方法代码示例

本文整理汇总了C#中HttpNotificationChannel.BindToShellTile方法的典型用法代码示例。如果您正苦于以下问题:C# HttpNotificationChannel.BindToShellTile方法的具体用法?C# HttpNotificationChannel.BindToShellTile怎么用?C# HttpNotificationChannel.BindToShellTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpNotificationChannel的用法示例。


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

示例1: CreateNewChannel

 private HttpNotificationChannel CreateNewChannel()
 {
     var channel = HttpNotificationChannel.Find(AppContext.State.AppId);
     if (channel == null)
     {
         channel = new HttpNotificationChannel(AppContext.State.AppId);
         SubscribeToEvents(channel);
         // Open the channel
         channel.Open();
         UpdateChannelUri(channel.ChannelUri);
         // Register for tile notifications
         var whitelistedDomains = AppContext.State.Settings.PushSettings.WhitelistedDomains;
         if (whitelistedDomains.Count == 0)
             channel.BindToShellTile();
         else
             channel.BindToShellTile(new Collection<Uri>(whitelistedDomains));
         // Register for shell notifications
         channel.BindToShellToast();
     }
     else
     {
         SubscribeToEvents(channel);
         UpdateChannelUri(channel.ChannelUri);
     }
     return channel;
 }
开发者ID:appacitive,项目名称:appacitive-dotnet-sdk,代码行数:26,代码来源:SingletonPushChannel.cs

示例2: Register

		public static HttpNotificationChannel Register(string channelName, 
			Collection<Uri> baseUris, bool bindToShellTile, bool bindToShellToast, 
			EventHandler<NotificationChannelErrorEventArgs> errorHandler, 
			Action<HttpNotificationChannel, bool> completed)
		{
			try
			{
				var channel = HttpNotificationChannel.Find(channelName);
				if (channel == null)
				{
					channel = new HttpNotificationChannel(channelName);
					channel.ChannelUriUpdated += (s, e) =>
					{
						if (!channel.IsShellTileBound && bindToShellTile)
						{
							if (baseUris != null)
								channel.BindToShellTile(baseUris);
							else
								channel.BindToShellTile();
						}

						if (!channel.IsShellToastBound && bindToShellToast)
							channel.BindToShellToast();

						completed(channel, true);
					};
					channel.ErrorOccurred += (sender, args) => completed(null, false);

					if (errorHandler != null)
						channel.ErrorOccurred += errorHandler;

					channel.Open();
				}
				else
				{
					if (errorHandler != null)
					{
						channel.ErrorOccurred -= errorHandler;
						channel.ErrorOccurred += errorHandler;
					}

					completed(channel, false);
				}
				return channel;
			}
			catch (Exception ex)
			{
				if (Debugger.IsAttached)
					Debugger.Break();

				completed(null, false);
				return null; 
			}
		}
开发者ID:RareNCool,项目名称:MyToolkit,代码行数:54,代码来源:PushNotifications.cs

示例3: ApplyTo

    internal void ApplyTo( HttpNotificationChannel httpNotificationChannel )
    {
      if( IsBindedToShellTile != null )
        if( IsBindedToShellTile.Value )
        {
          if( !httpNotificationChannel.IsShellTileBound )
            httpNotificationChannel.BindToShellTile();
        }
        else
        {
          if( httpNotificationChannel.IsShellTileBound )
            httpNotificationChannel.UnbindToShellTile();
        }

      if( IsBindedToShellToast != null )
        if( IsBindedToShellToast.Value )
        {
          if( !httpNotificationChannel.IsShellToastBound )
            httpNotificationChannel.BindToShellToast();
        }
        else
        {
          if( httpNotificationChannel.IsShellToastBound )
            httpNotificationChannel.UnbindToShellToast();
        }

      if( OnHttpNotificationReceived != null )
        httpNotificationChannel.HttpNotificationReceived += OnHttpNotificationReceived;

      if( OnShellToastNotificationReceived != null )
        httpNotificationChannel.ShellToastNotificationReceived += OnShellToastNotificationReceived;
    }
开发者ID:Georotzen,项目名称:.NET-SDK-1,代码行数:32,代码来源:PushNotificationsBinding.cs

示例4: RegisterPushNotifications

        public void RegisterPushNotifications()
        {
            if (pushChannel != null) return;

            pushChannel = HttpNotificationChannel.Find(channelName);

            // If the channel was not found, then create a new connection to the push service.
            if (pushChannel == null) {
                pushChannel = new HttpNotificationChannel(channelName, "PositiveSSL CA");

                // Register for all the events before attempting to open the channel.
                pushChannel.ChannelUriUpdated += PushChannel_ChannelUriUpdated;
                pushChannel.ErrorOccurred += PushChannel_ErrorOccurred;
                pushChannel.HttpNotificationReceived += PushChannel_HttpNotificationReceived;

                pushChannel.Open();
                pushChannel.BindToShellToast();
                pushChannel.BindToShellTile();
            } else {
                // The channel was already open, so just register for all the events.
                pushChannel.ChannelUriUpdated += PushChannel_ChannelUriUpdated;
                pushChannel.ErrorOccurred += PushChannel_ErrorOccurred;
                pushChannel.HttpNotificationReceived += PushChannel_HttpNotificationReceived;
            }

            if (UriUpdated != null && pushChannel.ChannelUri != null) {
                UriUpdated(pushChannel.ChannelUri.ToString());
            }
        }
开发者ID:allanfreitas,项目名称:gtalkchat,代码行数:29,代码来源:PushHelper.cs

示例5: XPushNotificationHelper

        public XPushNotificationHelper()
        {
            /// Holds the push channel that is created or found.
            HttpNotificationChannel pushChannel;

            // The name of our push channel.
            string channelName = XDocument.Load("WMAppManifest.xml").Root.Element("App").Attribute("ProductID").Value;

            // Try to find the push channel.
            pushChannel = HttpNotificationChannel.Find(channelName);

            // If the channel was not found, then create a new connection to the push service.
            if (pushChannel == null)
            {
                pushChannel = new HttpNotificationChannel(channelName);

                // Register for all the events before attempting to open the channel.
                pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

                // Register for this notification only if you need to receive the notifications while your application is running.
                pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
                pushChannel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(PushChannel_HttpNotificationReceived);
                pushChannel.Open();

                //Raw push only work on app running

                // Bind this new channel for toast events.
                //Toast push is work app is running or background!
                pushChannel.BindToShellToast();
                // Bind this new channel for tile events.
                //Tile push is work background or died!
                pushChannel.BindToShellTile();

            }
            else
            {
                // The channel was already open, so just register for all the events.
                pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

                // Register for this notification only if you need to receive the notifications while your application is running.
                pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
                pushChannel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(PushChannel_HttpNotificationReceived);

                if (null == pushChannel.ChannelUri)
                    return;

                // Display the URI for testing purposes. Normally, the URI would be passed back to your web service at this point.
                XLog.WriteInfo("push channel URI is : " + pushChannel.ChannelUri.ToString());
                //保存 Uri,由push扩展获取发送到js端
                IsolatedStorageSettings userSettings = IsolatedStorageSettings.ApplicationSettings;
                userSettings[XConstant.PUSH_NOTIFICATION_URI] = pushChannel.ChannelUri.ToString();
                userSettings.Save();
            }
        }
开发者ID:polyvi,项目名称:xface-extension-push,代码行数:56,代码来源:XPushNotificationHelper.cs

示例6: UpdateLiveTile

        public void UpdateLiveTile(Uri liveTileUri, string liveTileTitle, int? liveTileCount, Action onComplete)
        {
            HttpNotificationChannel toastChannel = HttpNotificationChannel.Find("liveTileChannel");
            if (toastChannel != null)
            {
                toastChannel.Close();
            }

            toastChannel = new HttpNotificationChannel("liveTileChannel");


            toastChannel.ChannelUriUpdated +=
                (s, e) =>
                {
                    Debug.WriteLine(String.Format("Is image an absolute Uri: {0}", tileSchedule.RemoteImageUri.IsAbsoluteUri));
                    if (liveTileUri.IsAbsoluteUri)
                    {
                        toastChannel.BindToShellTile(new Collection<Uri> { liveTileUri });
                    }
                    else
                    {
                        toastChannel.BindToShellTile();
                    }

                    SendTileToPhone(e.ChannelUri, liveTileUri.ToString(), liveTileCount, liveTileTitle,
                                () =>
                                {
                                    //Give it some time to let the update propagate
                                    Thread.Sleep(TimeSpan.FromSeconds(10));

                                    toastChannel.UnbindToShellTile();
                                    toastChannel.Close();

                                    //Call the "complete" delegate
                                    if (onComplete != null)
                                        onComplete();
                                }
                        );
                };
            toastChannel.Open();
        }
开发者ID:awayo,项目名称:AUWP7,代码行数:41,代码来源:InstantLiveTileUpdateHelper.cs

示例7: init

        public void init(string argsString)
        {
            Options options;
            try
            {
                options = JsonConvert.DeserializeObject<Options>(JsonConvert.DeserializeObject<string[]>(argsString)[0]);
            }
            catch (Exception)
            {
                this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
                return;
            }

            // Prevent double initialization.
            if (this.currentChannel != null)
            {
                this.DispatchCommandResult(new PluginResult(PluginResult.Status.INVALID_ACTION, ALREADY_INITIALIZED_ERROR));
            }

            // Create or retrieve the notification channel.
            var channel = HttpNotificationChannel.Find(options.WP8.ChannelName);
            if (channel == null)
            {
                channel = new HttpNotificationChannel(options.WP8.ChannelName);
                SubscribeChannelEvents(channel);

                try
                {
                    channel.Open();
                }
                catch (InvalidOperationException)
                {
                    UnsubscribeChannelEvents(channel);
                    this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, INVALID_REGISTRATION_ERROR));
                    return;
                }

                channel.BindToShellToast();
                channel.BindToShellTile();
            }
            else
            {
                SubscribeChannelEvents(channel);
            }
            this.currentChannel = channel;
            this.lastChannelUri = null;
            this.callbackId = CurrentCommandCallbackId;

            // First attempt at notifying the URL (most of the times it won't notify anything)
            NotifyRegitrationIfNeeded();
        }
开发者ID:webratio,项目名称:phonegap-plugin-push,代码行数:51,代码来源:PushPlugin.cs

示例8: abrirCanalMPNS

        private void abrirCanalMPNS() 
        {
            uriChannel = HttpNotificationChannel.Find(vNombreCanal);
            if (uriChannel == null) 
            {
                uriChannel = new HttpNotificationChannel(vNombreCanal);
                uriChannel.Open();
                uriChannel.BindToShellToast();
                uriChannel.BindToShellTile();
            }

            uriChannel.ChannelUriUpdated += uriChannel_ChannelUriUpdated;
            uriChannel.ErrorOccurred += uriChannel_ErrorOccurred;
        }
开发者ID:CharlsOliver,项目名称:Windows-Phone-Intermedio,代码行数:14,代码来源:pRegistro.xaml.cs

示例9: Button_Click_1

 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     httpChannel = HttpNotificationChannel.Find(channelName);
     //如果存在就删除
     if (httpChannel != null)
     {
         httpChannel.Close();
         httpChannel.Dispose();
     }
     httpChannel = new HttpNotificationChannel(channelName, "NotificationServer");
     httpChannel.ChannelUriUpdated += httpChannel_ChannelUriUpdated;
     httpChannel.ShellToastNotificationReceived += httpChannel_ShellToastNotificationReceived;
     httpChannel.HttpNotificationReceived += httpChannel_HttpNotificationReceived;
     httpChannel.ErrorOccurred += httpChannel_ErrorOccurred;
     httpChannel.Open();
     httpChannel.BindToShellToast();
     httpChannel.BindToShellTile();
 }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:18,代码来源:MainPage.xaml.cs

示例10: OpenNotificationChannel

 public void OpenNotificationChannel()
 {
     FindNotificationChannel();
     if (!(bool)Settings.AllowPushNotifications) {
         if (Channel != null) Channel.Close();
         return;
     }
     if (Channel == null)
     {
         Channel = new HttpNotificationChannel(ChannelName);
         Channel.Open();
         Channel.BindToShellToast();
         Channel.BindToShellTile();
     }
     Channel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(HttpChannelChannelUriUpdated);
     Channel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(HttpChannelHttpNotificationReceived);
     Channel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(HttpChannelErrorOccurred);
     Channel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(HttpChannelToastNotificationReceived);
     Channel.ConnectionStatusChanged += new EventHandler<NotificationChannelConnectionEventArgs>(HttpChannelConnectionStatusChanged);
 }
开发者ID:timfel,项目名称:meet4xmas,代码行数:20,代码来源:PushNotifications.cs

示例11: MainPage

        // Constructor
        public MainPage()
        {
            /// Holds the push channel that is created or found.
            HttpNotificationChannel pushChannel;

            // The name of our push channel.
            string channelName = "MyPushChannel";

            InitializeComponent();

            // Try to find the push channel.
            pushChannel = HttpNotificationChannel.Find(channelName);

            // If the channel was not found, then create a new connection to the push service.
            if (pushChannel == null)
            {
                pushChannel = new HttpNotificationChannel(channelName);

                // Register for all the events before attempting to open the channel.
                pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

                pushChannel.Open();

                // Bind this new channel for Tile events.
                pushChannel.BindToShellTile();

            }
            else
            {
                // The channel was already open, so just register for all the events.
                pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

                // Display the URI for testing purposes. Normally, the URI would be passed back to your web service at this point.
                System.Diagnostics.Debug.WriteLine(pushChannel.ChannelUri.ToString());
                MessageBox.Show(String.Format("Channel Uri is {0}",
                    pushChannel.ChannelUri.ToString()));

            }
        }
开发者ID:JohnHildebrant,项目名称:TileNotificationClient,代码行数:42,代码来源:MainPage.xaml.cs

示例12: CreatePushChannel

        /// <summary>
        /// 
        /// </summary>
        /// <param name="channelName"></param>
        /// <param name="registrationCallBack">Registration Callback with parameter </param>
        /// <param name="messageCallback"></param>
        public void CreatePushChannel(String channelName, PushServiceRegistrationCallback registrationCallBack, PushServiceMessageCallback messageCallback)
        {
            /// Holds the push channel that is created or found.
            HttpNotificationChannel pushChannel;
            mRegistrationCallback = registrationCallBack;
            mMessageCallback = messageCallback;
            // Try to find the push channel.
            pushChannel = HttpNotificationChannel.Find(channelName);

            // If the channel was not found, then create a new connection to the push service.
            if (pushChannel == null)
            {
                pushChannel = new HttpNotificationChannel(channelName);

                // Register for all the events before attempting to open the channel.
                pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
                pushChannel.Open();
                pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
                pushChannel.BindToShellToast();
                pushChannel.BindToShellTile();
            }
            else
            {
                // The channel was already open, so just register for all the events.
                pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

                if (pushChannel.IsShellTileBound)
                {
                    pushChannel.UnbindToShellTile();
                }
                if (pushChannel.IsShellToastBound)
                {
                    pushChannel.UnbindToShellToast();
                }
                pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
                pushChannel.BindToShellToast();
                pushChannel.BindToShellTile();
            }
        }
开发者ID:SufyanElahi1,项目名称:App42_PushPlugin_Sample_Unity_Windows,代码行数:47,代码来源:App42PushService.cs

示例13: openChannel

        public void openChannel(string options)
        {
            try
            {
                HttpNotificationChannel currentChannel = HttpNotificationChannel.Find(ChannelName);

                if (currentChannel == null)
                {
                    currentChannel = new HttpNotificationChannel(ChannelName);
                    currentChannel.Open();
                    currentChannel.BindToShellTile();
                    currentChannel.BindToShellToast();
                }

                this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, currentChannel.ChannelUri));
            }
            catch
            {
                this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR));
            }
        }
开发者ID:FIBUPC,项目名称:Raco-HTML5,代码行数:21,代码来源:PushNotificationsBridge.cs

示例14: Subscribe

        private void Subscribe(HttpNotificationChannel pushChannel)
        {
            // The channel was already open, so just register for all the events.
            pushChannel.ChannelUriUpdated += async (sender, e) =>
            {
                await PushSubscribe(e.ChannelUri);
            };

            pushChannel.ErrorOccurred += (sender, e) => 
                System.Diagnostics.Debug.WriteLine("PushChannel Error: " + e.ErrorType.ToString() + " -> " + e.ErrorCode + " -> " + e.Message + " -> " + e.ErrorAdditionalData);

            // Bind this new channel for toast events.
            if (pushChannel.IsShellToastBound)
                System.Diagnostics.Debug.WriteLine("Already Bound to Toast");
            else
                pushChannel.BindToShellToast();

            if (pushChannel.IsShellTileBound)
                System.Diagnostics.Debug.WriteLine("Already Bound to Tile");
            else
                pushChannel.BindToShellTile();
        }
开发者ID:Ontropix,项目名称:whowhat,代码行数:22,代码来源:PushSharpClient.cs

示例15: RegisterPushNotifications

        public void RegisterPushNotifications()
        {
            if (pushChannel != null) return;

            pushChannel = HttpNotificationChannel.Find(channelName);

            // If the channel was not found, then create a new connection to the push service.
            if (pushChannel == null)
            {
                pushChannel = new HttpNotificationChannel(channelName, "PositiveSSL CA");

                // Register for all the events before attempting to open the channel.
                pushChannel.ChannelUriUpdated += PushChannel_ChannelUriUpdated;
                pushChannel.ErrorOccurred += PushChannel_ErrorOccurred;
                pushChannel.HttpNotificationReceived += PushChannel_HttpNotificationReceived;

                pushChannel.Open();
                pushChannel.BindToShellToast();
                pushChannel.BindToShellTile();

                System.Diagnostics.Debug.WriteLine("Connetion: " + pushChannel.ConnectionStatus.ToString());
                System.Diagnostics.Debug.WriteLine("Bound: " + pushChannel.IsShellTileBound.ToString());
            }
            else
            {
                // The channel was already open, so just register for all the events.
                pushChannel.ChannelUriUpdated += PushChannel_ChannelUriUpdated;
                pushChannel.ErrorOccurred += PushChannel_ErrorOccurred;
                pushChannel.HttpNotificationReceived += PushChannel_HttpNotificationReceived;

                System.Diagnostics.Debug.WriteLine("Connetion2: " + pushChannel.ConnectionStatus.ToString());
                System.Diagnostics.Debug.WriteLine("Bound2: " + pushChannel.IsShellTileBound.ToString());
            }

            //if (UriUpdated != null && pushChannel.ChannelUri != null)
            //{
            //    UriUpdated(pushChannel.ChannelUri.ToString());
            //}
        }
开发者ID:blackjid,项目名称:CouchPotatoWp7,代码行数:39,代码来源:PushHelper.cs


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