ShowPasswordDialogForm() 공개 정적인 메소드

Show SEB Password Dialog Form.
public static ShowPasswordDialogForm ( string title, string passwordRequestText ) : string
title string
passwordRequestText string
리턴 string
        public static string ShowPasswordDialogForm(string title, string passwordRequestText)
        {
            if (SEBClientInfo.SebWindowsClientForm != null)
            {
                SebWindowsClientMain.SEBToForeground();
            }
            if (SebWindowsClientMain.sessionCreateNewDesktop || SEBSettings.settingsCurrent.Count > 0 && (bool)SEBClientInfo.getSebSetting("touchOptimized")["touchOptimized"])
            {
                return(SebPasswordDialogForm.ShowPasswordDialogForm(title, passwordRequestText));
            }
            Worker worker = new Worker();
            Thread thread = new Thread(new ThreadStart(worker.ShowPasswordDialogInThread));

            worker.dialogTitle = title;
            worker.dialogText  = passwordRequestText;
            thread.Start();
            do
            {
                ;
            }while (!thread.IsAlive);
            thread.Join();
            if (SebWindowsClientMain.sessionCreateNewDesktop)
            {
                SEBDesktopController.Show(SEBClientInfo.SEBNewlDesktop.DesktopName);
            }
            return(worker.dialogResultText);
        }
예제 #2
0
        public static string ShowPasswordDialogForm(string title, string passwordRequestText)
        {
            // If we are running in SebWindowsClient we need to activate it before showing the password dialog
            if (SEBClientInfo.SebWindowsClientForm != null)
            {
                SebWindowsClientMain.SEBToForeground();
            }

            //No longer necessary as you cannot switch from not-create-new-desktop to create-new-desktop and the other way around
            // Check if SEB is running on a separate desktop
            if (SebWindowsClientMain.sessionCreateNewDesktop)              //Switch to default desktop: SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName);
            {
                // SEB is already running on a separate desktop: we can show the password entry dialog without a separate thread
                return(SebPasswordDialogForm.ShowPasswordDialogForm(title, passwordRequestText));
            }
            //In Touch Mode, do not use the threaded Dialog because we know we can't use it
            else if (SEBSettings.settingsCurrent.Count > 0 && (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized])
            {
                return(SebPasswordDialogForm.ShowPasswordDialogForm(title, passwordRequestText));
            }
            else
            {
                // SEB isn't running on a separate desktop (or not yet):
                // We need to show the password dialog in a separate thread to avoid hooks/references for the current main thread
                // (this makes switching desktops impossible in case it would be necessary later)

                // Create the thread object. This does not start the thread.
                Worker workerObject = new Worker();
                Thread workerThread = new Thread(workerObject.ShowPasswordDialogInThread);

                workerThread.SetApartmentState(ApartmentState.STA);
                workerObject.dialogTitle = title;
                workerObject.dialogText  = passwordRequestText;

                // Start the worker thread.
                workerThread.Start();

                // Loop until worker thread activates.
                while (!workerThread.IsAlive)
                {
                    ;
                }

                // Request that the worker thread stop itself:
                //workerObject.RequestStop();

                // Use the Join method to block the current thread
                // until the object's thread terminates.
                workerThread.Join();

                // Switch to new desktop
                if (SebWindowsClientMain.sessionCreateNewDesktop)
                {
                    SEBDesktopController.Show(SEBClientInfo.SEBNewlDesktop.DesktopName);
                }

                return(workerObject.dialogResultText);
            }
        }
 public void ShowPasswordDialogInThread()
 {
     this.dialogResultText = SebPasswordDialogForm.ShowPasswordDialogForm(this.dialogTitle, this.dialogText);
 }