Пример #1
0
        //------------------------------[Button]------------------------------

        /// <summary>Starts a Login Request</summary>
        private void LoginButton_Click(object sender, System.EventArgs e)
        {
            Enabled = false;
            Form    = new ServerContactForm("Logging in to the server", "Please wait...");

            try { Connection = new LBLConnection(IPBox.Text, int.Parse(PortBox.Text)); }
            catch (System.Exception) { MessageBox.Show("Unable to parse " + PortBox.Text + " to an integer", "LBL", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }

            Username = UsernameTXB.Text;
            Password = PasswordTXB.Text;
            Form.Show();
            LoginBW.RunWorkerAsync();
        }
Пример #2
0
        //------------------------------[Functions]------------------------------

        /// <summary>Prepares for updating the directory, then launch the backgroundworker that handles the rest</summary>
        public void UpdateDirectory()
        {
            //disable stuff
            Enabled            = false;
            RootBTN.Enabled    = false;
            UpLevelBTN.Enabled = false;

            //Get the directory header.
            PathAsString = "";
            if (Path.Count != 0)
            {
                //get a stack in reverse order
                Stack <string> tempstack = new Stack <string>();
                foreach (String PathPortion in Path)
                {
                    tempstack.Push(PathPortion);
                }

                PathAsString = String.Join("\\", tempstack) + "\\";

                //If we're here, theres folders to go up to, so enable these buttons again for later.
                RootBTN.Enabled    = true;
                UpLevelBTN.Enabled = true;
            }

            //We add this here because requesting the root still has to be sent as \
            PathAsString = "\\" + PathAsString;

            //Set title
            Text = "LBL Browser [LBL:\\\\" + Connection.IP + PathAsString + "]";

            //Setup the ServerContactForm
            DirectoryUpdateForm = new ServerContactForm("Retrieving directory " + PathAsString, "Please wait...");
            DirectoryUpdateForm.Show();

            //Start the Backgroundworker.
            UpdateDirectoryBW.RunWorkerAsync();
        }