Exemplo n.º 1
0
        private void btnContinue_Click(object sender, RoutedEventArgs e)
        {
            PubnubConfigData data = new PubnubConfigData();

            data.ssl          = chkSSL.IsChecked.Value;
            data.publishKey   = txtPublishKey.Text.Trim();
            data.subscribeKey = txtSubscribeKey.Text.Trim();
            data.cipherKey    = txtCipherKey.Text.Trim();
            data.secretKey    = txtSecretKey.Text.Trim();
            data.sessionUUID  = txtSessionUUID.Text.Trim();
            data.origin       = txtOrigin.Text.Trim();

            var frame = new Frame();

            frame.Navigate(typeof(PubnubTimeoutSettings), data);
            Window.Current.Content = frame;
        }
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            data = e.Parameter as PubnubConfigData;

            if (data != null)
            {
                config                            = new PNConfiguration();
                config.PublishKey                 = data.publishKey;
                config.SubscribeKey               = data.subscribeKey;
                config.SecretKey                  = data.secretKey;
                config.CipherKey                  = data.cipherKey;
                config.Secure                     = data.ssl;
                config.Origin                     = data.origin;
                config.Uuid                       = data.sessionUUID;
                config.AuthKey                    = data.authKey;
                config.PresenceTimeout            = data.presenceHeartbeat;
                config.SubscribeTimeout           = data.subscribeTimeout;
                config.NonSubscribeRequestTimeout = data.nonSubscribeTimeout;
                config.UseClassicHttpWebRequest   = true;

                config.PubnubLog    = new PlatformPubnubLog();
                config.LogVerbosity = PNLogVerbosity.BODY;
                pubnub   = new Pubnub(config);
                listener = new SubscribeCallbackExt(
                    (o, m) =>
                {
                    DisplayMessageInTextBox(pubnub.JsonPluggableLibrary.SerializeToJsonString(m));
                },
                    (o, p) =>
                {
                    DisplayMessageInTextBox(pubnub.JsonPluggableLibrary.SerializeToJsonString(p));
                },
                    (o, s) =>
                {
                    DisplayMessageInTextBox(pubnub.JsonPluggableLibrary.SerializeToJsonString(s));
                });
                //pubnub.NetworkCheckMaxRetries = data.maxRetries;
                //pubnub.NetworkCheckRetryInterval = data.retryInterval;
                //pubnub.LocalClientHeartbeatInterval = data.localClientHeartbeatInterval;
                //pubnub.EnableResumeOnReconnect = data.resumeOnReconnect;
                //pubnub.PresenceHeartbeat = data.presenceHeartbeat;
                //pubnub.PresenceHeartbeatInterval = data.presenceHeartbeatInterval;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            data = e.Parameter as PubnubConfigData;

            if (data != null)
            {
                config                            = new PNConfiguration();
                config.PublishKey                 = data.publishKey;
                config.SubscribeKey               = data.subscribeKey;
                config.SecretKey                  = data.secretKey;
                config.CipherKey                  = data.cipherKey;
                config.Secure                     = data.ssl;
                config.Origin                     = data.origin;
                config.Uuid                       = data.sessionUUID;
                config.AuthKey                    = data.authKey;
                config.PresenceTimeout            = data.presenceHeartbeat;
                config.SubscribeTimeout           = data.subscribeTimeout;
                config.NonSubscribeRequestTimeout = data.nonSubscribeTimeout;
                config.UseClassicHttpWebRequest   = true;

                config.PubnubLog    = new PlatformPubnubLog();
                config.LogVerbosity = PNLogVerbosity.BODY;
                pubnub   = new Pubnub(config);
                listener = new SubscribeCallbackExt(
                    async(o, m) =>
                {
                    await DisplayMessageInTextBox(pubnub.JsonPluggableLibrary.SerializeToJsonString(m)).ConfigureAwait(false);
                },
                    async(o, p) =>
                {
                    await DisplayMessageInTextBox(pubnub.JsonPluggableLibrary.SerializeToJsonString(p)).ConfigureAwait(false);
                },
                    async(o, s) =>
                {
                    await DisplayMessageInTextBox(pubnub.JsonPluggableLibrary.SerializeToJsonString(s)).ConfigureAwait(false);
                });
            }
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     data = e.Parameter as PubnubConfigData;
 }