Exemplo n.º 1
0
        /// <summary>
        /// Sets the DIAdaptations static property and sets the Adaptations folder path.
        /// </summary>
        /// <param name="appPath"></param>
        public static void GetAdaptationFolderPath(string appPath)
        {
            try
            {
                DIAdaptations DIAdaptationObj;

                if (!_IsDILiteSetup)
                {
                    //-- Get the DIAdapatation.xml file path.
                    AdaptationFileNameWPath = Path.Combine(appPath, DIAdaptations.DI_ADAPTATIONS_FILENAME);
                }

                if (File.Exists(AdaptationFileNameWPath))
                {
                    DIAdaptationObj = DIAdaptations.Load(AdaptationFileNameWPath);
                    if (!String.IsNullOrEmpty(DIAdaptationObj.LastUsedAdaptation.AdaptationFolder))
                    {
                        AdaptationFolderPath = DIAdaptationObj.LastUsedAdaptation.AdaptationFolder;

                        //-- check for the existence of adaptation folder path.
                        if (Directory.Exists(AdaptationFolderPath))
                        {
                            //-- Create the instance of Adaptation.xml
                            if (File.Exists(Path.Combine(AdaptationFolderPath, Adaptation.ADAPTATION_FILE_NAME)))
                            {
                                AdaptationObj = Adaptation.Load(Path.Combine(AdaptationFolderPath, Adaptation.ADAPTATION_FILE_NAME));
                            }
                            else
                            {
                                AdaptationObj = new Adaptation();
                            }
                        }
                    }
                }
                else if (_IsDILiteSetup)
                {
                    if (!string.IsNullOrEmpty(_AdaptationFolderPath))
                    {
                        if (File.Exists(Path.Combine(_AdaptationFolderPath, Adaptation.ADAPTATION_FILE_NAME)))
                        {
                            AdaptationObj = Adaptation.Load(Path.Combine(AdaptationFolderPath, Adaptation.ADAPTATION_FILE_NAME));
                        }
                        else
                        {
                            AdaptationObj = new Adaptation();
                        }
                    }
                }

                if (AdaptationObj != null && Directory.Exists(Path.Combine(Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Stock), AdaptationObj.DirectoryLocation.SystemFolder)))
                {
                    if (!File.Exists(Path.Combine(Path.Combine(Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Stock), AdaptationObj.DirectoryLocation.SystemFolder), UserPreference.USER_PREF_FILE_NAME)))
                    {
                        UserPreferenceObj = new UserPreference(Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Language));

                        if (Directory.Exists(Path.Combine(Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Stock), AdaptationObj.DirectoryLocation.SystemFolder)))
                        {
                            //-- If the system file directory exists.
                            PrefFilePath = Path.Combine(Path.Combine(Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Stock), AdaptationObj.DirectoryLocation.SystemFolder), UserPreference.USER_PREF_FILE_NAME);
                        }
                        else
                        {
                            PrefFilePath = string.Empty;
                        }
                    }
                    else
                    {
                        UserPreferenceObj = UserPreference.Load(Path.Combine(Path.Combine(Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Stock), AdaptationObj.DirectoryLocation.SystemFolder), UserPreference.USER_PREF_FILE_NAME), Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Language));
                        PrefFilePath = Path.Combine(Path.Combine(Path.Combine(AdaptationFolderPath, AdaptationObj.DirectoryLocation.Stock), AdaptationObj.DirectoryLocation.SystemFolder), UserPreference.USER_PREF_FILE_NAME);
                    }
                }

            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get the bottom panel button adaptation based Text
 /// </summary>
 /// <param name="adaptation"></param>
 /// <param name="bottomPanelButtonID"></param>
 /// <returns></returns>
 public static string GetBottomPanelAdaptationBasedString(Adaptation adaptation, string bottomPanelButtonID)
 {
     string RetVal = string.Empty;
     try
     {
         //-- Get the adaptation based text
         foreach (Adaptation.BottomPanelButton bpButton in adaptation.BottomPanel.Buttons)
         {
             if (bpButton.ID.ToLower() == bottomPanelButtonID.ToLower())
             {
                 RetVal = bpButton.Text;
                 break;
             }
         }
     }
     catch (Exception)
     {
     }
     return RetVal;
 }