You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							161 lines
						
					
					
						
							5.1 KiB
						
					
					
				
			
		
		
	
	
							161 lines
						
					
					
						
							5.1 KiB
						
					
					
				using KGIS.Plugin.LayerProperty.EventHandler; | 
						|
using KGIS.Plugin.LayerProperty.Interface; | 
						|
using KGIS.Plugin.LayerProperty.Model; | 
						|
using System; | 
						|
using System.Collections.Generic; | 
						|
using System.Data; | 
						|
using System.Linq; | 
						|
using System.Text; | 
						|
using System.Threading.Tasks; | 
						|
 | 
						|
namespace KGIS.Plugin.LayerProperty.Utils | 
						|
{ | 
						|
    public class StyleGalleryFactory : IPlugIn | 
						|
    { | 
						|
        private static List<IDoStyleGalleryPath> m_DistStyleGalleryList; | 
						|
        private static DataTable dataSource; | 
						|
        public static List<IDoStyleGalleryPath> DistStyleGalleryPathList | 
						|
        { | 
						|
            get | 
						|
            { | 
						|
                return StyleGalleryFactory.m_DistStyleGalleryList; | 
						|
            } | 
						|
        } | 
						|
        public static DataTable DataSource | 
						|
        { | 
						|
            get | 
						|
            { | 
						|
                return StyleGalleryFactory.dataSource; | 
						|
            } | 
						|
            set | 
						|
            { | 
						|
                StyleGalleryFactory.dataSource = value; | 
						|
            } | 
						|
        } | 
						|
        public ICoreRDBHelper RDBHelper | 
						|
        { | 
						|
            set | 
						|
            { | 
						|
                //RdbUtil.RDBHelper = value; | 
						|
            } | 
						|
        } | 
						|
        public ITraceHandler TraceHandler | 
						|
        { | 
						|
            set | 
						|
            { | 
						|
                //Utils.Util.TraceHandler = value; | 
						|
            } | 
						|
        } | 
						|
        public ILogEvent Log | 
						|
        { | 
						|
            set | 
						|
            { | 
						|
                //Utils.Util.Log = value; | 
						|
            } | 
						|
        } | 
						|
        static StyleGalleryFactory() | 
						|
        { | 
						|
            StyleGalleryFactory.m_DistStyleGalleryList = new List<IDoStyleGalleryPath>(); | 
						|
        } | 
						|
        public static IDoStyleGalleryPath GetDistStyleGalleryPath(int PathID) | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                if (StyleGalleryFactory.m_DistStyleGalleryList == null || StyleGalleryFactory.m_DistStyleGalleryList.Count == 0) | 
						|
                { | 
						|
                    StyleGalleryFactory.LoadAllDistStyleGalleryPath(); | 
						|
                } | 
						|
                foreach (IDoStyleGalleryPath current in StyleGalleryFactory.m_DistStyleGalleryList) | 
						|
                { | 
						|
                    if (current.Number == (long)PathID) | 
						|
                    { | 
						|
                        return current; | 
						|
                    } | 
						|
                } | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                //RdbUtil.AddException(ex); | 
						|
            } | 
						|
            return null; | 
						|
        } | 
						|
        public static void LoadAllDistStyleGalleryPath() | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                //if (StyleGalleryFactory.m_DistStyleGalleryList == null) | 
						|
                //{ | 
						|
                //    StyleGalleryFactory.m_DistStyleGalleryList = new List<IDoStyleGalleryPath>(); | 
						|
                //} | 
						|
                //StyleGalleryFactory.m_DistStyleGalleryList.Clear(); | 
						|
                //StyleGalleryFactory.dataSource = StyleGalleryOptDB.GetStyleGalleryDataTable(); | 
						|
                //if (StyleGalleryFactory.dataSource != null) | 
						|
                //{ | 
						|
                //    foreach (DataRow dr in StyleGalleryFactory.dataSource.Rows) | 
						|
                //    { | 
						|
                //        DoStyleGalleryPath item = StyleGalleryOptDB.CreateGalleryPathFromDataRow(dr); | 
						|
                //        StyleGalleryFactory.m_DistStyleGalleryList.Add(item); | 
						|
                //    } | 
						|
                //} | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                //RdbUtil.AddException(ex); | 
						|
            } | 
						|
        } | 
						|
        //public static IDoStyleGalleryPath CreateNewDistStyleGalleryPath(string name, string AliasName, string description) | 
						|
        //{ | 
						|
        //    DoStyleGalleryPath doStyleGalleryPath = new DoStyleGalleryPath(); | 
						|
        //    doStyleGalleryPath.AliasName = AliasName; | 
						|
        //    doStyleGalleryPath.Description = description; | 
						|
        //    doStyleGalleryPath.Name = name; | 
						|
        //    bool flag = StyleGalleryOptDB.InsertNewDistStyleGallery(doStyleGalleryPath); | 
						|
        //    if (flag) | 
						|
        //    { | 
						|
        //        return doStyleGalleryPath; | 
						|
        //    } | 
						|
        //    return null; | 
						|
        //} | 
						|
        public static IDoStyleGallery CreateDistStyleGallery() | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                return new DoStyleGallery(); | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                //RdbUtil.AddException(ex); | 
						|
            } | 
						|
            return null; | 
						|
        } | 
						|
        public static bool RemoveStyleGalleryPath(IDoStyleGalleryPath gallery) | 
						|
        { | 
						|
            return false;// gallery != null && StyleGalleryOptDB.DeleteStyleGallery(gallery.Number); | 
						|
        } | 
						|
        public static void Clear() | 
						|
        { | 
						|
            StyleGalleryFactory.m_DistStyleGalleryList.Clear(); | 
						|
        } | 
						|
        public void SimpleCallBack(CallBack<string> param) | 
						|
        { | 
						|
            throw new Exception("The method or operation is not implemented."); | 
						|
        } | 
						|
        public void Initialize() | 
						|
        { | 
						|
            StyleGalleryFactory.m_DistStyleGalleryList = new List<IDoStyleGalleryPath>(); | 
						|
            StyleGalleryFactory.LoadAllDistStyleGalleryPath(); | 
						|
        } | 
						|
        public void Dispose() | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                StyleGalleryFactory.m_DistStyleGalleryList.Clear(); | 
						|
                StyleGalleryFactory.dataSource.Clear(); | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                //RdbUtil.AddException(ex); | 
						|
            } | 
						|
        } | 
						|
    } | 
						|
}
 | 
						|
 |