Inheritance: System.Windows.Forms.Form
Example #1
0
        private async void startLocal_Click(object sender, EventArgs e)
        {
            string nick;

            if (Settings.Nickname == null)
            {
                InputForm nickname = new InputForm();
                if (nickname.ShowDialogOnFormThread(this) == DialogResult.Cancel)
                {
                    return;
                }

                nick = nickname.Input.Text.Trim();
            }
            else
            {
                nick = Settings.Nickname;
            }

            await LocalServer.StartAsync();

            this.DialogResult = DialogResult.OK;
            this.Entry        = new ServerEntry(0)
            {
                Host         = Target.LoopbackIP,
                Port         = 42912,
                UserName     = nick,
                UserNickname = nick,
                UserPassword = "******"
            };
        }
Example #2
0
        private string RequireServerPassword()
        {
            InputForm input = new InputForm();

            input.Input.UseSystemPasswordChar = true;
            input.Label.Text = "Server Password:"******"Enter Password";

            if (input.ShowDialogOnFormThread(this) != DialogResult.OK)
            {
                this.gablarski.DisconnectAsync();
                return(null);
            }

            return(input.Input.Text);
        }
Example #3
0
		private void GablarskiConnected (object sender, EventArgs e)
		{
			if (this.IsDisposed || this.Disposing)
				return;

			this.reconnecting = false;

			this.Invoke ((Action)delegate
			{
				if (TaskbarManager.IsPlatformSupported)
					TaskbarManager.Instance.SetOverlayIcon (this.Handle, Resources.ConnectImage.ToIcon (), "Connected");

				this.btnConnect.Image = Resources.ConnectImage;
				this.btnConnect.Text = "Disconnect";
				this.btnConnect.ToolTipText = "Disconnect (Connected)";

				this.btnComment.Enabled = true;
				this.btnMute.Enabled = true;
				this.btnMuteMic.Enabled = true;
				this.btnAFK.Enabled = true;

				this.users.SetServerNode (
					new TreeNode (this.gablarski.ServerInfo.Name)
					{
						ToolTipText = this.gablarski.ServerInfo.Description
					}
				);
			});

			if (this.server == null)
			{
				this.server = new ServerEntry (0) {
					UserNickname = Settings.Nickname
				};
				this.users.Server = this.server;
			}
			
			lock (this.ignores)
			{
				ClientData.GetIgnores().Where (i => i.ServerId == this.server.Id).Select (i => i.Username.Replace (" ", String.Empty).ToLower())
					.ForEach (un => this.ignores.Add (un));
			}

			string userpassword = this.server.UserPassword;

			if (this.server.UserNickname.IsNullOrWhitespace ())
			{
				InputForm nickname = new InputForm ();
				if (nickname.ShowDialogOnFormThread (this) == DialogResult.Cancel)
					return;

				this.server.UserNickname = nickname.Input.Text.Trim ();
			}
			
			if (!this.server.UserName.IsNullOrWhitespace() && userpassword.IsNullOrWhitespace())
			{
				InputForm input = new InputForm();
				input.Input.UseSystemPasswordChar = true;
				input.Label.Text = "User Password:"******"Enter Password";

				if (input.ShowDialogOnFormThread (this) != DialogResult.OK)
				{
					this.gablarski.DisconnectAsync();
					return;
				}

				userpassword = input.Input.Text;
			}

			if (this.server.UserName.IsNullOrWhitespace() || this.server.UserPassword == null)
			{
				string serverpassword = this.server.ServerPassword;
				if (this.gablarski.ServerInfo.Passworded && serverpassword.IsNullOrWhitespace())
					serverpassword = RequireServerPassword();

				if (this.gablarski.IsConnected)
					this.gablarski.CurrentUser.Join (this.server.UserNickname, this.server.UserPhonetic, serverpassword);
			}
			else
				this.gablarski.CurrentUser.Login (this.server.UserName, userpassword);
		}
Example #4
0
		public bool ShowConnect (bool cancelExits)
		{
			this.btnConnect.Enabled = false;
			this.btnConnect.Image = Resources.DisconnectImage;
			this.btnConnect.Text = "Connect";
			this.btnConnect.ToolTipText = "Connect (Disconnected)";

			var login = new LoginForm();
			if (login.ShowDialog(this) == DialogResult.OK)
			{
				if (String.IsNullOrEmpty (login.Entry.UserNickname))
				{
					InputForm nickname = new InputForm();
					if (nickname.ShowDialog() == DialogResult.Cancel)
						return false;

					string nick = nickname.Input.Text.Trim();
					login.Entry.UserNickname = nick;
				}

				this.server = login.Entry;
				this.users.Server = login.Entry;
				Connect();
			}
			else if (cancelExits)
			{
				this.Close();
				return false;
			}

			return true;
		}
Example #5
0
		private string RequireServerPassword ()
		{
			InputForm input = new InputForm();
			input.Input.UseSystemPasswordChar = true;
			input.Label.Text = "Server Password:"******"Enter Password";

			if (input.ShowDialogOnFormThread (this) != DialogResult.OK)
			{
				this.gablarski.DisconnectAsync();
				return null;
			}

			return input.Input.Text;
		}
Example #6
0
        private void GablarskiConnected(object sender, EventArgs e)
        {
            if (this.IsDisposed || this.Disposing)
            {
                return;
            }

            this.reconnecting = false;

            this.Invoke((Action) delegate
            {
                if (TaskbarManager.IsPlatformSupported)
                {
                    TaskbarManager.Instance.SetOverlayIcon(this.Handle, Resources.ConnectImage.ToIcon(), "Connected");
                }

                this.btnConnect.Image       = Resources.ConnectImage;
                this.btnConnect.Text        = "Disconnect";
                this.btnConnect.ToolTipText = "Disconnect (Connected)";

                this.btnComment.Enabled = true;
                this.btnMute.Enabled    = true;
                this.btnMuteMic.Enabled = true;
                this.btnAFK.Enabled     = true;

                this.users.SetServerNode(
                    new TreeNode(this.gablarski.ServerInfo.Name)
                {
                    ToolTipText = this.gablarski.ServerInfo.Description
                }
                    );
            });

            if (this.server == null)
            {
                this.server = new ServerEntry(0)
                {
                    UserNickname = Settings.Nickname
                };
                this.users.Server = this.server;
            }

            lock (this.ignores)
            {
                ClientData.GetIgnores().Where(i => i.ServerId == this.server.Id).Select(i => i.Username.Replace(" ", String.Empty).ToLower())
                .ForEach(un => this.ignores.Add(un));
            }

            string userpassword = this.server.UserPassword;

            if (this.server.UserNickname.IsNullOrWhitespace())
            {
                InputForm nickname = new InputForm();
                if (nickname.ShowDialogOnFormThread(this) == DialogResult.Cancel)
                {
                    return;
                }

                this.server.UserNickname = nickname.Input.Text.Trim();
            }

            if (!this.server.UserName.IsNullOrWhitespace() && userpassword.IsNullOrWhitespace())
            {
                InputForm input = new InputForm();
                input.Input.UseSystemPasswordChar = true;
                input.Label.Text = "User Password:"******"Enter Password";

                if (input.ShowDialogOnFormThread(this) != DialogResult.OK)
                {
                    this.gablarski.DisconnectAsync();
                    return;
                }

                userpassword = input.Input.Text;
            }

            if (this.server.UserName.IsNullOrWhitespace() || this.server.UserPassword == null)
            {
                string serverpassword = this.server.ServerPassword;
                if (this.gablarski.ServerInfo.Passworded && serverpassword.IsNullOrWhitespace())
                {
                    serverpassword = RequireServerPassword();
                }

                if (this.gablarski.IsConnected)
                {
                    this.gablarski.CurrentUser.Join(this.server.UserNickname, this.server.UserPhonetic, serverpassword);
                }
            }
            else
            {
                this.gablarski.CurrentUser.Login(this.server.UserName, userpassword);
            }
        }
Example #7
0
		private async void startLocal_Click (object sender, EventArgs e)
		{
			string nick;
			if (Settings.Nickname == null) {
				InputForm nickname = new InputForm();
				if (nickname.ShowDialogOnFormThread (this) == DialogResult.Cancel)
					return;

				nick = nickname.Input.Text.Trim();
			} else
				nick = Settings.Nickname;

			await LocalServer.StartAsync();

			this.DialogResult = DialogResult.OK;
			this.Entry = new ServerEntry (0)
			{
				Host = Target.LoopbackIP,
				Port = 42912,
				UserName = nick,
				UserNickname = nick,
				UserPassword = "******"
			};
		}