예제 #1
0
 public void TrimGesture()
 {
     Applications.ForEach(app => app?.Actions?.ForEach(a =>
     {
         if (!GestureManager.Instance.GestureExists(a.GestureName))
         {
             a.GestureName = string.Empty;
         }
     }));
     SaveApplications();
 }
예제 #2
0
        public void RenameGesture(string newName, string oldName)
        {
            Applications.ForEach(app => app.Actions?.ForEach(action =>
            {
                if (action.GestureName == oldName)
                {
                    action.GestureName = newName;
                }
            }));

            SaveApplications();
        }
예제 #3
0
        public EbDataSet GetOfflineData()
        {
            EbDataSet ds = new EbDataSet();

            Applications?.ForEach(item =>
            {
                if (item.OfflineData != null)
                {
                    ds.Tables.AddRange(item.OfflineData.Tables);
                }
            });
            return(ds);
        }
예제 #4
0
        /// <summary>
        /// Set applications
        /// </summary>
        private void setApplications()
        {
            // set data store
            ApplicationsWithConfiguration = new List <ApplicationConfigurationModel>();

            // loop assemblies
            foreach (var assembly in _assemblies)
            {
                // find application types
                var appTypes = assembly.GetTypes().Where(x => x.IsSubclassOf(_appBaseType));

                // loop them and add
                foreach (var appType in appTypes)
                {
                    var rootConfig = new SingularApplicationConfigurationRoot();

                    var app = (SingularApplicationBase)Activator.CreateInstance(appType);

                    rootConfig.Application = app;

                    app.Configure(rootConfig);

                    ApplicationsWithConfiguration.Add(new ApplicationConfigurationModel
                    {
                        Application       = app,
                        ConfigurationRoot = rootConfig
                    });
                }
            }

            // Set applications on this object
            Applications = ApplicationsWithConfiguration.Select(x => x.Application).ToList();

            // Set admin sections on this object
            Sections = Applications.SelectMany(x => x.AdminSections).ToList();

            // set controller installers
            Applications.ForEach(x =>
            {
                if (x.ControllerInstaller != null)
                {
                    AddControllerInstaller(x.ControllerInstaller);
                }
            });

            // set web api controller installers
            Applications.ForEach(x =>
            {
                if (x.WebApiControllerInstaller != null)
                {
                    AddWebApiControllerInstaller(x.WebApiControllerInstaller);
                }
            });

            // set app start methods
            AppStartMethods = Applications.Where(x => x.AppStartMethod != null).Select(x => x.AppStartMethod).ToList();

            // node types
            NodeTypes = Applications.SelectMany(x => x.NodeTypes).OrderBy(x => x.Name).ToList();
            foreach (var def in NodeTypes)
            {
                if (!string.IsNullOrEmpty(def.AllowedChildTypeMagicNames))
                {
                    var allowedTypes = new List <NodeTypeDefinition>();
                    foreach (var magicName in def.AllowedChildTypeMagicNames.Split(','))
                    {
                        // find
                        var found = NodeTypes.FirstOrDefault(x => x.MagicName == magicName);
                        if (found != null)
                        {
                            allowedTypes.Add(found.SlowParameterlessConstructorClone());
                        }
                        def.AllowedChildTypes = allowedTypes.OrderBy(x => x.Name).ToList();
                    }
                }
            }
        }