Beispiel #1
0
		protected void ShowSettings ()
		{
			DisableActions();
			if(pubnub != null){
				pubnub.EndPendingRequests();
			}
			SettingsDialog settings = new SettingsDialog(this);
			settings.Modal = true;
			
			settings.Name = "Settings";
			bool errorFree = true;
			settings.Response += delegate(object o, ResponseArgs args) {
				if(args.ResponseId == Gtk.ResponseType.Ok)
				{
					//string channel = this.Channel; 
					pubnub = new Pubnub("demo", "demo", "", this.Cipher , this.Ssl);
					if(!string.IsNullOrEmpty(this.CustomUuid))
					{
						pubnub.SessionUUID = this.CustomUuid;
					}
					StringBuilder sbHead = new StringBuilder();
					//sbHead.Append("Ch:");
					foreach(string ch in this.Channel.Split(','))
					{
						sbHead.Append(ch.Trim());
						sbHead.Append("\n");
					}
					
					entrySsl.Text =  (this.Ssl)?"On": "Off";
					entryUuid.Text = pubnub.SessionUUID;
					entryCipher.Text = this.Cipher;
					//entryServerTime.Text = this.time

					//this.tvChannels.Buffer.Text = sbHead.ToString();
					
					PubnubProxy proxy = new PubnubProxy();
					if(!string.IsNullOrWhiteSpace(this.Server))
					{
		                proxy.ProxyServer = this.Server;
		                proxy.ProxyPort = this.Port;
		                proxy.ProxyUserName = this.Username;
		                proxy.ProxyPassword = this.Password;
						
		                try
		                {
		                    pubnub.Proxy = proxy;
		                }
		                catch (MissingFieldException mse)
		                {
							Console.WriteLine(mse.Message);
							errorFree = false;
		                }
					}
					if(errorFree)
					{
						EnableActions();
						SubscribeToChannels();
					}
					else
					{
						ShowSettings();
					}
				} else {
					if(pubnub != null){
						EnableActions();
					}
				}
			};
			settings.Run ();
			settings.Destroy();
		}
Beispiel #2
0
        protected void ShowSettings()
        {
            DisableActions();
            if (pubnub != null)
            {
                pubnub.EndPendingRequests();
            }
            SettingsDialog settings = new SettingsDialog(this);

            settings.Modal = true;

            settings.Name = "Settings";
            bool errorFree = true;

            settings.Response += delegate(object o, ResponseArgs args) {
                if (args.ResponseId == Gtk.ResponseType.Ok)
                {
                    //string channel = this.Channel;
                    pubnub = new Pubnub("demo", "demo", "", this.Cipher, this.Ssl);
                    if (!string.IsNullOrEmpty(this.CustomUuid))
                    {
                        pubnub.SessionUUID = this.CustomUuid;
                    }
                    StringBuilder sbHead = new StringBuilder();
                    //sbHead.Append("Ch:");
                    foreach (string ch in this.Channel.Split(','))
                    {
                        sbHead.Append(ch.Trim());
                        sbHead.Append("\n");
                    }

                    entrySsl.Text    = (this.Ssl)?"On": "Off";
                    entryUuid.Text   = pubnub.SessionUUID;
                    entryCipher.Text = this.Cipher;
                    //entryServerTime.Text = this.time

                    //this.tvChannels.Buffer.Text = sbHead.ToString();

                    PubnubProxy proxy = new PubnubProxy();
                    if (!string.IsNullOrWhiteSpace(this.Server))
                    {
                        proxy.ProxyServer   = this.Server;
                        proxy.ProxyPort     = this.Port;
                        proxy.ProxyUserName = this.Username;
                        proxy.ProxyPassword = this.Password;

                        try
                        {
                            pubnub.Proxy = proxy;
                        }
                        catch (MissingFieldException mse)
                        {
                            Console.WriteLine(mse.Message);
                            errorFree = false;
                        }
                    }
                    if (errorFree)
                    {
                        EnableActions();
                        SubscribeToChannels();
                    }
                    else
                    {
                        ShowSettings();
                    }
                }
                else
                {
                    if (pubnub != null)
                    {
                        EnableActions();
                    }
                }
            };
            settings.Run();
            settings.Destroy();
        }