コード例 #1
0
/************************************************************<start>add by Ian.May Oct.16*******************************************************************/
// main modification for shadowfog mode
/************************************************************<start>add by Ian.May Oct.16*******************************************************************/

        private void ShadowFogReload_Click(object sender, EventArgs e)
        {
            ShadowFogReload.Text = "Connecting...";
            // RecordClientUser() pass the username&passworf form textbox to ShadofogConfiguration object and save it to file accordingly
            if (isHashedPassword)
            {
                controller.RecordClientUser(ShadowFogUserName.Text.Trim(), ShadowFogPassword.Text, ShadowFogRememberUserCheck.Checked);
            }
            else
            {
                controller.RecordClientUser(ShadowFogUserName.Text.Trim(), ClientUser.SHA256(ShadowFogPassword.Text), ShadowFogRememberUserCheck.Checked);
            }
            try
            {
                controller.Start();
                controller.isShadowFogStarted = true; // next time will display "restart shadowfog"
                this.Close();
            }
            catch (Exception Error)
            {
                ShadowFogReload.Text = "Start ShadowFog";
                this.Text            = I18N.GetString("Sign In ShadowFog");
                controller.RecoverSSConfig();// erase _config obtianed from scheduler
            }
        }
コード例 #2
0
        /************************************************************<start>add by Ian.May Oct.16*******************************************************************/
        // main modification for shadowfog mode
        private void ShadowFogReload_Click(object sender, EventArgs e)
        {
            ShadowFogReload.Text = "Connecting...";
            try
            {
                // RecordClientUser() pass the username&passworf form textbox to ShadofogConfiguration object and save it to file accordingly
                if (isHashedPassword)
                {
                    controller.RecordClientUser(ShadowFogUserName.Text.Trim(), ShadowFogPassword.Text, ShadowFogRememberUserCheck.Checked);
                }
                else
                {
                    controller.RecordClientUser(ShadowFogUserName.Text.Trim(), ClientUser.SHA256(ShadowFogPassword.Text), ShadowFogRememberUserCheck.Checked);
                }
            }
            catch (Exception Error)
            {
                controller.ResetClientUser();
            }

            try
            {
                controller.Start();
                controller.isShadowFogStarted = true; // next time will display "restart shadowfog"
            }
            catch (Exception Error)
            {
                controller.RecoverSSConfig();// erase _config obtianed from scheduler
            }

            // put here is trying to let everything done including response from network. after closing, any modification to configform wil be illegal
            //this.Close();
            this.Hide();
            ShadowFogReload.Text = "Restart";
        }