Exemplo n.º 1
0
        /// <summary>
        /// Loads the DA System File
        /// </summary>
        public static void LoadSystemFile()
        {
            DI5_INIFile.DI5_IniFileReader oXMLReader;     //-- obj helps to interact with xml file

            if (System.IO.File.Exists(DataAdmin.DAApplicationPath + "\\" + DataAdmin.DASystemFileName) == false)
            {
                DataAdmin.DAApplicationPath = "";
                return;
            }

            oXMLReader = new DI5_INIFile.DI5_IniFileReader(DataAdmin.DAApplicationPath + "\\" + DataAdmin.DASystemFileName);

            //-- finding the values from xml file and save to global variables
            try
            {
                // -- Folders
                DICommon.DefaultFolder.DefaultISOFldrpath = DataAdmin.DAApplicationPath + "\\" + oXMLReader.GetIniValue("locations", "templates");

                DICommon.CountryISoCodeFilename = DICommon.DefaultFolder.DefaultISOFldrpath + "\\" + oXMLReader.GetIniValue("locations", "iso_code_filename");

                DICommon.DefaultFolder.DefaultDataFolder = oXMLReader.GetIniValue("locations", "def_data_folder");

                DICommon.DefaultFolder.DefaultSpreadSheetsFolder = oXMLReader.GetIniValue("locations", "def_spreadsheet_folder");

                DICommon.RegistryFilePath = Path.Combine(Path.Combine(DataAdmin.DAApplicationPath, oXMLReader.GetIniValue("locations", "registry")), oXMLReader.GetIniValue("locations", "registry_filename"));

                DataAdmin.DAGalleryFolderName = oXMLReader.GetIniValue("locations", "galleryfoldername");

                DICommon.DESImportBlankDataValueSymbol = oXMLReader.GetIniValue("des_import", "blank_datavalue_symbol");

                //DICommon.SDMXRegistryWebServiceUrl = Path.Combine(Path.Combine(DataAdmin.DAApplicationPath, oXMLReader.GetIniValue("locations", "sdmx_webservice")), oXMLReader.GetIniValue("locations", "sdmx_webservice"));

            }
            catch (Exception ex)
            {
                //     ShowErrorMessage ( ex );
            }
            finally
            {
                oXMLReader = null;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the Prefernces from the file
        /// </summary>
        public static void LoadPrefrences()
        {
            DI5_INIFile.DI5_IniFileReader oXMLReader;      //-- xmlReader object to read pref xml file
            try
            {
                string[] AvailableICs ;

                if ((File.Exists(DataAdmin.DAApplicationPath + @"\" + DataAdmin.DAPrefFileName)))
                {

                    oXMLReader = new DI5_INIFile.DI5_IniFileReader(DataAdmin.DAApplicationPath + @"\" + DataAdmin.DAPrefFileName);

                    //--  SET GLOBAL COLOR
                    DataAdmin.GlobalColor = ColorTranslator.FromHtml(oXMLReader.GetIniValue("general", "global_color"));

                    //-- Language
                    DataAdmin.DAApplicationLangauge = oXMLReader.GetIniValue("language", "app_lng");               //-- DI_English [en].xml, DI_Chinese[zh].xml

                    DataAdmin.DAAppliationLangCode = DAApplicationLangauge.Substring(DAApplicationLangauge.IndexOf("[") + 1);
                    // -- Retrieve the code from the language
                    DataAdmin.DAAppliationLangCode = DAAppliationLangCode.Replace("[", "");
                    DataAdmin.DAAppliationLangCode = DAAppliationLangCode.Replace("]", "");
                    DataAdmin.DAAppliationLangCode = DAAppliationLangCode.Replace(".xml", "");

                    //-- Application font
                    DataAdmin.FontName = oXMLReader.GetIniValue("language", "fontname");
                    DataAdmin.FontStyle = Convert.ToInt32(oXMLReader.GetIniValue("language", "fontstyle"));
                    DataAdmin.FontSize = Convert.ToInt32(oXMLReader.GetIniValue("language", "fontsize"));

                    DataAdmin.IsSectorVisible = true;
                    DataAdmin.IsGoalVisible = true;
                    DataAdmin.IsCfVisible = true;
                    DataAdmin.IsThemeVisible = true;
                    DataAdmin.IsSourceVisible = true;
                    DataAdmin.IsInstitiutionVisible = true;
                    DataAdmin.IsConventionVisible = true;

                    AvailableICs = DICommon.SplitString(Convert.ToString(oXMLReader.GetIniValue("indicator", "treeviews")), ",");

                    if (AvailableICs[0] == "0")
                    {
                        DataAdmin.IsSectorVisible = false;
                    }
                    if (AvailableICs[1] == "0")
                    {
                        DataAdmin.IsGoalVisible = false;
                    }
                    if (AvailableICs[2] == "0")
                    {
                        DataAdmin.IsCfVisible = false;
                    }
                    if (AvailableICs[3] == "0")
                    {
                        DataAdmin.IsThemeVisible = false;
                    }
                    if (AvailableICs[4] == "0")
                    {
                        DataAdmin.IsSourceVisible = false;
                    }
                    if (AvailableICs[5] == "0")
                    {
                        DataAdmin.IsInstitiutionVisible = false;
                    }
                    if (AvailableICs[6] == "0")
                    {
                        DataAdmin.IsConventionVisible = false;
                    }

                    try
                    {
                        // Set Languge on Button for Chinese issue
                        DataAdmin.ShowLanguageBasedCaption = Convert.ToBoolean(oXMLReader.GetIniValue("general", "apply_nativelanguage_onbutton"));
                    }
                    catch (Exception)
                    {
                        // do nothing
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionFacade.ThrowException(ex);
            }
        }