Ejemplo n.º 1
0
        static int Main(String[] args)
        {
            ToopherSettings settings = new ToopherSettings ();
            if(!settings.IsConfigured) {
                MessageBox.Show ("Toopher CredentialProvider has not been configured.  Toopher Authentication is not currently active.  Please contact your administrator.");
                return AuthenticationJob.SUCCESS;
            }

            string userName = string.Empty;
            if(args.Length > 0) {
                userName = args[0];
            } else {
                userName = WinApiMethods.getTerminalInfoString (WinApiMethods.WTS_INFO_CLASS.WTSUserName);
            }

            if(string.IsNullOrEmpty (userName)) {
                return AuthenticationJob.SUCCESS;
            }

            AuthenticationJob job = new AuthenticationJob (userName, WinApiMethods.buildTerminalIdentifier(), start:false );

            Application.EnableVisualStyles ();
            Application.SetCompatibleTextRenderingDefault (false);
            AuthenticationStatusUI form = new AuthenticationStatusUI (job);
            Application.Run (form);
            int result = job.GetAuthenticationResult();
            return result;
        }
Ejemplo n.º 2
0
        static int Main(String[] args)
        {
            ToopherSettings settings = new ToopherSettings();

            if (!settings.IsConfigured)
            {
                MessageBox.Show("Toopher CredentialProvider has not been configured.  Toopher Authentication is not currently active.  Please contact your administrator.");
                return(AuthenticationJob.SUCCESS);
            }

            string userName = string.Empty;

            if (args.Length > 0)
            {
                userName = args[0];
            }
            else
            {
                userName = WinApiMethods.getTerminalInfoString(WinApiMethods.WTS_INFO_CLASS.WTSUserName);
            }

            if (string.IsNullOrEmpty(userName))
            {
                return(AuthenticationJob.SUCCESS);
            }

            AuthenticationJob job = new AuthenticationJob(userName, WinApiMethods.buildTerminalIdentifier(), start: false);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AuthenticationStatusUI form = new AuthenticationStatusUI(job);

            Application.Run(form);
            int result = job.GetAuthenticationResult();

            return(result);
        }