Esempio n. 1
0
 private async Task SaveLegalEntities(ResourceList accountLegalEntities)
 {
     foreach (var legalEntity in accountLegalEntities)
     {
         await _mediator.PublishAsync(new CreateLegalEntityCommand { LegalEntityHref = legalEntity.Href });
     }
 }
Esempio n. 2
0
        [SetUp] public void SetUp()
        {
            InitStorage();
            RegisterResourcesAndProperties();

            _ownerList = (ResourceList)_storage.GetAllResources("ResourceType");
        }
            // When we need "A union B" but B is exclusive:
            //   If B = X',
            //   A union B
            //     = (A' intersect B')'
            //     = (A' intersect X)'
            //     = (X intersect A')'
            //     = (X - A)'
            private ResourceList ReverseExceptThenComplement(ResourceList other)
            {
                bool complement = !Allow;
                IEnumerable <TResource> resources = other.Resources.Except(Resources);

                return(new ResourceList(complement, Inclusive, resources));
            }
Esempio n. 4
0
    public ResourceForBlueprint AddResource()
    {
        ResourceForBlueprint tRes = new ResourceForBlueprint();

        ResourceList.Add(tRes);
        return(tRes);
    }
            public ResourceList Combine(ResourceList other)
            {
                // The logic that follows assumes this is inclusive;
                // fortunately, by changing the allow flag,
                // an exclusive list can be made inclusive
                bool allow             = Allow ^ !Inclusive;
                bool sameAccessControl = allow == other.Allow;

                if (sameAccessControl && other.Inclusive)
                {
                    return(Union(other));
                }
                else if (sameAccessControl && !other.Inclusive)
                {
                    return(ReverseExceptThenComplement(other));
                }
                else if (!sameAccessControl && other.Inclusive)
                {
                    return(Except(other));
                }
                else if (!sameAccessControl && !other.Inclusive)
                {
                    return(Intersect(other));
                }

                throw new InvalidOperationException("Invalid resource list combination.");
            }
Esempio n. 6
0
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock <IHttpClient>();
            Client         = new RestBroadcastClient(HttpClientMock);

            ExpectedQueryBroadcastData = new CfQueryBroadcastData(500, 0, 1);

            ExpectedContactBatch = new CfContactBatch(1, "contactBatch", CfBatchStatus.Active, 2, DateTime.Now, 10, 15);

            var contactBatchArray = new CfContactBatch[1];

            contactBatchArray[0] = ExpectedContactBatch;

            ExpectedContactBatchQueryResult = new CfContactBatchQueryResult(10, contactBatchArray);

            var resource = new ResourceList();
            var array    = new ContactBatch[1];

            array[0]              = ContactBatchMapper.ToSoapContactBatch(ExpectedContactBatchQueryResult.ContactBatch[0]);
            resource.Resource     = array;
            resource.TotalResults = 1;

            var        serializer = new XmlSerializer(typeof(ResourceList));
            TextWriter writer     = new StringWriter();

            serializer.Serialize(writer, resource);

            HttpClientMock
            .Stub(j => j.Send(Arg <string> .Is.Equal(String.Format("/broadcast/{0}/batch",
                                                                   ExpectedQueryBroadcastData.BroadcastId)),
                              Arg <HttpMethod> .Is.Equal(HttpMethod.Get),
                              Arg <object> .Is.Anything))
            .Return(writer.ToString());
        }
Esempio n. 7
0
        public async Task <ResourceList> Update(ResourceList resourceList)
        {
            _context.Entry(resourceList).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(resourceList);
        }
Esempio n. 8
0
        /// <summary>
        /// 获取当前组的所有菜单资源的权限
        /// </summary>
        /// <param name="groupID">用户组的主键</param>
        /// <returns>返回获取到的资源数组列表</returns>
        protected override IList <Resource> GenerateResourcePermission(int groupID)
        {
            ResourceList     resourceList = RepositoryFacade.ResolveInstance <ResourceRepository>().Extension <ResourceRepositoryExtension>().GetResourceByGroupID(groupID);
            IList <Resource> resource     = resourceList.Concrete().ToList();

            return(resource);
        }
Esempio n. 9
0
        public void testCountries()
        {
            //{"AccountInquiry":{"AccountNumber":"5343434343434343"}}
            ResourceList <Countries> countriesList = Countries.List();

            Assert.AreEqual(2, countriesList.Count);
        }
        public async void TestAdd(string expectedName)
        {
            var options = new DbContextOptionsBuilder <LibDbContext>()
                          .UseInMemoryDatabase(databaseName: "TestNewListDb").Options;

            // Set up a context (connection to the "DB") for writing
            using (var context = new LibDbContext(options))
            {
                // 1. Arrange
                var rl = new ResourceList
                {
                    Name = "RL1"
                };

                // 2. Act
                var rls = new ResourceListService(context);
                await rls.Add(rl);
            }

            using (var context = new LibDbContext(options))
            {
                var rls    = new ResourceListService(context);
                var result = await rls.Get();

                // 3. Assert
                Assert.NotEmpty(result);
                Assert.Single(result);
                Assert.NotEmpty(result.First().Name);
                Assert.Equal(expectedName, result.First().Name);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 根据分类检索
        /// </summary>
        /// <param name="typeId">分类id</param>
        /// <param name="belong">级别</param>
        public void Search(string typeId, string belong)
        {
            T_Res_Type type       = new T_Res_Type();
            T_Res_Type fatherType = new T_Res_Type();

            using (JSZX_ResourceEntities db = new JSZX_ResourceEntities())
            {
                ResourceList relist = new ResourceList();
                type = relist.GetTypeById(typeId, db);
                if (type.BELONG_ID != null && type.BELONG_ID != "")
                {
                    fatherType = relist.GetTypeById(type.BELONG_ID, db);
                }
            }

            string ahtml = "";

            if (belong == "2")
            {
                ahtml = "<span>></span> <a href='javascript:doSearch2(\"" + fatherType.ID + "\",\"1\")' class='ml5 mr5'>" + fatherType.NAME + "</a> <span>></span> <a href='javascript:doSearch2(\"" + type.ID + "\",\"2\")' class='ml5 mr5'>" + type.NAME + "</a>";
            }
            else
            {
                ahtml = "<span>></span> <a href='javascript:doSearch2(\"" + type.ID + "\",\"1\")' class='ml5 mr5'>" + type.NAME + "</a>";
            }

            HttpContext.Response.Write(ahtml);
        }
Esempio n. 12
0
 private async Task SavePayeSchemes(ResourceList accountPayeSchemes)
 {
     foreach (var payeScheme in accountPayeSchemes)
     {
         await _mediator.PublishAsync(new CreatePayeSchemeCommand { PayeSchemeHref = payeScheme.Href });
     }
 }
Esempio n. 13
0
        /**
         * Gets a list of all skin resources in the library that match the
         * search criteria in the provided query.
         *
         * @param query
         *      Search criteria for skin resources
         * @return
         *      List of resources that match the query
         */
        public ResourceList getSkins(SkinResourceQuery query)
        {
            lock (sincronizeFlag)
            {
                ResourceList result = new ResourceList();

                foreach (SkinResource skin in skins)
                {
                    if (query.hasTextureHeight() && (query.getTextureHeight() < skin.getMinTextureHeightMeters() ||
                                                     query.getTextureHeight() >= skin.getMaxTextureHeightMeters()))
                    {
                        continue;
                    }
                    if (query.hasMinTextureHeight() && query.getMinTextureHeight() > skin.getMinTextureHeightMeters())
                    {
                        continue;
                    }
                    if (query.hasMaxTextureHeight() && query.getMaxTextureHeight() <= skin.getMinTextureHeightMeters())
                    {
                        continue;
                    }
                    if (query.hasRepeatsVertically() && query.getRepeatsVertically() != skin.getRepeatsVertically())
                    {
                        continue;
                    }
                    if (query.getTags().Count > 0 && skin.containsTags(query.getTags()))
                    {
                        continue;
                    }
                    result.Add(skin);
                }
                return(result);
            }
        }
Esempio n. 14
0
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock <IHttpClient>();
            Client         = new RestBroadcastClient(HttpClientMock);

            var queryBroadcast = new Broadcast[1];

            BroadcastId           = 1;
            BroadcastName         = "broadcast";
            BroadcastLastModified = DateTime.Now;
            queryBroadcast[0]     = new Broadcast(BroadcastId, BroadcastName, BroadcastStatus.RUNNING, BroadcastLastModified, BroadcastType.IVR, null);

            CfBroadcastType[] broadcastType = { CfBroadcastType.Ivr };
            ExpectedQueryBroadcast = new CfQueryBroadcasts(5, 0, broadcastType, true, "labelName");

            var cfBroadcastQueryResult = new BroadcastQueryResult(1, queryBroadcast);

            var resource = new ResourceList();
            var array    = new Broadcast[1];

            array[0]              = cfBroadcastQueryResult.Broadcast[0];
            resource.Resource     = array;
            resource.TotalResults = 1;

            var        serializer = new XmlSerializer(typeof(ResourceList));
            TextWriter writer     = new StringWriter();

            serializer.Serialize(writer, resource);

            HttpClientMock
            .Stub(j => j.Send(Arg <string> .Is.Equal(String.Format("/broadcast")),
                              Arg <HttpMethod> .Is.Equal(HttpMethod.Get),
                              Arg <object> .Is.Anything))
            .Return(writer.ToString());
        }
Esempio n. 15
0
        public List <LearningResource> LearningResources()
        {
            var resourceLists = new List <ResourceList>();
            var resourceList  = new ResourceList
            {
                Id   = 1,
                Name = "RL1",
                LearningResources = new List <LearningResource>()
            };

            resourceLists.Add(resourceList);
            return(new List <LearningResource>
            {
                new LearningResource
                {
                    Id = 1,
                    Name = "ASP .NET Core Docs",
                    Url = "https://docs.microsoft.com/aspnet/core",
                    ResourceListId = 1,
                    ResourceList = resourceList
                },
                new LearningResource
                {
                    Id = 2,
                    Name = "Wake Up And Code!",
                    Url = "https://WakeUpAndCode.com",
                    ResourceListId = 1,
                    ResourceList = resourceList,
                    ContentFeedUrl = "https://WakeUpAndCode.com/rss"
                },
            }
                   .OrderBy(ci => ci.Name).ToList());
        }
        private async Task <List <LegalEntityViewModel> > GetLegalEntities(ResourceList responseLegalEntities)
        {
            var legalEntitiesList = new List <LegalEntityViewModel>();

            foreach (var legalEntity in responseLegalEntities)
            {
                _logger.Debug(
                    $"{nameof(IAccountApiClient)}.{nameof(_accountApiClient.GetResource)}<{nameof(LegalEntityViewModel)}>(\"{legalEntity.Href}\");");
                try
                {
                    var legalResponse = await _accountApiClient.GetResource <LegalEntityViewModel>(legalEntity.Href);

                    if (legalResponse.AgreementStatus == EmployerAgreementStatus.Signed ||
                        legalResponse.AgreementStatus == EmployerAgreementStatus.Pending ||
                        legalResponse.AgreementStatus == EmployerAgreementStatus.Superseded)
                    {
                        legalEntitiesList.Add(legalResponse);
                    }
                }
                catch (Exception ex)
                {
                    _logger.Error(ex, $"Exception occured calling Account API for type of {nameof(LegalEntityViewModel)} at {legalEntity.Href} id {legalEntity.Id}");
                }
            }

            return(legalEntitiesList);
        }
Esempio n. 17
0
        /// <summary>
        /// 检索标签
        /// </summary>
        /// <param name="keyword">关键字</param>
        public void SearchLabel()
        {
            List <T_Res_Tag> list = new List <T_Res_Tag>();

            using (JSZX_ResourceEntities db = new JSZX_ResourceEntities())
            {
                ResourceList relist = new ResourceList();
                list = relist.GetLabelByKeyword(null, "", db);
            }

            List <Hashtable> res = new List <Hashtable>();
            Hashtable        ht  = null;

            if (list != null)
            {
                foreach (T_Res_Tag tag in list)
                {
                    ht = new Hashtable();
                    ht.Add("name", StringUtil.ObjToString(tag.NAME));
                    ht.Add("py", StringUtil.ObjToString(tag.PY));
                    res.Add(ht);
                }
            }

            JavaScriptSerializer ser = new JavaScriptSerializer();
            String json = ser.Serialize(res);

            HttpContext.Response.Write(json);
        }
Esempio n. 18
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] ResourceList resourceList)
        {
            if (id != resourceList.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(resourceList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ResourceListExists(resourceList.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(resourceList));
        }
Esempio n. 19
0
        public void ParseCase()
        {
            Properties.Clear();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(XML);

            XmlNodeList cases = doc.GetElementsByTagName("case");

            CaseParseAssert(cases.Count > 0, "No cases found");

            XmlNode thisCase = cases[0];

            LoadObjectProperties(thisCase);

            XmlNodeList resources = doc.GetElementsByTagName("resource");

            foreach (XmlNode n in resources)
            {
                DBCaseResource cr = new DBCaseResource();
                cr.Load(n);
                ResourceList.Add(cr);
            }

            XmlNodeList landuses = doc.GetElementsByTagName("landuse");

            foreach (XmlNode n in landuses)
            {
                DBLanduse l = new DBLanduse();
                l.Load(n);
                LanduseList.Add(l);
            }
        }
Esempio n. 20
0
    public PrimaryImproverBuildingList()
    {
        resourceList = new ResourceList();
        buildings    = new Dictionary <string, Building>();
        var CraftingStation = new ImproverBuilding(
            "Crafting Station", "Primary Improver", "Secondary Resource", "Improves resources and shit", true, 3, 2,
            new Dictionary <string, int> {
            { "Lumber", 100 },
            // { "Stone", 30 },
            { "Iron", 20 }
        }
            );

        CraftingStation.statBonusOrdering = "srdfa";
        CraftingStation.bonusStat         = "strength";
        CraftingStation.startingResources = new Dictionary <string, Resource> {
            { "Iron", resourceList.Iron }
        };
        CraftingStation.spawnChance = new Dictionary <string, int> {
            { "Iron", 60 }
        };
        CraftingStation.resourcesToImprove = new Dictionary <string, string[]> {
            { "Iron", new string[] { "Lumber", "Grain" } }
        };
        CraftingStation.resourcesToImproveCosts = new Dictionary <string, int> {
            { "Lumber", 50 },
            { "Grain", 10 }
        };
        CraftingStation.upgradesTo = new List <string>()
        {
        };
        buildings.Add("Crafting Station", CraftingStation);
    }
Esempio n. 21
0
        public async Task Delete_ReturnsViewResultWithModel()
        {
            // Arrange
            var resourceList = new ResourceList
            {
                Id   = 1,
                Name = "RL1",
                LearningResources = new List <LearningResource>()
            };

            var mockService = new Mock <IResourceListService>();

            mockService.Setup(s => s.Get(resourceList.Id)).Returns(Task.FromResult(resourceList));
            var controller = new ResourceListsController(mockService.Object);

            // Act
            var result = await controller.Delete(resourceList.Id); // as ViewResult;

            // Assert correct non-null View returned with expected Model

            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(viewResult);
            Assert.Equal(nameof(controller.Delete), viewResult.ViewName);
            Assert.NotNull(viewResult.Model);
            Assert.Equal(typeof(ResourceList), viewResult.Model.GetType());
        }
Esempio n. 22
0
        public override void Tick()
        {
            if (fetcher == null || failed)
            {
                return;
            }
            CheckCurrentProgress();

            if (!fetcher.Check(SetStatus))
            {
                failed = true;
            }

            if (!fetcher.Done)
            {
                return;
            }
            if (ResourceList.GetFetchFlags() != 0)
            {
                ResourcePatcher patcher = new ResourcePatcher(fetcher, drawer);
                patcher.Run();
            }

            fetcher = null;
            GC.Collect();
            game.TryLoadTexturePack();
            GotoNextMenu(0, 0);
        }
Esempio n. 23
0
        public async Task <ResourceList> Add(ResourceList resourceList)
        {
            _context.ResourceLists.Add(resourceList);
            await _context.SaveChangesAsync();

            return(resourceList);
        }
Esempio n. 24
0
 static HTMLRendererResources()
 {
     m_resourceList = new ResourceList();
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.TogglePlus.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ToggleMinus.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.sortAsc.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.sortDesc.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.unsorted.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Blank.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Common.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.FitProportional.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.FixedHeader.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.CanGrowFalse.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ImageConsolidation.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html40Viewer.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Toolbar.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices40.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServicesHybrid.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5RenderingExtensionJs.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jquery.min.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.knockoutjs.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServicesHybrid.js", "application/javascript", hasDebugMode: true);
 }
Esempio n. 25
0
 // Use this for initialization
 void Start()
 {
     if (rotate == null)
     {
         rotate = GameObject.Find("Rotate").GetComponent <Toggle>();
     }
     if (throttle == null)
     {
         throttle = GameObject.Find("Throttle").GetComponent <Toggle>();
     }
     if (refugee == null)
     {
         refugee = GameObject.Find("Refugee").GetComponent <Toggle>();
     }
     if (dropoff == null)
     {
         dropoff = GameObject.Find("Dropoff").GetComponent <Toggle>();
     }
     if (complete == null)
     {
         complete = GameObject.Find("Complete").GetComponent <TextMeshProUGUI>();
     }
     complete.enabled = false;
     if (boatResources == null)
     {
         boatResources = GameObject.FindGameObjectWithTag("boat").GetComponent <ResourceList>();
     }
 }
 static HTMLRendererResources()
 {
     HTMLRendererResources.m_resourceList = new ResourceList();
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.TogglePlus.gif", "image/gif");
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.ToggleMinus.gif", "image/gif");
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.sortAsc.gif", "image/gif");
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.sortDesc.gif", "image/gif");
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.unsorted.gif", "image/gif");
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.Blank.gif", "image/gif");
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.PushPin.png", "image/png");
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.Common.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.FitProportional.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.FixedHeader.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.CanGrowFalse.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.ImageConsolidation.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html40Viewer.css", "text/css", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.css", "text/css", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Toolbar.css", "text/css", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.css", "text/css", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices40.css", "text/css", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServicesHybrid.css", "text/css", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices.css", "text/css", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5RenderingExtensionJs.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.jquery.min.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.knockoutjs.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServicesHybrid.js", "application/javascript", true);
     HTMLRendererResources.m_resourceList.Add("AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources.RSClientPrint.cab", "application/vnd.ms-cab-compressed");
 }
Esempio n. 27
0
    //Trade ---------------------------------------------------------------------------
    public ResourceList SetImportsExports()
    {
        //ResourceList[] resourceTally = DoDomesticTrade();
        //Sort city pairs by proximity to one another
        //Have the closest cities trade with each other as much as possible
        //send the remains to the nearest port
        //return the imports and exports
        //----------------------------------------------------------------------

        /*ImportsExports[0] = new ResourceList();
         * ImportsExports[1] = new ResourceList();
         * ResourceList totalMaintenance = GetMaintenance();
         * ResourceList totalProduction = GetProduction();
         * for (int i = 0; i < ResourceList.AMOUNT_OF_RESOURCES; i++)
         * {
         *  ImportsExports[1].Add( ResourceList.ConvertInt(i), totalProduction.GetAmount(ResourceList.ConvertInt(i)) - totalMaintenance.GetAmount(ResourceList.ConvertInt(i)));
         *  if (ImportsExports[1].GetAmount(ResourceList.ConvertInt(i)) < 0)
         *  {
         *      ImportsExports[1].Clear(ResourceList.ConvertInt(i));
         *      ImportsExports[0].Add(ResourceList.ConvertInt(i), totalProduction.GetAmount(ResourceList.ConvertInt(i)) - totalMaintenance.GetAmount(ResourceList.ConvertInt(i)));
         *  }
         *  totalProduction.Subtract(ResourceList.ConvertInt(i), totalMaintenance.GetAmount(ResourceList.ConvertInt(i)));
         * }*/
        //ResourceList exportsimports = exports;
        ResourceList sumResource = new ResourceList();

        return(sumResource);
    }
Esempio n. 28
0
        //Cheap D.R.Y. fix
        public static void updateResources(IWebDriver _driver)
        {
            ResourceList resources = new ResourceList(_driver, _resources);

            _resources = resources.getResourceData();
            resources.checkForJobAssignment();
        }
Esempio n. 29
0
    // Use this for initialization
    public new void Start()
    {
        base.Start();

        ResourceList.Add(new Resource("Madeira"));
        ResourceList.Add(new Resource("Documentação"));
        ResourceList.Add(new Resource("Açucar"));
        ResourceList.Add(new Resource("Ouro"));
        ResourceList.Add(new Resource("Armas"));
        ResourceList.Add(new Resource("Tecnologia"));

        if (landType == LandType.Colonia)
        {
            Resource res1 = ResourceList.Find(p => p.name == "Madeira");
            res1.registerOnUpdateCb(changeResource1);

            Resource res2 = ResourceList.Find(p => p.name == "Documentação");
            res2.registerOnUpdateCb(changeResource2);

            Resource res3 = ResourceList.Find(p => p.name == "Açucar");
            res3.registerOnUpdateCb(changeResource3);
        }
        else
        {
            Resource res1 = ResourceList.Find(p => p.name == "Ouro");
            res1.registerOnUpdateCb(changeResource1);

            Resource res2 = ResourceList.Find(p => p.name == "Armas");
            res2.registerOnUpdateCb(changeResource2);

            Resource res3 = ResourceList.Find(p => p.name == "Tecnologia");
            res3.registerOnUpdateCb(changeResource3);
        }
    }
Esempio n. 30
0
        internal List <ResourceSimulationData> GetSimulationDataForResources(ResourceList resources, List <ISimulationResourceData> simulationResourceData, List <ISimulationResourceData> simulationResourceSetupData, long startInterval, long
                                                                             endInterval)
        {
            List <ResourceSimulationData> resourceSimulationDataList = new List <ResourceSimulationData>();
            var divisor = endInterval - startInterval;

            foreach (var resource in resources)
            {
                ResourceSimulationData resourceSimulationData = new ResourceSimulationData(resource);

                var resourceData = simulationResourceData.Where(x => x.CapabilityProvider == resource).ToList();
                resourceSimulationData._totalWorkTime = GetResourceTimeForInterval(resource, resourceData, startInterval, endInterval);

                var work = Math.Round(value: Convert.ToDouble(resourceSimulationData._totalWorkTime) / Convert.ToDouble(divisor), digits: 3).ToString(provider: _cultureInfo);
                if (work == "NaN")
                {
                    work = "0";
                }
                resourceSimulationData._workTime = work;

                var resourceSetupData = simulationResourceSetupData.Where(x => x.CapabilityProvider == resource).ToList();
                resourceSimulationData._totalSetupTime = GetResourceTimeForInterval(resource, resourceSetupData, startInterval, endInterval);
                var setup = Math.Round(value: Convert.ToDouble(resourceSimulationData._totalSetupTime) / Convert.ToDouble(divisor), digits: 3).ToString(provider: _cultureInfo);
                if (setup == "NaN")
                {
                    setup = "0";
                }
                resourceSimulationData._setupTime = setup;

                resourceSimulationDataList.Add(resourceSimulationData);
            }
            return(resourceSimulationDataList);
        }
Esempio n. 31
0
	public void Init(ResourceList list)
	{
		for (int i = 0; i < (int)ResourceID._Amount; i++)
		{
			int value = list.GetResource((ResourceID) i);
			Values[i].text = "" + value;
		}
	}
 public void UpdateUI(ResourceList availableResources, XmlPortList ports)
 {
     _Ports = ports;
     uiResources.Ports = ports;
     _AvailableResources = availableResources;
     uiResources.Resources1 = new ResourceList();
     FillResources();
 }
        public void MergeShouldNotAddDuplicates()
        {
            var resource = new Resource("My_Apple", "The apple is good");

            var list1 = new ResourceList { resource };
            var list2 = new ResourceList { resource };

            list1.Merge(list2);

            list1.Count.ShouldBe(1);
        }
Esempio n. 34
0
 public HalResourceListTests()
 {
     resourceLinker = new ResourceLinker();
     resourceLinker.AddLinker(new OrganisationListLinker());
     resourceLinker.AddLinker(new OrganisationLinker());
     resource = new ResourceList<OrganisationRepresentation>(
         new List<OrganisationRepresentation>
                {
                    new OrganisationRepresentation(1, "Org1"),
                    new OrganisationRepresentation(2, "Org2")
                });
     resourceLinker.CreateLinks(resource);
 }
Esempio n. 35
0
        public Project()
        {
            //NOP
            sources = new SourceList();

            layers = new BuildLayerList();
            targets = new BuildTargetList();
            terrains = new TerrainList();

            graphs = new FilterGraphList();
            resources = new ResourceList();
            scripts = new ScriptList();
            mogreLocations = new List<MogreLocation>();
        }
        public static ResourceList ParseAllResourceFiles(IFileSystem fileSystem, string path, ResourceFilter resourceFilter = null)
        {
            var resourceList = new ResourceList();

            var fileFilter = new FileFilter { FileExtensionWhitelist = new Regex(@"\.resx$") };

            foreach (var file in fileSystem.AllFiles(path, fileFilter))
            {
                var xml = fileSystem.LoadXmlFile(file.FullName);
                resourceList.Merge(ParseAsResourceList(xml, resourceFilter));
            }

            return resourceList;
        }
Esempio n. 37
0
 // POST: Service/Resources/Sources
 public ResourceList Sources(string args, Guid workspaceID, Guid dataListID)
 {
     var result = new ResourceList();
     try
     {
         dynamic argsObj = JObject.Parse(args);
         result = Read(workspaceID, ParseResourceType(argsObj.resourceType.Value));
     }
     catch(Exception ex)
     {
         RaiseError(ex);
     }
     return result;
 }
Esempio n. 38
0
	public void Init(ResourceList list, ResourceList listMax, bool removeUnused = false)
	{
		for (int i = 0; i < (int)ResourceID._Amount; i++)
		{
			int value = list.GetResource((ResourceID) i);
			//int max = listMax.GetResource((ResourceID) i);

			if (removeUnused && value == 0)
			{
				Items[i].gameObject.SetActive(false);
				continue;
			}

			Items[i].gameObject.SetActive(true);
			//Values[i].text = "" + (max - value) + "/" + max;
			Values[i].text = "" + value;
		}
	}
        protected override void ProcessRecord()
        {
            var resourceList = new ResourceList();

            if (this.Resources == null)
            {
                this.WriteObject(resourceList);
                return;
            }

            foreach (var resource in this.Resources)
            {
                resourceList.Add(resource);
                this.WriteVerbose(string.Format("Added {0} to resource list", resource));
            }

            this.WriteObject(resourceList);
        }
        public static ResourceList ParseAsResourceList(XElement xmlDocument, ResourceFilter filter = null)
        {
            if (filter == null)
            {
                filter = ResourceFilter.NoFilter;
            }

            var resourceList = new ResourceList();

            foreach (var resourceElement in xmlDocument.Elements())
            {
                if (resourceElement.Name.LocalName != "data")
                {
                    continue;
                }

                var key = resourceElement.Attribute("name").Value;

                if (!filter.KeyIsMatch(key))
                {
                    continue;
                }

                var valueElement = resourceElement.Element("value");

                var value = string.Empty;

                if (valueElement != null)
                {
                    value = valueElement.Value;
                }

                if (!filter.ValueIsMatch(value))
                {
                    continue;
                }

                resourceList.Add(new Resource(key, value));
            }

            return resourceList;
        }
Esempio n. 41
0
 // POST: Service/Resources/Services
 public ResourceList Services(string args, Guid workspaceId, Guid dataListId)
 {
     var result = new ResourceList();
     try
     {
         var resourceType = ParseResourceType(args);
         if(resourceType == ResourceType.WorkflowService)
         {
             result = Read(workspaceId, resourceType);
         }
         else
         {
             throw new ArgumentException("Resource Type passed not WorkflowService");
         }
     }
     catch(Exception ex)
     {
         RaiseError(ex);
     }
     return result;
 }
        public override void AddResourceList(ResourceList newList, int coursId)
        {
            base.AddResourceList(newList, coursId);

            newList.PropertyChanged += RL_PropertyChanged;
        }
Esempio n. 43
0
        /////////////////////////////////////////////////////////////////
        // Static Helper methods
        /////////////////////////////////////////////////////////////////

        #region Read

        public static ResourceList Read(Guid workspaceID, ResourceType resourceType)
        {
            var resources = new ResourceList();
            var resourceTypeStr = resourceType.ToString();

            ResourceIterator.Instance.Iterate(new[] { RootFolders[resourceType] }, workspaceID, iteratorResult =>
            {
                var isResourceType = false;
                string value;

                if(iteratorResult.Values.TryGetValue(1, out value))
                {
                    // Check ResourceType attribute
                    isResourceType = value.Equals(resourceTypeStr, StringComparison.InvariantCultureIgnoreCase);
                }
                else if(iteratorResult.Values.TryGetValue(5, out value))
                {
                    // This is here for legacy XML!
                    #region Check Type attribute

                    enSourceType sourceType;
                    if(iteratorResult.Values.TryGetValue(5, out value) && Enum.TryParse(value, out sourceType))
                    {
                        switch(sourceType)
                        {
                            case enSourceType.SqlDatabase:
                            case enSourceType.MySqlDatabase:
                                isResourceType = resourceType == ResourceType.DbSource;
                                break;
                            case enSourceType.WebService:
                                break;
                            case enSourceType.DynamicService:
                                isResourceType = resourceType == ResourceType.DbService;
                                break;
                            case enSourceType.Plugin:
                                isResourceType = resourceType == ResourceType.PluginService || resourceType == ResourceType.PluginSource;
                                break;
                            case enSourceType.Dev2Server:
                                isResourceType = resourceType == ResourceType.Server;
                                break;
                        }
                    }

                    #endregion
                }
                if(isResourceType)
                {
                    // older resources may not have an ID yet!!
                    iteratorResult.Values.TryGetValue(2, out value);
                    Guid resourceID;
                    Guid.TryParse(value, out resourceID);

                    string resourceName;
                    iteratorResult.Values.TryGetValue(3, out resourceName);
                    string resourcePath;
                    iteratorResult.Values.TryGetValue(4, out resourcePath);
                    resources.Add(ReadResource(resourceID, resourceType, resourceName, resourcePath, iteratorResult.Content));
                }
                return true;
            }, new ResourceDelimiter
            {
                ID = 1,
                Start = " ResourceType=\"",
                End = "\" "
            }, new ResourceDelimiter
            {
                ID = 2,
                Start = " ID=\"",
                End = "\" "
            }, new ResourceDelimiter
            {
                ID = 3,
                Start = " Name=\"",
                End = "\" "
            }, new ResourceDelimiter
            {
                ID = 4,
                Start = "<Category>",
                End = "</Category>"
            }, new ResourceDelimiter
            {
                ID = 5,
                Start = " Type=\"",
                End = "\" "
            });
            return resources;
        }
        public override void DeleteResourceList(ResourceList listForDelete)
        {
            listForDelete.PropertyChanged -= RL_PropertyChanged;

            base.DeleteResourceList(listForDelete);
        }
Esempio n. 45
0
        public override void PerformTurnAction(XmlGame xmlGame)
        {
            _playersResources = new Dictionary<Gaming.GamePlayer, ResourceList>();
            GamePlayer gamePlayer = xmlGame.GetPlayer(Sender);

            if (xmlGame.Phase is PlayTurnsGamePhase)
            {
                if (Dice != 7)
                {
                    // gather all resource hexes without the robber
                    IEnumerable<ResourceHex> rolledHexes =
                        from h in xmlGame.Board.Hexes.OfType<ResourceHex>()
                        where h.XmlChit != null &&
                            // we need a chit with the same number as rolled dice
                        h.XmlChit.ChitNumber == Chit.GetChitNumber(Dice)
                        select h;

                    bool volcanoRolled = false;

                    // Iterate over all hexes with resources
                    foreach (ResourceHex hex in rolledHexes)
                    {
                        if (!volcanoRolled && hex is VolcanoHex)
                        {
                            volcanoRolled = true;
                        }
                        // For normal resources, the location of the robber is omitted.
                        if (!hex.Location.Equals(xmlGame.Robber))
                        {
                            foreach (GamePlayer player in xmlGame.Players)
                            {
                                // make a list of cities
                                IEnumerable<HexPoint> citiesOnHex =
                                    from city in player.Cities
                                    where city.HasLocation(hex.Location)
                                    select city;

                                IEnumerable<HexPoint> townsOnHex =
                                    from town in player.Towns
                                    where town.HasLocation(hex.Location)
                                    select town;

                                ResourceList gainedResources = new ResourceList();
                                gainedResources.AddResources(
                                    hex.Resource, (citiesOnHex.Count() * 2) + townsOnHex.Count());

                                //update gamestate
                                player.Resources.AddCards(gainedResources);
                                xmlGame.Bank.SubtractCards(gainedResources);
                                if (!_playersResources.Keys.Contains(player))
                                {
                                    //add new entry when no resources registered yet
                                    _playersResources.Add(player, gainedResources);
                                }
                                else
                                {
                                    // we already gained resources, add resources from current hex
                                    _playersResources[player].AddCards(gainedResources);
                                }
                            } // Robber
                        } // Foreach hex

                        _HexesAffected.Add(hex);
                    }

                    // Remove gold from resourcesGained, add PickGoldAction for each player with gold
                    foreach (KeyValuePair<GamePlayer, ResourceList> kvp in _playersResources)
                    {
                        if (kvp.Value.Gold > 0)
                        {
                            xmlGame.ActionsQueue.Enqueue(new PickGoldAction()
                            {
                                GamePlayer = kvp.Key,
                                Amount = kvp.Value.Gold
                            });
                        }
                        kvp.Key.Resources.Gold = 0;
                    }

                    // If there is a volcano producing stuff, expect player to roll for the volcano number
                    if (volcanoRolled)
                    {
                        xmlGame.ActionsQueue.Enqueue(new RollVolcanoDiceAction()
                        {
                            GamePlayer = _GamePlayer
                        });
                    }

                    _Message = String.Format("{0} rolled {1} ({2} + {3})",
                        gamePlayer.XmlPlayer.Name, Dice, Dice1, Dice2);
                }
                else
                {
                    // Rolled a 7, create list of players to loose cards
                    string playerList = string.Empty;

                    foreach (GamePlayer p in xmlGame.Players)
                    {
                        if (p.Resources.Count > xmlGame.Settings.MaximumCardsInHandWhenSeven)
                        {
                            _LooserPlayers.Add(p.XmlPlayer.ID);
                            // Add comma and playername to message
                            playerList += _LooserPlayers.Count > 0 ?
                                ", " + p.XmlPlayer.Name : p.XmlPlayer.Name;
                        }
                    }

                    _Message = String.Format("{0} rolled a 7.", playerList);

                    if (_LooserPlayers.Count > 0)
                    {
                        _Message = String.Format("{0}{1} loose half of their resources", _Message, playerList);
                    }
                }
            }

            _User = gamePlayer.XmlPlayer;
            base.PerformTurnAction(xmlGame);
        }
        public async Task GetResourcesForThisListAsync(ResourceList container)
        {
            IsLoading = true;
            _lastClientCall = DateTime.Now;
            String strContent = await ViewModelLocator.Client.MakeOperationAsync(container.GetSupportedModule(),
                                                                              SupportedMethods.GetResourcesList,
                                                                              syscode: container.Cours.sysCode,
                                                                              genMod: container.label);

            if (strContent != "")
            {
                IList resources = (IList)JsonConvert.DeserializeObject(strContent, container.ressourceListType);

                foreach (ResourceModel item in resources)
                {
                    AddResource(item, container.Id);
                }
                container.loaded = DateTime.Now;
            }
            IsLoading = false;
        }
Esempio n. 47
0
 private ResourceList GetResourceList()
 {
     var resources = ResourceService.GetResourceList();
     var resourceList = new ResourceList(resources)
                            {
                                TotalCount = ResourceService.GetResourcesTotalCount()
                            };
     return resourceList;
 }
Esempio n. 48
0
 static SRSResource findSRSResource(ResourceList list, string name)
 {
     foreach (Resource i in list)
     {
         if (i != null && i.Name == name)
             return (SRSResource)i;
     }
     return null;
 }
        public void ShouldAllowInitializingFromCollectionOfResources()
        {
            var list = XmlResourceParser.ParseAsResourceList(SampleData.SampleXmlResourceString);
            var newList = new ResourceList(list.Resources.Select(x => x));

            newList.Count.ShouldBe(list.Count, "Unable to initialize new ResourceList from a collection of Resources");
        }
Esempio n. 50
0
        public int GoldCount(ResourceList list)
        {
            int result = 0;

            ResourceList workinglist = list.Copy();

            if (_Ports.Timber > 0)
            {
                result += _Resources.Timber / 2;
                workinglist.Timber--;
            }
            if (_Ports.Wheat > 0)
            {
                result += _Resources.Wheat / 2;
                workinglist.Wheat--;
            }
            if (_Ports.Ore > 0)
            {
                result += _Resources.Ore / 2;
                workinglist.Ore--;
            }
            if (_Ports.Clay > 0)
            {
                result += _Resources.Clay / 2;
                workinglist.Clay--;
            }
            if (_Ports.Sheep > 0)
            {
                result += _Resources.Sheep / 2;
                workinglist.Sheep--;
            }
            if (_Ports.ThreeToOne > 0)
            {
                if (workinglist.Timber > 0) result += workinglist.Timber / 3;
                if (workinglist.Wheat > 0) result += workinglist.Wheat / 3;
                if (workinglist.Ore > 0) result += workinglist.Ore / 3;
                if (workinglist.Clay > 0) result += workinglist.Clay / 3;
                if (workinglist.Sheep > 0) result += workinglist.Sheep / 3;
            }
            else
            {
                if (workinglist.Timber > 0) result += workinglist.Timber / 4;
                if (workinglist.Wheat > 0) result += workinglist.Wheat / 4;
                if (workinglist.Ore > 0) result += workinglist.Ore / 4;
                if (workinglist.Clay > 0) result += workinglist.Clay / 4;
                if (workinglist.Sheep > 0) result += workinglist.Sheep / 4;
            }

            return result;
        }
Esempio n. 51
0
 public ResourceList GetDevcardResources()
 {
     ResourceList tmp = _Resources.Copy();
     ResourceList result = new ResourceList();
     for (int i = 1; i < 4; i++)
     {
         if (tmp.Contains(EResource.Discovery))
         {
             result.Add(EResource.Discovery);
             tmp.Discoveries--;
             continue;
         }
         if (!result.Contains(EResource.Wheat) && tmp.Wheat > 0)
         {
             result.Add(EResource.Wheat);
             tmp.Wheat--;
             continue;
         }
         if (!result.Contains(EResource.Ore) && tmp.Ore > 0)
         {
             result.Add(EResource.Ore);
             tmp.Ore--;
             continue;
         }
         if (!result.Contains(EResource.Sheep) && tmp.Sheep > 0)
         {
             result.Add(EResource.Sheep);
             tmp.Sheep--;
         }
     }
     return result;
 }
Esempio n. 52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccessControlManager"/> class.
 /// </summary>
 /// <param name="currentUserPermissionService">The current user permission service.</param>
 public AccessControlManager( ICurrentUserPermissionService currentUserPermissionService )
 {
     _currentUserPermissionService = currentUserPermissionService;
     _resourceList = new ResourceList ();
     Initialize ();
 }
        public virtual void AddResourceList(ResourceList newList, int coursId)
        {
            ClarolineDataContext cdc = ClarolineDB;
            //using (ClarolineDataContext cdc = new ClarolineDataContext(ClarolineDataContext.DBConnectionString))
            //{
            var q = cdc.ResourceList_Table.Where(rl => rl._coursId == coursId && rl.label == newList.label);

            newList.updated = true;
            newList.loaded = DateTime.Now;

            if (!q.Any())
            {
                newList.Cours = cdc.Cours_Table.Single(c => c.Id == coursId);

                cdc.ResourceList_Table.InsertOnSubmit(newList);
                cdc.SubmitChanges();
                cdc.Refresh(RefreshMode.OverwriteCurrentValues, newList);
            }
            else
            {
                q.First().UpdateFrom(newList);
                cdc.SubmitChanges();
                newList.Id = q.First().Id;
            }
            //}
        }
 public virtual void DeleteResourceList(ResourceList listForDelete)
 {
     ClarolineDB.ResourceList_Table.DeleteOnSubmit(listForDelete);
     SaveChangesToDB();
 }
        public CoursPageVM(ISettings settings, string sysCode)
            : base(settings)
        {
            if (IsInDesignMode)
            {
                currentCours = new Cours()
                {
                    officialCode = "DESIGN",
                    sysCode = "DESIGN",
                    title = "Design test"
                };

                ResourceList l1 = new ResourceList() { Cours = currentCours, name = "Resource L1", label = "CLANN", ressourceType = typeof(Annonce) };
                ResourceList l2 = new ResourceList() { Cours = currentCours, name = "Resource L2", label = "CLDOC", ressourceType = typeof(Document) };
                ResourceList l3 = new ResourceList() { Cours = currentCours, name = "Resource L3", label = "CLDSC", ressourceType = typeof(Description) };
                ResourceList l4 = new ResourceList() { Cours = currentCours, name = "Resource L4", label = "CLCAL", ressourceType = typeof(Event) };
                ResourceList l5 = new ResourceList() { Cours = currentCours, name = "Resource L5", label = "CLFRM", ressourceType = typeof(Forum) };

                currentCours.Resources.Add(l5);
                _resources = new ObservableCollection<ResourceList>();
                _resources.Add(l5);
                _resources.Add(PivotMenu);
                currentCours.Resources.Add(new ResourceList() { Cours = currentCours, name = "L4", label = "L4" });

                l1.Resources.Add(new Annonce() { title = "Annonce 1", content = "Contenu 1 Contenu 1 v Contenu 1 Contenu 1 Contenu 1 v Contenu 1", date = DateTime.Now });
                l1.Resources.Add(new Annonce() { title = "Annonce 2 Annonce 2 Annonce 2", content = "Contenu 2", date = DateTime.Now });
                l1.Resources.Add(new Annonce() { title = "Annonce 3", content = "Contenu 3", date = DateTime.Now });
                l1.Resources.Add(new Annonce() { title = "Annonce 4", content = "Contenu 4", date = DateTime.Now });

                l3.Resources.Add(new Description() { title = "Annonce 1", content = "Contenu 1", date = DateTime.Now });

                l4.Resources.Add(new Event() { title = "Event 1", content = "Contenu 1", date = DateTime.Now, speakers = "Mr Nobody, Someone else" });
                l4.Resources.Add(new Event() { title = "Event 2", content = "Contenu 1", date = DateTime.Now, location = "This is a very very very very veyr vey long location" });
                l4.Resources.Add(new Event() { title = "Event 3", content = "Contenu 1", date = DateTime.Now, location = "B543", speakers = "Mr Nobody, Someone else" });

                l5.Resources.Add(new Forum() { title = "Forum 1", ForumDescription = "ForumDescription 1", CategoryId = 1, CategoryName = "Cat 1", CategoryRank = 1, Rank = 2 });
                l5.Resources.Add(new Forum() { title = "Forum 2", ForumDescription = "ForumDescription 2", CategoryId = 1, CategoryName = "Cat 1", CategoryRank = 1, Rank = 1 });
                l5.Resources.Add(new Forum() { title = "Forum 3", ForumDescription = "ForumDescription 3", CategoryId = 2, CategoryName = "Cat 2", CategoryRank = 2, Rank = 3 });
                l5.Resources.Add(new Forum() { title = "Forum 4", ForumDescription = "ForumDescription 4", CategoryId = 2, CategoryName = "Cat 2", CategoryRank = 2, Rank = 0 });
            }
            else
            {
                currentCours = (from Cours c
                                in ClarolineDB.Cours_Table
                                where c.sysCode.Equals(sysCode)
                                select c).FirstOrDefault();

                LoadCollectionsFromDatabase();

                if (!currentCours.loadedToday() || currentCours.Resources.Count == 0)
                {
                    PrepareCoursForOpeningAsync(currentCours);
                }
            }
        }
Esempio n. 56
0
 private void UpdateCounter(CounterTradeOfferAction action)
 {
     Status = OfferStatus.CounterOffer;
     WantedResources = action.WantedCards;
     OfferedResources = action.OfferedCards;
 }
Esempio n. 57
0
        private void GetResources(Module/*!*/ module)
        {
            ManifestResourceRow[] manifestResourceTable = this.tables.ManifestResourceTable;
            int n = manifestResourceTable.Length;
            ResourceList resources = new ResourceList();

            for (int i = 0; i < n; i++)
            {
                ManifestResourceRow mrr = manifestResourceTable[i];
                Resource r = new Resource();
                r.Name = this.tables.GetString(mrr.Name);
                r.IsPublic = (mrr.Flags & 7) == 1;
                int impl = mrr.Implementation;
                if (impl != 0)
                {
                    switch (impl & 0x3)
                    {
                        case 0x0:
                            string modName = this.tables.GetString(this.tables.FileTable[(impl >> 2) - 1].Name);
                            if ((this.tables.FileTable[(impl >> 2) - 1].Flags & (int)FileFlags.ContainsNoMetaData) != 0)
                            {
                                r.DefiningModule = new Module();
                                r.DefiningModule.Directory = module.Directory;
                                r.DefiningModule.Location = Path.Combine(module.Directory, modName);
                                r.DefiningModule.Name = modName;
                                r.DefiningModule.Kind = ModuleKind.ManifestResourceFile;
                                r.DefiningModule.ContainingAssembly = module.ContainingAssembly;
                                r.DefiningModule.HashValue = this.tables.GetBlob(this.tables.FileTable[(impl >> 2) - 1].HashValue);
                            }
                            else
                            {
                                string modLocation = modName;
                                r.DefiningModule = GetNestedModule(module, modName, ref modLocation);
                            }
                            break;
                        case 0x1:
                            r.DefiningModule = this.tables.AssemblyRefTable[(impl >> 2) - 1].AssemblyReference.Assembly;
                            break;
                    }
                }
                else
                {
                    r.DefiningModule = module;
                    r.Data = this.tables.GetResourceData(mrr.Offset);
                }

                resources.Add(r);
            }
            module.Resources = resources;
            module.Win32Resources = this.tables.ReadWin32Resources();
        }
Esempio n. 58
0
        /////////////////////////////////////////////////////////////////
        // Static Helper methods
        /////////////////////////////////////////////////////////////////

        #region Read

        public static ResourceList Read(Guid workspaceId, ResourceType resourceType)
        {
            var resources = new ResourceList();
            var explorerItem = ServerExplorerRepository.Instance.Load(resourceType, workspaceId);
            explorerItem.Descendants().ForEach(item =>
            {
                if(item.ResourceType == resourceType)
                {
                    resources.Add(new Resource { ResourceID = item.ResourceId, ResourceType = resourceType, ResourceName = item.DisplayName, ResourcePath = item.ResourcePath });
                }
            });
            return resources;
        }
Esempio n. 59
0
 public void UpdateUI(ResourceList wantedResources, ResourceList bankResources, ResourceList resources, XmlPortList ports, ETradeType tradeType)
 {
     _WantedResources = wantedResources;
     uiWanted.AvailableResources = bankResources;
     _Ports = ports;
     uiOffered.UpdateUI(resources, ports);
     if (tradeType == ETradeType.None)
     {
         pnlAutoTrade.Visibility = Visibility.Collapsed;
         btnCancel.Visibility = Visibility.Visible;
         uiWanted.ReadOnly = false;
     }
     else
     {
         pnlAutoTrade.Visibility = Visibility.Visible;
         btnCancel.Visibility = Visibility.Collapsed;
         lblItemType.Content = Enum.GetName(typeof(ETradeType), tradeType);
         uiWanted.Resources1 = _WantedResources;
         uiWanted.ReadOnly = true;
         switch (tradeType)
         {
             case ETradeType.City: imgItemType.Source = (ImageSource)Core.Instance.Icons["Sea3D"]; break;
             case ETradeType.Town: imgItemType.Source = (ImageSource)Core.Instance.Icons["Town3D"]; break;
             case ETradeType.Road: imgItemType.Source = (ImageSource)Core.Instance.Icons["Road48"]; break;
             case ETradeType.Ship: imgItemType.Source = (ImageSource)Core.Instance.Icons["Ship48"]; break;
             case ETradeType.Devcard: imgItemType.Source = (ImageSource)Core.Instance.Icons["IconBuyDevcard48"]; break;
         }
     }
 }
        public async Task GetSingleResourceAsync(ResourceList container, string resourceString = null)
        {
            IsLoading = true;
            _lastClientCall = DateTime.Now;
            String strContent = await ViewModelLocator.Client.MakeOperationAsync(container.GetSupportedModule(),
                                                                              SupportedMethods.GetSingleResource,
                                                                              container.Cours.sysCode,
                                                                              resourceString);
            if (strContent != "")
            {

                ResourceModel resource = (ResourceModel)JsonConvert.DeserializeObject(strContent, container.ressourceType);
                AddResource(resource, container.Id);
            }
            IsLoading = false;
        }