Exemplo n.º 1
0
        public void GivenModuleHasUrlReference_ThenCreateModuleContainersGeneratesExternalModuleForTheUrl()
        {
            var module = new Module("~/test");
            module.AddReferences(new[] { "http://test.com/api.js" });

            var externalModule = new Module("http://test.com/api.js");
            var moduleFactory = new Mock<IModuleFactory<Module>>();
            moduleFactory.Setup(f => f.CreateExternalModule("http://test.com/api.js"))
                .Returns(externalModule);
            var moduleFactories = new Dictionary<Type, object>
            {
                { typeof(Module), moduleFactory.Object }
            };
            var moduleSource = new Mock<IModuleSource<Module>>();
            moduleSource
                .Setup(s => s.GetModules(It.IsAny<IModuleFactory<Module>>(), It.IsAny<ICassetteApplication>()))
                .Returns(new[] { module });

            var config = new ModuleConfiguration(
                Mock.Of<ICassetteApplication>(),
                Mock.Of<IDirectory>(),
                Mock.Of<IDirectory>(),
                moduleFactories,
                ""
            );
            config.Add(moduleSource.Object);

            var containers = config.CreateModuleContainers(false, "");
            var generatedModule = containers[typeof(Module)].FindModuleContainingPath("http://test.com/api.js");
            generatedModule.ShouldBeSameAs(externalModule);
        }
 public void ShouldReturnTheModuleConfiguration()
 {
     var moduleConfiguration = new ModuleConfiguration(false, "script1.csx", false, LogLevel.Debug, false, new Dictionary<Type, object>());
     var config = moduleConfiguration.LineProcessor<UsingLineProcessor>();
     config.ShouldImplement<IModuleConfiguration>();
     config.ShouldEqual(moduleConfiguration);
 }
Exemplo n.º 3
0
 public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<String, IList<DeviceResourceDescriptor>> resources, Display display)
 {
     return new ArcGISMapSourceDesign 
     { 
         Type = this
     };
 }
Exemplo n.º 4
0
        public void Configure(ModuleConfiguration modules, ICassetteApplication application)
        {
            modules.Add(
                new PerSubDirectorySource<ScriptModule>("Scripts")
                {
                    FilePattern = "*.js",
                    Exclude = new Regex("-vsdoc\\.js$")
                },
                new ExternalScriptModule("twitter", "http://platform.twitter.com/widgets.js")
                {
                    Location = "body"
                }
            );

            modules.Add(new DirectorySource<StylesheetModule>("Styles")
            {
                FilePattern = "*.css;*.less",
                CustomizeModule = module => module.Processor = new StylesheetPipeline
                {
                    CompileLess = true,
                    ConvertImageUrlsToDataUris = true
                }
            });

            modules.Add(new PerSubDirectorySource<HtmlTemplateModule>("HtmlTemplates")
            {
                CustomizeModule = module => module.Processor = new KnockoutJQueryTmplPipeline()
            });
        }
Exemplo n.º 5
0
        //[XmlIgnore]
        //[Browsable(false)]
        //public override bool IsSupportPreview
        //{
        //    get { return true; }
        //}


        public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<string, IList<DeviceResourceDescriptor>> resources, Display display)
        {
            //IEDocumentSourceDesign source = new IEDocumentSourceDesign() { Type = this };
            //return source;

            return new IEDocumentSourceDesign { Type = this };
        }
Exemplo n.º 6
0
 public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
 {
     moduleConfiguration.Add(new DirectorySource<StylesheetModule>("assets/styles")
     {
         FilePattern = "*.css"
     });
 }
Exemplo n.º 7
0
 public CommonConfiguration(ModuleLoader loader, ModuleConfiguration configuration, IEventLogging logging)
 {
     this.loader = loader;
     this._logging = logging;
     _config = configuration;
     _labelStorageAdapter = CreateLabelStorageAdapter(configuration);
     _systemParametersAdapter = new SystemParametersAdapter();
 }
Exemplo n.º 8
0
 public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
 {
     moduleConfiguration.Add(new ExternalScriptModule("jquery", "//ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"));
     moduleConfiguration.Add(new PerSubDirectorySource<ScriptModule>("assets/scripts"));
     moduleConfiguration.Add(new DirectorySource<StylesheetModule>("assets/styles")
     {
         FilePattern = "*.css"
     });
 }
Exemplo n.º 9
0
 public LabelStorageAdapter(ModuleConfiguration config, string path, IEventLogging logging)
     : this(config, logging)
 {
     _filePath = path;
     LabelStorage customLabelStorage = LabelStorageExt.LoadStorage(path, config.LabelList, logging);
     _labelStorage.AddRange(customLabelStorage);
     _lastLabelId = (_labelStorage.Count > 0) ? _labelStorage.Max(x => x.Id) : 0;
     Check();
 }
Exemplo n.º 10
0
            public void ShouldAddTheLineProcessorTypeToTheOverridesDictionary()
            {
                var overrides = new Dictionary<Type, object>();

                var moduleConfiguration = new ModuleConfiguration(false, "script1.csx", false, LogLevel.Debug, false, overrides);
                moduleConfiguration.LineProcessor<UsingLineProcessor>();

                var processors = overrides[typeof(ILineProcessor)] as List<Type>;
                processors.ShouldContain(typeof(UsingLineProcessor));
            }
Exemplo n.º 11
0
 public LabelStorageAdapter(ModuleConfiguration config, IEventLogging logging)
 {
     //удаленная загрузка OnLine
     _logging = logging;
     if (config == null) return;
     _labelStorage.AddRange(config.LabelList);
     _lastLabelId = (_labelStorage.Count > 0) ? _labelStorage.Max(x => x.Id) : 0;
     _syncObject = ((ICollection)lockedLabels).SyncRoot;
     Check();
 }
 public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<String, IList<DeviceResourceDescriptor>> resources, Display display)
 {
     return new BusinessGraphicsSourceDesign 
     { 
         Type = this, 
         H = Convert.ToDouble(((DisplayTypeUriCapture)display.Type).HeightM),
         B = Convert.ToDouble(((DisplayTypeUriCapture)display.Type).WidthM),
         L = Convert.ToDouble(((DisplayTypeUriCapture)display.Type).DistanceM),
         Bp = Convert.ToDouble(((DisplayTypeUriCapture)display.Type).Width),
         Hp = Convert.ToDouble(((DisplayTypeUriCapture)display.Type).Height)
     };
 }
Exemplo n.º 13
0
  public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<String, IList<DeviceResourceDescriptor>> resources, Display display)
 {
     Source source = new VideoCameraSourceDesign {Type = this};
     VideoCameraDeviceConfig deviceConfig = (VideoCameraDeviceConfig)moduleConfiguration.DeviceList.SingleOrDefault(
         dt=>dt.GetType() == typeof(VideoCameraDeviceConfig) && dt.UID == this.UID);
     if (deviceConfig != null)
     {
         Device device =
             slide.DeviceList.SingleOrDefault(
                 dev => dev.Type.Name.Equals(deviceConfig.Name) && dev.Type.Type.Equals(deviceConfig.Type));
         if (device == null)
         {
             device = deviceConfig.CreateNewDevice(resources);
             slide.DeviceList.Add(device);
         }
         source.Device = device;
     }
     return source;
 }
Exemplo n.º 14
0
        /// <summary>
        /// должно вызываться после десериализации для инициализации ссылочных полей
        /// </summary>
        /// <returns>возвращается список оборудования которое отсутсвует в конфигурации и таким образом было исключено из сценария</returns>
        public string[] InitReference(ModuleConfiguration config, ResourceDescriptor[] descriptors,
            DeviceResourceDescriptor[] deviceResourceDescriptors)
        {
            foreach (KeyValuePair<int, SlideLinkList> pair in _linkDictionary)
            {
                foreach (Link link in pair.Value.LinkList)
                {
                    link.NextSlide = SlideList.Find(sl => sl.Id == link.NextSlideId);
                    if (link.NextSlide == null)
                        throw new KeyNotFoundException("SlideBulk.InitReference: Нет такого слайда в коллекции");
                }
            }

            // Initreference для каждого слайда
            List<string> deletedEquipment = new List<string>();
            foreach (Slide sl in SlideList)
            {
                deletedEquipment.AddRange(sl.InitReference(config, descriptors, deviceResourceDescriptors, true));
            }
            return deletedEquipment.Distinct().ToArray();
        }
Exemplo n.º 15
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="loader"></param>
        /// <param name="checkModules"></param>
        /// <param name="logging"></param>
        /// <param name="notThrowExceptionIfInvalideConfiguration"> используется ТОЛЬКО для дизайнера в автономном режиме</param>
        public CommonConfiguration(ModuleLoader loader, bool checkModules, IEventLogging logging, bool notThrowExceptionIfInvalideConfiguration)
        {
            this.loader = loader;
            this._logging = logging;
            string labelStoragePath;
            string moduleConfigFile = String.Empty;
            string configurationSchemaFile;
            try
            {
                string moduleConfigPath = labelStoragePath = Path.GetFullPath(ConfigurationFolder);
                moduleConfigFile = Path.Combine(moduleConfigPath, ConfigurationFile);
                labelStoragePath = Path.Combine(labelStoragePath, LabelFile);
                configurationSchemaFile = Path.Combine(moduleConfigPath, ConfigurationSchemaFile);
            }
            catch (ArgumentException ex)
            {
                throw new ModuleConfigurationException(moduleConfigFile);
            }

            try
            {
                _config = LoadModuleConfiguration(moduleConfigFile, configurationSchemaFile, this.loader.ModuleList);
                if (checkModules) CheckLoadedModules();
            }
            catch(Exception ex)
            {
                if (notThrowExceptionIfInvalideConfiguration)
                {
                    _config = new InvalideModuleConfiguration() {ErrorMessage = ex.Message, InnerException = ex};
                }
                else
                {
                    throw;
                }
            }

            _systemParametersAdapter = new SystemParametersAdapter();
            _labelStorageAdapter = CreateLabelStorageAdapter(_config, labelStoragePath);
        }
Exemplo n.º 16
0
        //TechnicalServices.Entity.XmlSerializableDictionary<string, int> _devicePositionList=new TechnicalServices.Entity.XmlSerializableDictionary<string,int>();

        protected override ILabelStorageAdapter CreateLabelStorageAdapter(ModuleConfiguration configuration)
        {
            return new ClientLabelStorageAdapter(configuration);
        }
Exemplo n.º 17
0
        public static Boolean IsReferenceModel(ModuleConfiguration module)
        {
            Boolean Result = Convert.ToBoolean(Agent.CallService("Yqun.BO.BusinessManager.dll", "IsReferenceModel", new object[] { module }));

            return(Result);
        }
Exemplo n.º 18
0
 public ConfigurationWriter(CommandProcessingService commandProcessingService, ModuleConfiguration ModuleConfiguration)
 {
     _commandProcessingService = commandProcessingService;
     _moduleConfiguration      = ModuleConfiguration;
     commandParsed             = false;
 }
Exemplo n.º 19
0
 public void ApplyConfiguration(ModuleConfiguration source)
 {
 }
Exemplo n.º 20
0
 public LEDMatrixRainModule(ModuleConfiguration moduleConfiguration) : base(moduleConfiguration)
 {
 }
Exemplo n.º 21
0
        private void StadiumItemSelector_Load(object sender, EventArgs e)
        {
            String ErrorInfo = "";

            ProgressScreen.Current.ShowSplashScreen();
            this.AddOwnedForm(ProgressScreen.Current);

            ProgressScreen.Current.SetStatus = "正在加载模板...";
            ModelInfo = DepositoryModuleConfiguration.InitModuleConfiguration(ModelIndex);

            try
            {
                fpSpread1.Sheets.Clear();
                foreach (SheetConfiguration Sheet in ModelInfo.Sheets)
                {
                    if (Sheet == null)
                    {
                        continue;
                    }

                    ProgressScreen.Current.SetStatus = "正在初始化表单‘" + Sheet.Description + "’";

                    SheetView SheetView = Serializer.LoadObjectXml(typeof(SheetView), Sheet.SheetStyle, "SheetView") as SheetView;
                    SheetView.Tag        = Sheet;
                    SheetView.SheetName  = Sheet.Description;
                    SheetView.ZoomFactor = 1.0F;
                    fpSpread1.Sheets.Add(SheetView);

                    SheetConfiguration Configuration = SheetView.Tag as SheetConfiguration;
                    if (Configuration.DataTableSchema.Schema == null)
                    {
                        continue;
                    }

                    foreach (FieldDefineInfo field in Configuration.DataTableSchema.Schema.FieldInfos)
                    {
                        SheetView.Cells[field.RangeInfo].BackColor = Color.LightPink;
                        SheetView.Cells[field.RangeInfo].Tag       = field;
                    }
                }

                lView_ExtentDataItems.Items.Clear();
                foreach (FieldDefineInfo fieldInfo in ModelInfo.ExtentDataSchema.FieldInfos)
                {
                    ListViewItem Item = new ListViewItem();
                    Item.Text = fieldInfo.FieldName;
                    Item.Tag  = fieldInfo;
                    Item.SubItems.Add(fieldInfo.Description);
                    Item.SubItems.Add(fieldInfo.FieldType.Description);


                    lView_ExtentDataItems.Items.Add(Item);
                }
            }
            catch (Exception ex)
            {
                ErrorInfo = ex.Message;
            }

            this.RemoveOwnedForm(ProgressScreen.Current);
            ProgressScreen.Current.CloseSplashScreen();
            Activate();

            label2.BackColor = Color.LightPink;

            if (ErrorInfo != "")
            {
                MessageBox.Show("加载模板出错!\r\n原因:" + ErrorInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 22
0
        //产生监理平行资料
        public DataSet NewPingXingData(ModuleConfiguration module, String DataID, String DataCode, String RelationCode, String RelationID)
        {
            DataSet CopyData = DataManager.GetData(module, RelationID, RelationCode);
            DataSet Data     = CopyData.Clone();

            foreach (DataTable data in CopyData.Tables)
            {
                DataRow newRow = Data.Tables[data.TableName].NewRow();
                Data.Tables[data.TableName].Rows.Add(newRow);

                newRow.ItemArray = data.Rows[0].ItemArray;
                newRow["ID"]     = DataID;
                newRow["SCPT"]   = DataCode;
                newRow["SCTS"]   = DateTime.Now.ToString();
                newRow["SCCT"]   = RelationCode;
                newRow["SCCS"]   = RelationID;
            }

            foreach (SheetConfiguration Sheet in module.Sheets)
            {
                if (Sheet.DataTableSchema.Schema == null)
                {
                    continue;
                }

                String TableName = string.Format("[{0}]", Sheet.DataTableSchema.Schema.Name);
                if (CopyData.Tables.Contains(TableName) && Data.Tables.Contains(TableName))
                {
                    DataTable CopyDataTable = Data.Tables[TableName];
                    DataRow   Row           = CopyDataTable.Rows[0];
                    DataTable DataTable     = Data.Tables[TableName];
                    DataRow   newRow        = DataTable.Rows[0];
                    foreach (FieldDefineInfo Field in Sheet.DataTableSchema.Schema.FieldInfos)
                    {
                        if (!Field.IsPingxing)
                        {
                            newRow[Field.FieldName] = DBNull.Value;
                        }
                    }
                }
                else if (!CopyData.Tables.Contains(TableName))
                {
                    logger.Error(string.Format("试验‘{0}’中未找到表‘{1}’的数据行。", module.Description, TableName));
                }
            }

            //自动录入委托日期字段
            foreach (SheetConfiguration Sheet in module.Sheets)
            {
                if (Sheet.DataTableSchema.Schema == null)
                {
                    continue;
                }

                String    TableName = string.Format("[{0}]", Sheet.DataTableSchema.Schema.Name);
                DataTable DataTable = Data.Tables[TableName];
                DataRow   dataRow   = DataTable.Rows[0];
                foreach (FieldDefineInfo Field in Sheet.DataTableSchema.Schema.FieldInfos)
                {
                    if (Field.Description == FieldStrings.委托日期)
                    {
                        dataRow[Field.FieldName] = DateTime.Now;
                    }
                }
            }

            DataTable ExtentData = Data.Tables[string.Format("[biz_norm_extent_{0}]", module.Index)];

            foreach (DataColumn col in ExtentData.Columns)
            {
                if (col.ColumnName == "TryType")
                {
                    ExtentData.Rows[0]["TryType"] = "平行";
                }
            }

            return(Data);
        }
Exemplo n.º 23
0
 //获得资料数据
 public DataSet GetData(ModuleConfiguration module, String DataID, String DataCode)
 {
     return(DataManager.GetData(module, DataID, DataCode));
 }
Exemplo n.º 24
0
        //复制资料
        public DataSet CopyData(ModuleConfiguration module, String[] DataID, String DataCode)
        {
            DataSet Data    = DataManager.GetData(module, DataID, DataCode);
            DataSet NewData = Data.Copy();

            List <String> DataList = new List <string>();

            for (int i = 0; i < DataID.Length; i++)
            {
                DataList.Add(Guid.NewGuid().ToString());
            }

            foreach (DataTable DataTable in NewData.Tables)
            {
                for (int i = 0; i < DataTable.Rows.Count; i++)
                {
                    DataTable.Rows[i]["ID"]   = DataList[i];
                    DataTable.Rows[i]["SCCS"] = Guid.NewGuid().ToString();
                }
            }

            Dictionary <string, List <string> > Fields = new Dictionary <string, List <string> >();

            foreach (SheetConfiguration sheetConfiguration in module.Sheets)
            {
                if (sheetConfiguration.DataTableSchema.Schema == null)
                {
                    continue;
                }

                TableDefineInfo TableInfo = sheetConfiguration.DataTableSchema.Schema;
                foreach (FieldDefineInfo field in TableInfo.FieldInfos)
                {
                    if (field.IsKeyField)
                    {
                        if (!Fields.ContainsKey(TableInfo.Name))
                        {
                            Fields.Add(TableInfo.Name, new List <string>());
                        }

                        Fields[TableInfo.Name].Add(field.FieldName);
                    }
                }
            }

            foreach (DataTable DataTable in NewData.Tables)
            {
                if (!Fields.ContainsKey(DataTable.TableName))
                {
                    continue;
                }

                for (int i = 0; i < DataTable.Rows.Count; i++)
                {
                    foreach (String key in Fields[DataTable.TableName])
                    {
                        DataTable.Rows[i][key] = "";
                    }
                }
            }

            if (DataManager.UpdateData(module.Index, NewData, false))
            {
                return(Data);
            }
            else
            {
                return(new DataSet());
            }
        }
Exemplo n.º 25
0
 //删除资料
 public Boolean DeleteData(String ModuleCode, ModuleConfiguration module)
 {
     return(DataManager.DeleteData(module, ModuleCode));
 }
Exemplo n.º 26
0
 //删除资料
 public Boolean DeleteData(ModuleConfiguration module, String DataID, String ModelCode)
 {
     return(DataManager.DeleteData(module, DataID, ModelCode));
 }
Exemplo n.º 27
0
        //产生监理平行资料
        public DataSet NewPingXingData(ModuleConfiguration module, String DataCode, String RelationCode, String RelationID)
        {
            String DataID = Guid.NewGuid().ToString();

            return(NewPingXingData(module, DataID, DataCode, RelationCode, RelationID));
        }
Exemplo n.º 28
0
 protected virtual ILabelStorageAdapter CreateLabelStorageAdapter(ModuleConfiguration configuration, string labelStoragePath)
 {
     return new LabelStorageAdapter(configuration, labelStoragePath, _logging);
 }
Exemplo n.º 29
0
 public ClientLabelStorageAdapter(ModuleConfiguration config)
 {
     if (config == null) return;
     foreach(Label item in config.LabelList)
         _labelStorage.Add(item);
 }
 public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<string, IList<DeviceResourceDescriptor>> resources, Display display)
 {
     PowerPointPresentationSourceDesign source = new PowerPointPresentationSourceDesign() { Type = this };
     return source;
 }
Exemplo n.º 31
0
 public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
 {
     moduleConfiguration.Add(Mock.Of<IModuleSource<ScriptModule>>());
     moduleConfiguration.Add(Mock.Of<IModuleSource<StylesheetModule>>());
     moduleConfiguration.Add(Mock.Of<IModuleSource<HtmlTemplateModule>>());
 }
Exemplo n.º 32
0
 public BooleanFieldModel(int id, ModuleConfiguration mConfig)
     : base(id, mConfig, VIEW)
 {
     _currentValue = mConfig.ConfigurationItem.CurrentValue;
 }
Exemplo n.º 33
0
 public LabelFieldModel(int id, ModuleConfiguration mConfig)
     : base(id, mConfig, VIEW)
 {
 }
Exemplo n.º 34
0
        protected override void OnInitialize(ModuleConfiguration configuration)
        {
            StackingConfig stackingConfig = configuration as StackingConfig;

            MaxAmount = stackingConfig.MaxAmount;
        }
Exemplo n.º 35
0
 string GetAssemblyDir(ModuleConfiguration configuration)
 {
     return(Path.Combine(ApplicationPath, configuration.Path));
 }
Exemplo n.º 36
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker    worker = sender as BackgroundWorker;
            BatchPrintClass     Params = e.Argument as BatchPrintClass;
            ModuleConfiguration Model  = Params.modelInfo;
            String DataCode            = Params.dataCode;

            ModelDataManager DataManager = new ModelDataManager();
            DataSet          dataSet     = new DataSet();

            if (dataID != null)
            {
                dataSet = DataManager.GetData(Model, dataID, DataCode);
            }
            else
            {
                dataSet = DataManager.GetData(Model, DataCode);
            }

            FpSpread fpSpread = new MyCell();

            PrintDialog Dialog = new PrintDialog();

            Dialog.AllowSomePages             = true;
            Dialog.PrinterSettings.PrintRange = PrintRange.SomePages;
            Dialog.PrinterSettings.FromPage   = 1;
            Dialog.PrinterSettings.ToPage     = 1;
            if (DialogResult.OK == Dialog.ShowDialog())
            {
                //初始化模板样式
                fpSpread.Sheets.Clear();
                foreach (SheetConfiguration Sheet in Model.Sheets)
                {
                    SheetView SheetView = Serializer.LoadObjectXml(typeof(SheetView), Sheet.SheetStyle, "SheetView") as SheetView;
                    SheetView.Tag       = Sheet;
                    SheetView.SheetName = Sheet.Description;
                    fpSpread.Sheets.Add(SheetView);
                }

                fpSpread.LoadFormulas(true);

                //加载数据到模板样式
                if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow Row in dataSet.Tables[0].Rows)
                    {
                        Application.DoEvents();

                        int Index = dataSet.Tables[0].Rows.IndexOf(Row);
                        worker.ReportProgress((Index + 1) / dataSet.Tables[0].Rows.Count);

                        String DataID = Row["ID"].ToString();
                        foreach (SheetView SheetView in fpSpread.Sheets)
                        {
                            SheetConfiguration SheetConfiguration = SheetView.Tag as SheetConfiguration;
                            TableDefineInfo    TableInfo          = SheetConfiguration.DataTableSchema.Schema;
                            if (TableInfo != null)
                            {
                                foreach (FieldDefineInfo FieldInfo in TableInfo.FieldInfos)
                                {
                                    DataRow[] DataRows = dataSet.Tables[GetBracketName(TableInfo.Name)].Select("ID='" + DataID + "'");
                                    SheetView.Cells[FieldInfo.RangeInfo].Value = DataRows[0][FieldInfo.FieldName];
                                }
                            }
                        }

                        //批量打印
                        BatchPrintDocument Document = new BatchPrintDocument(fpSpread);
                        Document.PrinterSettings = Dialog.PrinterSettings;
                        Document.Print();
                    }

                    e.Result = "已输出全部资料到打印机。";
                }
                else
                {
                    e.Result = string.Format("模板 {0} 中没有资料数据。", Model.Description);
                }

                fpSpread.Dispose();
                fpSpread = null;
            }
            else
            {
                return;
            }
        }
Exemplo n.º 37
0
 public LEDFluidModule(ModuleConfiguration moduleConfiguration) : base(moduleConfiguration)
 {
     _fluid = new Fluid(N, 0.2f, 0, 0.0001f);
 }
Exemplo n.º 38
0
        public static Boolean UpdateSheetConfigurations(ModuleConfiguration module)
        {
            Boolean Result = Convert.ToBoolean(Agent.CallService("Yqun.BO.BusinessManager.dll", "UpdateSheetConfigurations", new object[] { module }));

            return(Result);
        }
Exemplo n.º 39
0
 public TextAreaFieldModel(int id, ModuleConfiguration mConfig)
     : base(id, mConfig, VIEW)
 {
 }
Exemplo n.º 40
0
        public ReturnObject GetFieldValues(RequestObject r)
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            currentPage  = new PageSettings(siteSettings.SiteId, r.PageId);
            var allowed = false;

            if (currentPage != null)
            {
                allowed = WebUser.IsInRoles(currentPage.AuthorizedRoles);
            }

            module = new Module(r.ModuleId);

            if (module != null)
            {
                allowed = WebUser.IsInRoles(module.ViewRoles);
            }

            if (!allowed)
            {
                return(new ReturnObject()
                {
                    Status = "error",
                    ExtraData = new Dictionary <string, string>
                    {
                        ["ErrorCode"] = "100",
                        ["ErrorMessage"] = "Not Allowed"
                    }
                });
            }

            config = new ModuleConfiguration(module);

            var fieldValues = ItemFieldValue.GetPageOfValues(
                module.ModuleGuid,
                config.FieldDefinitionGuid,
                r.Field,
                r.PageNumber,
                r.PageSize,
                out int totalPages,
                out int totalRows
                );

            // much of the below is temporary, we needed to implement in a hurry
            // TODO: implement distinct on sql side
            var values  = new List <string>();
            var dbField = new Field(fieldValues.Select(fv => fv.FieldGuid).FirstOrDefault());

            switch (dbField.ControlType)
            {
            case "DynamicCheckBoxList":
                foreach (ItemFieldValue val in fieldValues)
                {
                    values.AddRange(val.FieldValue.SplitOnCharAndTrim(';'));
                }

                break;

            default:
                values = fieldValues.Select(fv => fv.FieldValue).ToList();

                break;
                //we will add the other cases later
            }

            values    = values.Distinct().OrderBy(v => v).ToList();
            totalRows = values.Count();

            return(new ReturnObject()
            {
                Status = "success",
                Data = values,
                TotalPages = totalPages,
                TotalRows = totalRows
            });
        }
Exemplo n.º 41
0
 public LEDNoneModule(ModuleConfiguration moduleConfiguration) : base(moduleConfiguration)
 {
 }
Exemplo n.º 42
0
 public DropdownFieldModel(int id, ModuleConfiguration mConfig)
     : base(id, mConfig, VIEW)
 {
     Items = new List <SelectListItem>();
     BindItems();
 }
Exemplo n.º 43
0
 public LEDShowGifModule(ModuleConfiguration moduleConfiguration) : base(moduleConfiguration)
 {
     _fileName  = moduleConfiguration.Parameter;
     _nextFrame = 0;
 }
Exemplo n.º 44
0
        public LEDCubeModule(ModuleConfiguration moduleConfiguration) : base(moduleConfiguration, 3f)
        {
            meshCube.Tris = new List <Triangle>()
            {
                // SOUTH
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(0.0f, 0.0f, 0.0f, 1.0f), new Vector3D(0.0f, 1.0f, 0.0f, 1.0f), new Vector3D(1.0f, 1.0f, 0.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(0.0f, 0.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f)
                }),
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(0.0f, 0.0f, 0.0f, 1.0f), new Vector3D(1.0f, 1.0f, 0.0f, 1.0f), new Vector3D(1.0f, 0.0f, 0.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f), new Vector2D(1.0f, 1.0f, 1.0f)
                }),

                // EAST
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(1.0f, 0.0f, 0.0f, 1.0f), new Vector3D(1.0f, 1.0f, 0.0f, 1.0f), new Vector3D(1.0f, 1.0f, 1.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(0.0f, 0.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f)
                }),
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(1.0f, 0.0f, 0.0f, 1.0f), new Vector3D(1.0f, 1.0f, 1.0f, 1.0f), new Vector3D(1.0f, 0.0f, 1.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f), new Vector2D(1.0f, 1.0f, 1.0f)
                }),

                // NORTH
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(1.0f, 0.0f, 1.0f, 1.0f), new Vector3D(1.0f, 1.0f, 1.0f, 1.0f), new Vector3D(0.0f, 1.0f, 1.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(0.0f, 0.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f)
                }),
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(1.0f, 0.0f, 1.0f, 1.0f), new Vector3D(0.0f, 1.0f, 1.0f, 1.0f), new Vector3D(0.0f, 0.0f, 1.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f), new Vector2D(1.0f, 1.0f, 1.0f)
                }),

                // WEST
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(0.0f, 0.0f, 1.0f, 1.0f), new Vector3D(0.0f, 1.0f, 1.0f, 1.0f), new Vector3D(0.0f, 1.0f, 0.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(0.0f, 0.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f)
                }),
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(0.0f, 0.0f, 1.0f, 1.0f), new Vector3D(0.0f, 1.0f, 0.0f, 1.0f), new Vector3D(0.0f, 0.0f, 0.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f), new Vector2D(1.0f, 1.0f, 1.0f)
                }),

                // TOP
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(0.0f, 1.0f, 0.0f, 1.0f), new Vector3D(0.0f, 1.0f, 1.0f, 1.0f), new Vector3D(1.0f, 1.0f, 1.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(0.0f, 0.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f)
                }),
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(0.0f, 1.0f, 0.0f, 1.0f), new Vector3D(1.0f, 1.0f, 1.0f, 1.0f), new Vector3D(1.0f, 1.0f, 0.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f), new Vector2D(1.0f, 1.0f, 1.0f)
                }),

                // BOTTOM
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(1.0f, 0.0f, 1.0f, 1.0f), new Vector3D(0.0f, 0.0f, 1.0f, 1.0f), new Vector3D(0.0f, 0.0f, 0.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(0.0f, 0.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f)
                }),
                new Triangle(new List <Vector3D>()
                {
                    new Vector3D(1.0f, 0.0f, 1.0f, 1.0f), new Vector3D(0.0f, 0.0f, 0.0f, 1.0f), new Vector3D(1.0f, 0.0f, 0.0f, 1.0f)
                }, new List <Vector2D>()
                {
                    new Vector2D(0.0f, 1.0f, 1.0f), new Vector2D(1.0f, 0.0f, 1.0f), new Vector2D(1.0f, 1.0f, 1.0f)
                }),
            };

            matProj = Mat4x4.MakeProjection(90.0f, (float)renderHeight / (float)renderWidth, 0.1f, 1000.0f);
        }
Exemplo n.º 45
0
 protected override TechnicalServices.Interfaces.ILabelStorageAdapter CreateLabelStorageAdapter(ModuleConfiguration configuration, string labelStoragePath)
 {
     return new ClientLabelStorageAdapter(configuration);
 }
Exemplo n.º 46
0
        public ReturnObject GetModuleItems(RequestObject r)
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            currentPage  = new PageSettings(siteSettings.SiteId, r.PageId);
            var allowed = false;

            if (currentPage != null)
            {
                allowed = WebUser.IsInRoles(currentPage.AuthorizedRoles);
            }

            module = new Module(r.ModuleId);

            if (module != null)
            {
                allowed = WebUser.IsInRoles(module.ViewRoles);
            }

            if (!allowed)
            {
                return(new ReturnObject()
                {
                    Status = "error",
                    ExtraData = new Dictionary <string, string>
                    {
                        ["ErrorCode"] = "100",
                        ["ErrorMessage"] = "Not Allowed"
                    }
                });
            }

            config = new ModuleConfiguration(module);

            var totalPages = 0;
            var totalRows  = 0;
            var items      = new List <ItemWithValues>();

            if (r.SearchObject != null && r.SearchObject.Count > 0)
            {
                foreach (var set in r.SearchObject)
                {
                    if (set.Value.Contains(";"))
                    {
                        foreach (var setA in set.Value.SplitOnCharAndTrim(';'))
                        {
                            items.AddRange(
                                GetItems(
                                    module.ModuleGuid,
                                    r.PageNumber,
                                    r.PageSize,
                                    out totalPages,
                                    out totalRows,
                                    setA,
                                    set.Key,
                                    r.GetAllForSolution
                                    )
                                );
                        }
                    }
                    else
                    {
                        items.AddRange(
                            GetItems(
                                module.ModuleGuid,
                                r.PageNumber,
                                r.PageSize,
                                out totalPages,
                                out totalRows,
                                set.Value,
                                set.Key,
                                r.GetAllForSolution
                                )
                            );
                    }
                }

                items = items.Distinct(new SimpleItemWithValuesComparer()).ToList();
            }
            else
            {
                items.AddRange(
                    GetItems(
                        module.ModuleGuid,
                        r.PageNumber,
                        r.PageSize,
                        out totalPages,
                        out totalRows,
                        r.SearchTerm,
                        r.SearchField,
                        r.GetAllForSolution,
                        r.SortDescending
                        )
                    );
            }

            var sfObject = new SuperFlexiObject()
            {
                FriendlyName    = config.ModuleFriendlyName,
                ModuleTitle     = module.ModuleTitle,
                GlobalSortOrder = config.GlobalViewSortOrder,
                Items           = items
            };

            return(new ReturnObject()
            {
                Status = "success",
                TotalPages = totalPages,
                TotalRows = totalRows > items.Count ? totalRows : items.Count,
                AllowEdit = ShouldAllowEdit(),
                CmsModuleId = module.ModuleId,
                CmsPageId = module.PageId,
                Data = sfObject
            });
        }
Exemplo n.º 47
0
 public Settings(SerialPort Port, ConfigurationReader ConfigurationReader, ConfigurationWriter ConfigurationWriter, ModuleConfiguration ModuleConfiguration, LocalServerConfiguration ServerConfiguration)
 {
     InitializeComponent();
     _SerialPort          = Port;
     _ModuleConfiguration = ModuleConfiguration;
     _ConfigurationReader = ConfigurationReader;
     _ConfigurationWriter = ConfigurationWriter;
     _ServerConfiguration = ServerConfiguration;
 }
Exemplo n.º 48
0
 public ClientConfiguration(ModuleLoader loader, ModuleConfiguration configuration, IEventLogging logging) :
     base(loader, configuration, logging)
 {
     _isStandalone = false;
 }
Exemplo n.º 49
0
 public LEDAmigaBallModule(ModuleConfiguration moduleConfiguration) : base(moduleConfiguration)
 {
 }
Exemplo n.º 50
0
 public AgentConfiguration(ModuleLoader loader, ModuleConfiguration configuration, IEventLogging logging)
     : base(loader, configuration, logging)
 {
 }
Exemplo n.º 51
0
 /// <summary>
 /// 创建 ModuleConfiguration 的静态实例。
 /// </summary>
 static ModuleConfiguration()
 {
     m_config = new ModuleConfiguration();
 }
Exemplo n.º 52
0
            public void ShouldLoadEngineModuleFromFile()
            {
                _mockAssemblyUtility.Setup(x => x.LoadFile(It.IsAny<string>())).Returns(typeof (DummyModule).Assembly);
                var loader = new ModuleLoader(_mockAssemblyResolver.Object, _mockLogger.Object, (a, c) => { }, _getModules, _mockFileSystem.Object, _mockAssemblyUtility.Object);

                var config = new ModuleConfiguration(true, string.Empty, false, LogLevel.Debug, true,
                    new Dictionary<Type, object> {{typeof (string), "not loaded"}});
                loader.Load(config, new string[0], "c:\\foo", ModuleLoader.DefaultCSharpExtension, "roslyn");

                config.Overrides[typeof(string)].ShouldEqual("module loaded");
            }
Exemplo n.º 53
0
 public TCPCheck(ModuleConfiguration configuration, ILogger logger) : base(configuration, logger)
 {
 }
Exemplo n.º 54
0
        private void LoadModuleControl()
        {
            try
            {
                _socialGroupId = GetUrlGroupId();
                _socialUserId  = GetUrlUserId();
                var objModules       = new ModuleController();
                var objModule        = objModules.GetModule(ModuleId, TabId);
                var objDesktopModule =
                    DesktopModuleController.GetDesktopModule(objModule.DesktopModuleID, PortalId);
                var objEventInfoHelper = new EventInfoHelper(ModuleId, TabId, PortalId, Settings);

                // Force Module Default Settings on new Version or New Module Instance
                if (objDesktopModule.Version != Settings.Version)
                {
                    CreateThemeDirectory();
                    //                    objEventInfoHelper.SetDefaultModuleSettings(ModuleId, TabId, Page, LocalResourceFile)
                }

                if (!(Request.QueryString["mctl"] == null) &&
                    (ModuleId == Convert.ToInt32(Request.QueryString["ModuleID"]) ||
                     ModuleId == Convert.ToInt32(Request.QueryString["mid"])))
                {
                    if (Request["mctl"].EndsWith(".ascx"))
                    {
                        _mcontrolToLoad = Request["mctl"];
                    }
                    else
                    {
                        _mcontrolToLoad = Request["mctl"] + ".ascx";
                    }
                }

                // Set Default, if none selected
                if (_mcontrolToLoad.Length == 0)
                {
                    if (!ReferenceEquals(Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)), null))
                    {
                        _mcontrolToLoad = Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)).Value;
                    }
                    else
                    {
                        // See if Default View Set
                        _mcontrolToLoad = Settings.DefaultView;
                    }
                }

                // Check for Valid Module to Load
                _mcontrolToLoad = Path.GetFileNameWithoutExtension(_mcontrolToLoad) + ".ascx";
                switch (_mcontrolToLoad.ToLower())
                {
                case "eventdetails.ascx":
                    // Search and RSS feed may direct detail page url to base module -
                    // should be put in new page
                    if (Settings.Eventdetailnewpage)
                    {
                        //Get the item id of the selected event
                        if (!ReferenceEquals(Request.Params["ItemId"], null))
                        {
                            _itemId = int.Parse(Request.Params["ItemId"]);
                            var objCtlEvents = new EventController();
                            var objEvent     = objCtlEvents.EventsGet(_itemId, ModuleId);
                            if (!ReferenceEquals(objEvent, null))
                            {
                                Response.Redirect(
                                    objEventInfoHelper.GetDetailPageRealURL(
                                        objEvent.EventID, _socialGroupId, _socialUserId));
                            }
                        }
                    }
                    break;

                case "eventday.ascx":
                    break;

                case "eventmonth.ascx":
                    break;

                case "eventweek.ascx":
                    break;

                case "eventrpt.ascx":
                    if (Settings.ListViewGrid)
                    {
                        _mcontrolToLoad = "EventList.ascx";
                    }
                    break;

                case "eventlist.ascx":
                    if (!Settings.ListViewGrid)
                    {
                        _mcontrolToLoad = "EventRpt.ascx";
                    }
                    break;

                case "eventmoderate.ascx":
                    Response.Redirect(
                        objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(TabId, "Moderate", "Mid=" + ModuleId),
                            "?"));
                    break;

                case "eventmyenrollments.ascx":
                    break;

                default:
                    lblModuleSettings.Text    = Localization.GetString("lblBadControl", LocalResourceFile);
                    lblModuleSettings.Visible = true;
                    return;
                }

                var objPortalModuleBase = (PortalModuleBase)LoadControl(_mcontrolToLoad);
                objPortalModuleBase.ModuleConfiguration = ModuleConfiguration.Clone();
                objPortalModuleBase.ID = Path.GetFileNameWithoutExtension(_mcontrolToLoad);
                phMain.Controls.Add(objPortalModuleBase);

                //EVT-4499 Exlude the EventMyEnrollment.ascx to be set as cookie
                if (_mcontrolToLoad.ToLower() != "eventdetails.ascx" &&
                    _mcontrolToLoad.ToLower() != "eventday.ascx" &&
                    _mcontrolToLoad.ToLower() != "eventmyenrollments.ascx")
                {
                    var objCookie = new HttpCookie("DNNEvents" + Convert.ToString(ModuleId));
                    objCookie.Value = _mcontrolToLoad;
                    if (ReferenceEquals(Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)), null))
                    {
                        Response.Cookies.Add(objCookie);
                    }
                    else
                    {
                        Response.Cookies.Set(objCookie);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 55
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            if (WebConfig.Enabled)
            {
                services.AddSignalR();

                services.Configure <CookiePolicyOptions>(options =>
                {
                    options.CheckConsentNeeded    = context => true;
                    options.MinimumSameSitePolicy = SameSiteMode.None;
                });

                services.Configure <ForwardedHeadersOptions>(options =>
                {
                    options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
                });

                services.AddDatabaseDeveloperPageExceptionFilter();
            }

            services.AddDbContext <SpikeCoreDbContext>(options =>
            {
                options.UseSqlite(Configuration.GetConnectionString("SpikeCoreDbContextConnection"));
            });

            services
            .AddDefaultIdentity <SpikeCoreUser>(options =>
            {
                options.Password.RequireDigit           = false;
                options.Password.RequireLowercase       = false;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequireUppercase       = false;
            })
            .AddRoles <IdentityRole>()
            .AddEntityFrameworkStores <SpikeCoreDbContext>()
            .AddDefaultTokenProviders()
            .AddPasswordlessLoginTokenProvider()
            .AddUserStore <SpikeCoreUserStore>();

            if (WebConfig.Enabled)
            {
                services
                .AddMvc()
                .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

                services.ConfigureApplicationCookie(options =>
                {
                    // Make sure our [Authorize] annotations bounce people to an access denied, instead of a login.
                    // Users can only login through special URLs generated by the bot.
                    options.LoginPath = "/Identity/Account/AccessDenied";
                });
            }

            services.AddHttpClient();

            var containerBuilder = new ContainerBuilder();

            containerBuilder.Populate(services);

            var ircConnectionConfig = new IrcConnectionConfig();

            Configuration.GetSection("IrcConnection").Bind(ircConnectionConfig);
            containerBuilder.RegisterInstance(ircConnectionConfig);

            var moduleConfiguration = new ModuleConfiguration();

            Configuration.GetSection("Modules").Bind(moduleConfiguration);
            containerBuilder.RegisterInstance(moduleConfiguration);

            containerBuilder
            .RegisterFoundatio();

            // Register this as a singleton so both our modules and ASP.NET infrastructure get the same instance.
            // Removing this causes our modules and controllers to get different instances of a UserManager, which,
            // due to EF means that making updates via one is not available to the other.
            containerBuilder.RegisterType <UserManager <SpikeCoreUser> >()
            .As <UserManager <SpikeCoreUser> >()
            .PropertiesAutowired()
            .SingleInstance();

            containerBuilder
            .RegisterType <IrcConnection>()
            .As <IIrcConnection>()
            .SingleInstance();

            containerBuilder
            .RegisterType <IrcClient>()
            .As <IIrcClient>()
            .PropertiesAutowired()
            .SingleInstance();

            containerBuilder
            .RegisterType <SignalRMessageBusConnector>()
            .As <ISignalRMessageBusConnector>()
            .SingleInstance();

            containerBuilder
            .RegisterType <LoggingListener>()
            .SingleInstance();

            containerBuilder
            .RegisterAssemblyTypes(typeof(IModule).Assembly)
            .Where(t => t.Name.EndsWith("Module"))
            .As <IModule>()
            .PropertiesAutowired()
            .SingleInstance();

            var container = containerBuilder.Build();

            // Grab an instance of IBot so that it gets activated.
            // We don't need to keep hold of it, it's a singleton.
            // Using AutoActivate meant RegisterFoundatio wasn't able to hook Activated before activation.
            container.Resolve <IIrcConnection>();

            // We also need to resolve all of our modules.
            container.Resolve <IEnumerable <IModule> >();
            container.Resolve <LoggingListener>();

            return(new AutofacServiceProvider(container));
        }