getSebSetting() public static method

public static getSebSetting ( string key ) : object>.Dictionary
key string
return object>.Dictionary
Ejemplo n.º 1
0
        // **********************************
        // Output an error or warning message
        // **********************************
        public static DialogResult Show(string messageTitle, string messageText, MessageBoxIcon messageBoxIcon, MessageBoxButtons messageButtons, bool neverShowTouchOptimized = false)
        {
            // If we are running in SebWindowsClient we need to activate it before showing the password dialog
            if (SEBClientInfo.SebWindowsClientForm != null)
            {
                SebWindowsClientMain.SEBToForeground();
            }

            DialogResult messageBoxResult;

            if (!neverShowTouchOptimized && (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized] == true)
            {
                messageBoxResult =
                    MetroMessageBox.Show(
                        new Form()
                {
                    TopMost = true,
                    Top     = 0,
                    Left    = 0,
                    Width   = Screen.PrimaryScreen.Bounds.Width,
                    Height  = Screen.PrimaryScreen.Bounds.Height
                }, messageText, messageTitle, messageButtons, messageBoxIcon);
            }
            else
            {
                messageBoxResult = MessageBox.Show(new Form()
                {
                    TopMost = true
                }, messageText, messageTitle, messageButtons, messageBoxIcon);
            }

            return(messageBoxResult);
        }
Ejemplo n.º 2
0
 private static string GetStartupPathOrUrl()
 {
     if (!string.IsNullOrEmpty((string)SEBSettings.settingsCurrent[SEBSettings.KeyStartResource]))
     {
         var resource =
             GetAdditionalResourceById((string)SEBSettings.settingsCurrent[SEBSettings.KeyStartResource]);
         var filename = (string)resource[SEBSettings.KeyAdditionalResourcesResourceDataFilename];
         var path     =
             new FileCompressor().DecompressDecodeAndSaveFile(
                 (string)resource[SEBSettings.KeyAdditionalResourcesResourceData], filename, resource[SEBSettings.KeyAdditionalResourcesIdentifier].ToString());
         return(new Uri(path + filename).AbsoluteUri);
     }
     else
     {
         return(SEBClientInfo.getSebSetting(SEBSettings.KeyStartURL)[SEBSettings.KeyStartURL].ToString());
     }
 }
        public static void InitializeLogger()
        {
            if (!(bool)SEBClientInfo.getSebSetting("enableLogging")["enableLogging"])
            {
                return;
            }
            string name = (string)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "logDirectoryWin");

            if (!string.IsNullOrEmpty(name))
            {
                SEBClientInfo.SebClientLogFileDirectory = Environment.ExpandEnvironmentVariables(name);
                SEBClientInfo.SebClientLogFile          = string.Format("{0}\\{1}", (object)SEBClientInfo.SebClientLogFileDirectory, (object)"SebClient.log");
            }
            else
            {
                SEBClientInfo.SetDefaultClientLogFile();
            }
            Logger.InitLogger(SEBClientInfo.SebClientLogFileDirectory, (string)null);
        }
Ejemplo n.º 4
0
        public static DialogResult Show(string messageTitle, string messageText, MessageBoxIcon messageBoxIcon, MessageBoxButtons messageButtons, bool neverShowTouchOptimized = false)
        {
            if (SEBClientInfo.SebWindowsClientForm != null)
            {
                SebWindowsClientMain.SEBToForeground();
            }
            DialogResult dialogResult;

            if (!neverShowTouchOptimized && (bool)SEBClientInfo.getSebSetting("touchOptimized")["touchOptimized"])
            {
                Form form = new Form();
                form.TopMost = true;
                int num1 = 0;
                form.Top = num1;
                int num2 = 0;
                form.Left = num2;
                Rectangle bounds = Screen.PrimaryScreen.Bounds;
                int       width  = bounds.Width;
                form.Width = width;
                bounds     = Screen.PrimaryScreen.Bounds;
                int height1 = bounds.Height;
                form.Height = height1;
                string message = messageText;
                string title   = messageTitle;
                int    num3    = (int)messageButtons;
                int    num4    = (int)messageBoxIcon;
                int    height2 = 211;
                dialogResult = MetroMessageBox.Show((IWin32Window)form, message, title, (MessageBoxButtons)num3, (MessageBoxIcon)num4, height2);
            }
            else
            {
                Form form = new Form();
                form.TopMost = true;
                string text    = messageText;
                string caption = messageTitle;
                int    num1    = (int)messageButtons;
                int    num2    = (int)messageBoxIcon;
                dialogResult = MessageBox.Show((IWin32Window)form, text, caption, (MessageBoxButtons)num1, (MessageBoxIcon)num2);
            }
            return(dialogResult);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sets properties in config.json XULRunner configuration file.
        /// </summary>
        /// <returns></returns>
        public static bool SetXulRunnerConfiguration()
        {
            bool setXulRunnerConfiguration = false;

            try
            {
                // Get the path of the "Program Data" directory.
                string localAppDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                //string programDataDirectory = Environment.GetEnvironmentVariable("PROGRAMMDATA");

                // Set the location of the XULRunnerConfigFileDirectory
                StringBuilder xulRunnerConfigFileDirectoryBuilder = new StringBuilder(localAppDataDirectory).Append("\\").Append(MANUFACTURER_LOCAL).Append("\\");  //.Append(PRODUCT_NAME).Append("\\");
                XulRunnerConfigFileDirectory = xulRunnerConfigFileDirectoryBuilder.ToString();

                // Set the location of the config.json file
                StringBuilder xulRunnerConfigFileBuilder = new StringBuilder(XulRunnerConfigFileDirectory).Append(XUL_RUNNER_CONFIG);
                XulRunnerConfigFile = xulRunnerConfigFileBuilder.ToString();

                XULRunnerConfig xulRunnerConfig = SEBXulRunnerSettings.XULRunnerConfigDeserialize(XulRunnerConfigFile);
                xulRunnerConfig.seb_openwin_width  = Int32.Parse(SEBClientInfo.getSebSetting(SEBSettings.KeyNewBrowserWindowByLinkWidth)[SEBSettings.KeyNewBrowserWindowByLinkWidth].ToString());
                xulRunnerConfig.seb_openwin_height = Int32.Parse(SEBClientInfo.getSebSetting(SEBSettings.KeyNewBrowserWindowByLinkHeight)[SEBSettings.KeyNewBrowserWindowByLinkHeight].ToString());
                if ((Int32)SEBClientInfo.getSebSetting(SEBSettings.KeyBrowserViewMode)[SEBSettings.KeyBrowserViewMode] == (int)browserViewModes.browserViewModeWindow)
                {
                    xulRunnerConfig.seb_mainWindow_titlebar_enabled = true;
                }
                else
                {
                    xulRunnerConfig.seb_mainWindow_titlebar_enabled = false;
                }
                xulRunnerConfig.seb_url   = SEBClientInfo.getSebSetting(SEBSettings.KeyStartURL)[SEBSettings.KeyStartURL].ToString();
                setXulRunnerConfiguration = true;
                SEBXulRunnerSettings.XULRunnerConfigSerialize(xulRunnerConfig, XulRunnerConfigFile);
            }
            catch (Exception ex)
            {
                Logger.AddError("Error ocurred by setting XulRunner configuration.", null, ex, ex.Message);
            }

            return(setXulRunnerConfiguration);
        }
        public static bool SetXulRunnerConfiguration()
        {
            bool flag = false;

            try
            {
                SEBClientInfo.XulRunnerConfigFileDirectory = new StringBuilder(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)).Append("\\").Append("SafeExamBrowser").Append("\\").ToString();
                SEBClientInfo.XulRunnerConfigFile          = new StringBuilder(SEBClientInfo.XulRunnerConfigFileDirectory).Append("config.json").ToString();
                XULRunnerConfig objXULRunnerConfig = SEBXulRunnerSettings.XULRunnerConfigDeserialize(SEBClientInfo.XulRunnerConfigFile);
                objXULRunnerConfig.seb_openwin_width  = int.Parse(SEBClientInfo.getSebSetting("newBrowserWindowByLinkWidth")["newBrowserWindowByLinkWidth"].ToString());
                objXULRunnerConfig.seb_openwin_height = int.Parse(SEBClientInfo.getSebSetting("newBrowserWindowByLinkHeight")["newBrowserWindowByLinkHeight"].ToString());
                objXULRunnerConfig.seb_mainWindow_titlebar_enabled = (int)SEBClientInfo.getSebSetting("browserViewMode")["browserViewMode"] == 0;
                objXULRunnerConfig.seb_url = SEBClientInfo.getSebSetting("startURL")["startURL"].ToString();
                flag = true;
                SEBXulRunnerSettings.XULRunnerConfigSerialize(objXULRunnerConfig, SEBClientInfo.XulRunnerConfigFile);
            }
            catch (Exception ex)
            {
                Logger.AddError("Error ocurred by setting XulRunner configuration.", (object)null, ex, ex.Message);
            }
            return(flag);
        }