示例#1
0
        /// <summary>
        /// Found the panel config file. This is the xml file that contains
        /// a mapping of the name and guid of the scanner and the name of
        /// the animation file for the scanner,
        /// Parses the config file and populates the map table with info
        /// from the file.
        /// </summary>
        /// <param name="configFileName">full path to the config file</param>
        private static void onScreenConfigFileFound(String configFileName)
        {
            try
            {
                var doc = new XmlDocument();

                doc.Load(configFileName);

                var configNodes = doc.SelectNodes("/ACAT/ConfigMapEntries/ConfigMapEntry");

                // load each scheme from the config file
                foreach (XmlNode node in configNodes)
                {
                    var mapEntry = new PanelConfigMapEntry();
                    if (mapEntry.Load(node))
                    {
                        addToMapTable(mapEntry);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
示例#2
0
 /// <summary>
 /// Removes the specified map entry from the map table
 /// </summary>
 /// <param name="entryToRemove">entry to remove</param>
 private static void removeMapEntry(PanelConfigMapEntry entryToRemove)
 {
     if (_masterPanelConfigMapTable.ContainsKey(entryToRemove.ConfigId))
     {
         _masterPanelConfigMapTable.Remove(entryToRemove.ConfigId);
     }
 }
示例#3
0
        /// <summary>
        /// Returns the config map for the specified scanner.  Looks up
        /// the preferred config map first to see if there is a config
        /// entry that has been specifically configured for the scanner.
        /// If not, it looks up the map talbe
        /// </summary>
        /// <param name="panel">Name of the scanner</param>
        /// <returns>Panel config map object</returns>
        public static PanelConfigMapEntry GetPanelConfigMapEntry(String panel)
        {
            PanelConfigMapEntry        retVal = null;
            List <PanelConfigMapEntry> list   = null;

            _mapTable.TryGetValue(panel, out list);

            if (list == null || list.Count <= 0)
            {
                return(null);
            }

            var configName = _preferredPanelConfig.GetConfigName(panel);

            if (!String.IsNullOrEmpty(configName))
            {
                retVal = findMapEntryInList(configName, list);
            }

            if (retVal == null)
            {
                retVal = findMapEntryInMapTable(configName);
            }

            if (retVal == null)
            {
                retVal = list[0];
            }

            return(retVal);
        }
示例#4
0
        /// <summary>
        /// Adds the specified mapEntry object to the map table. Also
        /// looks up the map table if it already has the formID specified
        /// in the mapEntry and updates its config file name with the
        /// one in mapEntry
        /// </summary>
        /// <param name="mapTable">Table to add to</param>
        /// <param name="mapEntry">map entry to add</param>
        private static void addToMapTable(List <Guid> configIdTable, PanelConfigMapEntry mapEntry)
        {
            if (!configIdTable.Contains(mapEntry.ConfigId))
            {
                configIdTable.Add(mapEntry.ConfigId);
            }

            if (!_masterPanelConfigMapTable.ContainsKey(mapEntry.ConfigId))
            {
                _masterPanelConfigMapTable.Add(mapEntry.ConfigId, mapEntry);
            }
        }
示例#5
0
        /// <summary>
        /// Adds the specified mapEntry object to the map table. Also
        /// looks up the map table if it already has the formID specified
        /// in the mapEntry and updates its config file name with the
        /// one in mapEntry
        /// </summary>
        /// <param name="mapEntry">map entry to add</param>
        private static void addToMapTable(PanelConfigMapEntry mapEntry)
        {
            if (!_mapTable.ContainsKey(mapEntry.PanelClass))
            {
                _mapTable.Add(mapEntry.PanelClass, new List <PanelConfigMapEntry>());
            }

            List <PanelConfigMapEntry> list = _mapTable[mapEntry.PanelClass];

            Log.Debug("Adding " + mapEntry);
            list.Add(mapEntry);
        }
示例#6
0
        /// <summary>
        /// Loads all animations from the configfile for the form
        /// </summary>
        private bool initAnimationManager(PanelConfigMapEntry panelConfigMapEntry)
        {
            _animationManager = new AnimationManager();

            bool retVal = _animationManager.Init(panelConfigMapEntry);

            if (!retVal)
            {
                Log.Error("Error initializing animation manager");
            }

            return(retVal);
        }
示例#7
0
 /// <summary>
 /// Removes the specified map entry from the map table
 /// </summary>
 /// <param name="entryToRemove">entry to remove</param>
 private static void removeMapEntry(PanelConfigMapEntry entryToRemove)
 {
     foreach (List <PanelConfigMapEntry> list in _mapTable.Values)
     {
         foreach (PanelConfigMapEntry mapEntry in list)
         {
             if (mapEntry == entryToRemove)
             {
                 list.Remove(mapEntry);
                 return;
             }
         }
     }
 }
示例#8
0
        /// <summary>
        /// Looks up the map table for the specified animation
        /// config file and returns the map entry
        /// </summary>
        /// <param name="configName">name of the animation file</param>
        /// <returns>the map entry</returns>
        private static PanelConfigMapEntry findMapEntryInMapTable(String configName)
        {
            PanelConfigMapEntry retVal = null;

            foreach (var list in _mapTable.Values)
            {
                retVal = findMapEntryInList(configName, list);
                if (retVal != null)
                {
                    break;
                }
            }

            return(retVal);
        }
示例#9
0
        /// <summary>
        /// Checks if the specified map entry is the
        /// same as this object
        /// </summary>
        /// <param name="mapEntry">entry to compare</param>
        /// <returns>true if it is</returns>
        public bool IsEqual(PanelConfigMapEntry mapEntry)
        {
            bool retVal;

            if (mapEntry.FormId != Guid.Empty && FormId != Guid.Empty)
            {
                retVal = FormId.Equals(mapEntry.FormId);
            }
            else
            {
                retVal = String.Compare(ConfigName, mapEntry.ConfigName, true) == 0;
            }

            return(retVal);
        }
示例#10
0
        /// <summary>
        /// Adds the specified Type to the cache keyed by
        /// the Guid.
        /// </summary>
        /// <param name="guid">Guid for the scanner</param>
        /// <param name="type">Scanner class Type</param>
        internal static void AddFormToCache(Guid guid, Type type)
        {
            if (_formsCache.ContainsKey(guid))
            {
                Log.Debug("Form Type " + type.FullName + ", guid " + guid + " is already added");
                return;
            }

            Log.Debug("Adding form " + type.FullName + ", guid " + guid + " to cache");
            _formsCache.Add(guid, type);

            var mapEntry = new PanelConfigMapEntry(type.Name, type.Name, (type.Name + ".xml").ToLower(), guid, type);

            Log.Debug("mapEntry.ConfigFileName: " + mapEntry.ConfigFileName);
            addToMapTable(mapEntry);

            updateFormTypeReferences(guid, type);
        }
示例#11
0
        /// <summary>
        /// Returns the config map for the specified scanner. Looks at the
        /// current culture and if not found , looks at English which is the
        /// default
        /// </summary>
        /// <param name="panel">Name of the scanner</param>
        /// <returns>Panel config map object</returns>
        public static PanelConfigMapEntry GetPanelConfigMapEntry(String panel)
        {
            PanelConfigMapEntry retVal = getMapEntryFromPanelClassConfigMap(panel);

            if (retVal == null)
            {
                retVal = getCultureConfigMapEntry(CultureInfo.DefaultThreadCurrentUICulture.Name, panel);
                if (retVal == null)
                {
                    retVal = getCultureConfigMapEntry(CultureInfo.DefaultThreadCurrentUICulture.TwoLetterISOLanguageName, panel);
                }

                if (retVal == null)
                {
                    retVal = getCultureConfigMapEntry(DefaultCulture, panel);
                }
            }

            return(retVal);
        }
示例#12
0
        /// <summary>
        /// Adds the specified mapEntry object to the map table. Also
        /// looks up the map table if it already has the formID specified
        /// in the mapEntry and updates its config file name with the
        /// one in mapEntry
        /// </summary>
        /// <param name="mapEntry">map entry to add</param>
        private static void addToMapTable(PanelConfigMapEntry mapEntry)
        {
            if (!_mapTable.ContainsKey(mapEntry.PanelClass))
            {
                _mapTable.Add(mapEntry.PanelClass, new List <PanelConfigMapEntry>());
            }

            List <PanelConfigMapEntry> list = _mapTable[mapEntry.PanelClass];

#if abc
            foreach (var panelConfigMapEntry in list)
            {
                if (panelConfigMapEntry.FormId == mapEntry.FormId)
                {
                    panelConfigMapEntry.ConfigFileName = mapEntry.ConfigFileName;
                    return;
                }
            }
#endif
            Log.Debug("Adding " + mapEntry);
            list.Add(mapEntry);
        }
示例#13
0
        /// <summary>
        /// Initializes the widget manager.  Load the widget layout,
        /// set the color scheme and get the root widget object
        /// </summary>
        private bool initWidgetManager(PanelConfigMapEntry panelConfigMapEntry)
        {
            _widgetManager = new WidgetManager(_form);

            _widgetManager.Layout.SetColorScheme(ColorSchemes.DialogSchemeName);

            bool retVal = _widgetManager.Initialize(panelConfigMapEntry.ConfigFileName);

            if (!retVal)
            {
                Log.Error("Unable to initialize widget manager");
            }
            else
            {
                _rootWidget = _widgetManager.RootWidget;
                if (String.IsNullOrEmpty(_rootWidget.SubClass))
                {
                    _rootWidget.SubClass = PanelCategory.Dialog.ToString();
                }
            }

            return(retVal);
        }
示例#14
0
        /// <summary>
        /// Found the panel config file. This is the xml file that contains
        /// a mapping of the name and guid of the scanner and the name of
        /// the animation file for the scanner,
        /// Parses the config file and populates the map table with info
        /// from the file.
        /// </summary>
        /// <param name="configFileName">full path to the config file</param>
        private static void onScreenConfigFileFound(String configFileName)
        {
            try
            {
                var doc = new XmlDocument();

                doc.Load(configFileName);

                var configNodes = doc.SelectNodes("/ACAT/ConfigMapEntries/ConfigMapEntry");

                // load each scheme from the config file
                foreach (XmlNode node in configNodes)
                {
                    var mapEntry = new PanelConfigMapEntry();
                    if (mapEntry.Load(node))
                    {
                        addToMapTable(mapEntry);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
示例#15
0
        /// <summary>
        /// Checks if the specified map entry is the
        /// same as this object
        /// </summary>
        /// <param name="mapEntry">entry to compare</param>
        /// <returns>true if it is</returns>
        public bool IsEqual(PanelConfigMapEntry mapEntry)
        {
            bool retVal;

            if (mapEntry.FormId != Guid.Empty && FormId != Guid.Empty)
            {
                retVal = FormId.Equals(mapEntry.FormId);
            }
            else
            {
                retVal = String.Compare(ConfigName, mapEntry.ConfigName, true) == 0;
            }

            return retVal;
        }
示例#16
0
        /// <summary>
        /// Adds the specified mapEntry object to the map table. Also
        /// looks up the map table if it already has the formID specified
        /// in the mapEntry and updates its config file name with the
        /// one in mapEntry
        /// </summary>
        /// <param name="mapEntry">map entry to add</param>
        private static void addToMapTable(PanelConfigMapEntry mapEntry)
        {
            if (!_mapTable.ContainsKey(mapEntry.PanelClass))
            {
                _mapTable.Add(mapEntry.PanelClass, new List<PanelConfigMapEntry>());
            }

            List<PanelConfigMapEntry> list = _mapTable[mapEntry.PanelClass];

            Log.Debug("Adding " + mapEntry);
            list.Add(mapEntry);
        }
示例#17
0
        /// <summary>
        /// Adds the specified Type to the cache keyed by
        /// the Guid.
        /// </summary>
        /// <param name="guid">Guid for the scanner</param>
        /// <param name="type">Scanner class Type</param>
        internal static void AddFormToCache(Guid guid, Type type)
        {
            if (_formsCache.ContainsKey(guid))
            {
                Log.Debug("Screen " + type.FullName + ", guid " + guid.ToString() + " is already added");
                return;
            }

            Log.Debug("Adding screen " + type.FullName + ", guid " + guid.ToString() + " to cache");
            _formsCache.Add(guid, type);

            var mapEntry = new PanelConfigMapEntry(type.Name, type.Name, (type.Name + ".xml").ToLower(), guid, type);
            Log.Debug("mapEntry.ConfigFileName: " + mapEntry.ConfigFileName);
            addToMapTable(mapEntry);

            updateFormTypeReferences(guid, type);
        }
示例#18
0
        /// <summary>
        /// Adds the specified mapEntry object to the map table. Also
        /// looks up the map table if it already has the formID specified
        /// in the mapEntry and updates its config file name with the
        /// one in mapEntry
        /// </summary>
        /// <param name="mapEntry">map entry to add</param>
        private static void addToMapTable(PanelConfigMapEntry mapEntry)
        {
            if (!_mapTable.ContainsKey(mapEntry.PanelClass))
            {
                _mapTable.Add(mapEntry.PanelClass, new List<PanelConfigMapEntry>());
            }

            List<PanelConfigMapEntry> list = _mapTable[mapEntry.PanelClass];
            #if abc
            foreach (var panelConfigMapEntry in list)
            {
                if (panelConfigMapEntry.FormId == mapEntry.FormId)
                {
                    panelConfigMapEntry.ConfigFileName = mapEntry.ConfigFileName;
                    return;
                }
            }
            #endif
            Log.Debug("Adding " + mapEntry);
            list.Add(mapEntry);
        }
示例#19
0
 /// <summary>
 /// Removes the specified map entry from the map table
 /// </summary>
 /// <param name="entryToRemove">entry to remove</param>
 private static void removeMapEntry(PanelConfigMapEntry entryToRemove)
 {
     foreach (List<PanelConfigMapEntry> list in _mapTable.Values)
     {
         foreach (PanelConfigMapEntry mapEntry in list)
         {
             if (mapEntry == entryToRemove)
             {
                 list.Remove(mapEntry);
                 return;
             }
         }
     }
 }