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); 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 static void StartSplash() { if ((bool)SEBClientInfo.getSebSetting("createNewDesktop")["createNewDesktop"]) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } SebWindowsClientMain.splash = new SEBSplashScreen(); Application.Run((Form)SebWindowsClientMain.splash); }
/// ---------------------------------------------------------------------------------------- /// <summary> /// Reset desktop to the default one which was active before starting SEB. /// </summary> /// <returns>true if succeed</returns> /// ---------------------------------------------------------------------------------------- public static void ResetSEBDesktop() { // Switch to Default Desktop if (sessionCreateNewDesktop) { Logger.AddInformation("Showing Original Desktop"); SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName); Logger.AddInformation("Setting original Desktop as current"); SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); Logger.AddInformation("Closing New Dekstop"); SEBClientInfo.SEBNewlDesktop.Close(); } }
public static void StartSplash() { // Set the threads desktop to the new desktop if "Create new Desktop" is activated if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop]) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } // Instance a splash form given the image names splash = new SEBSplashScreen(); // Run the form Application.Run(splash); }
public static void ResetSEBDesktop() { if (!SebWindowsClientMain.sessionCreateNewDesktop) { return; } Logger.AddInformation("Showing Original Desktop", (object)null, (Exception)null, (string)null); SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName); Logger.AddInformation("Setting original Desktop as current", (object)null, (Exception)null, (string)null); SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); Logger.AddInformation("Closing New Dekstop", (object)null, (Exception)null, (string)null); SEBClientInfo.SEBNewlDesktop.Close(); }
public static void StartLoading() { if ((bool)SEBClientInfo.getSebSetting("createNewDesktop")["createNewDesktop"] || SEBClientInfo.CreateNewDesktopOldValue) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } else { SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); } SEBLoading.loading = new SEBLoading(); Application.Run((Form)SEBLoading.loading); }
public static void StartSplash() { if (SEBClientInfo.SEBNewlDesktop != null && (bool)SEBClientInfo.getSebSetting("createNewDesktop")["createNewDesktop"]) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } else { SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); } SEBSplashScreen.splash = new SEBSplashScreen(); Application.Run((Form)SEBSplashScreen.splash); }
/// <summary> /// Call via separate thread /// var thread = new Thread(SEBLoading.StartSplash); /// thread.Start(); /// </summary> public static void StartSplash() { // Set the threads desktop to the new desktop if "Create new Desktop" is activated if (SEBClientInfo.SEBNewlDesktop != null && (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop]) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } else { SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); } // Instance a splash form given the image names splash = new SEBSplashScreen(); splash.ShowDialog(); }
/// <summary> /// Call via separate thread /// var thread = new Thread(SEBLoading.StartSplash); /// thread.Start(); /// </summary> static public void StartSplash() { // Set the threads desktop to the new desktop if "Create new Desktop" is activated if (false) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } else { SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); } // Instance a splash form given the image names splash = new SEBSplashScreen(); // Run the form Application.Run(splash); }
/// <summary> /// Call via separate thread /// var thread = new Thread(SEBLoading.StartLoading); /// thread.Start(); /// </summary> static public void StartLoading() { // Set the threads desktop to the new desktop if "Create new Desktop" is activated if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop] || SEBClientInfo.CreateNewDesktopOldValue) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } else { SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); } // Instance a loading screen form given the image names loading = new SEBLoading(); // Run the form Application.Run(loading); }
/// <summary> /// Call via separate thread /// var thread = new Thread(SEBLoading.StartLoading); /// thread.Start(); /// </summary> public static void StartLoading() { SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); // Set the threads desktop to the new desktop if "Create new Desktop" is activated if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop] || SEBClientInfo.CreateNewDesktopOldValue) { SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop); } else { SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); } loading = new SEBLoading(); loading.ShowDialog(); }
/// ---------------------------------------------------------------------------------------- /// <summary> /// Reset desktop to the default one which was active before starting SEB. /// </summary> /// <returns>true if succeed</returns> /// ---------------------------------------------------------------------------------------- public static void ResetSEBDesktop() { // Switch to Default Desktop if (sessionCreateNewDesktop) { Logger.AddInformation("Showing Original Desktop"); SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName); Logger.AddInformation("Setting original Desktop as current"); SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); Logger.AddInformation("Closing New Dekstop"); SEBClientInfo.SEBNewlDesktop.Close(); } else { //If you kill the explorer shell you don't need this! //SetVisibility(true); } }
public static string ShowFileDialogForExecutable(string fileName) { if (SebWindowsClientMain.sessionCreateNewDesktop) { SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName); } Worker worker = new Worker(); Thread thread = new Thread(new ThreadStart(worker.ShowFileDialogInThread)); thread.SetApartmentState(ApartmentState.STA); worker.fileNameExecutable = fileName; thread.Start(); do { ; }while (!thread.IsAlive); thread.Join(); if (SebWindowsClientMain.sessionCreateNewDesktop) { SEBDesktopController.Show(SEBClientInfo.SEBNewlDesktop.DesktopName); } return(worker.fileNameFullPath); }
public static string ShowFileDialogForExecutable(string fileName, string originalName) { // Switch to default desktop if (SebWindowsClientMain.sessionCreateNewDesktop) { SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName); } // Create the thread object. This does not start the thread. Worker workerObject = new Worker(); Thread workerThread = new Thread(workerObject.ShowFileDialogInThread); workerThread.SetApartmentState(ApartmentState.STA); workerObject.fileNameExecutable = fileName; workerObject.fileNameOriginal = originalName; // Start the worker thread. workerThread.Start(); // Loop until worker thread activates. while (!workerThread.IsAlive) { ; } // 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.fileNameFullPath); }
/// ---------------------------------------------------------------------------------------- /// <summary> /// Create and initialize SEB client settings and check system compatibility. /// This method needs to be executed only once when SEB first starts /// (not when reconfiguring). /// </summary> /// <returns>true if succeed</returns> /// ---------------------------------------------------------------------------------------- public static bool InitSebSettings() { Logger.AddInformation("Attempting to InitSebSettings"); // If loading of a .seb file isn't in progress and client settings aren't set yet if (_loadingSebFile == false && clientSettingsSet == false) { // Set SebClient configuration if (!SEBClientInfo.SetSebClientConfiguration()) { SEBMessageBox.Show(SEBUIStrings.ErrorCaption, SEBUIStrings.ErrorWhenOpeningSettingsFile, MessageBoxIcon.Error, MessageBoxButtons.OK); Logger.AddError("Error when opening the file KiteStudentPortalSettings.seb!", null, null); return(false); } clientSettingsSet = true; Logger.AddInformation("SEB client configuration set in InitSebSettings().", null, null); } // Check system version if (!SEBClientInfo.SetSystemVersionInfo()) { SEBMessageBox.Show(SEBUIStrings.ErrorCaption, SEBUIStrings.OSNotSupported, MessageBoxIcon.Error, MessageBoxButtons.OK); Logger.AddError("Unknown OS. Exiting SEB.", null, null); return(false); } //on NT4/NT5 ++ a new desktop is created if (SEBClientInfo.IsNewOS) { sessionCreateNewDesktop = (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop]; if (sessionCreateNewDesktop) { SEBClientInfo.OriginalDesktop = SEBDesktopController.GetCurrent(); SEBDesktopController OriginalInput = SEBDesktopController.OpenInputDesktop(); SEBClientInfo.SEBNewlDesktop = SEBDesktopController.CreateDesktop(SEBClientInfo.SEB_NEW_DESKTOP_NAME); SEBDesktopController.Show(SEBClientInfo.SEBNewlDesktop.DesktopName); if (!SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop)) { Logger.AddError("SetThreadDesktop failed! Looks like the thread has hooks or windows in the current desktop.", null, null); SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName); SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop); SEBClientInfo.SEBNewlDesktop.Close(); SEBMessageBox.Show(SEBUIStrings.createNewDesktopFailed, SEBUIStrings.createNewDesktopFailedReason, MessageBoxIcon.Error, MessageBoxButtons.OK); return(false); } SEBClientInfo.DesktopName = SEBClientInfo.SEB_NEW_DESKTOP_NAME; } else { SEBClientInfo.OriginalDesktop = SEBDesktopController.GetCurrent(); SEBClientInfo.DesktopName = SEBClientInfo.OriginalDesktop.DesktopName; //If you kill the explorer shell you don't need this! //SebWindowsClientForm.SetVisibility(false); } } Logger.AddInformation("Successfully InitSebSettings"); return(true); }