public CampaignTreeFactory()
        {
            CampaignTrees = new List<CampaignTree>();
            CampaignStepFactory = new CampaignStepFactory();
            CampaignStepTypeFactory = new CampaignStepTypeFactory();
            CampaignBriefingFactory = new CampaignBriefingFactory();

            Uri uri = new Uri(Constants.Campaign_TreeDataPath, UriKind.Relative);
            XElement applicationXml;
            StreamResourceInfo xmlStream = Application.GetResourceStream(uri);
            applicationXml = XElement.Load(xmlStream.Stream);
            var data = from t in applicationXml.Descendants("Campaign_Tree")
                       select t;

            CampaignTree campaignTree = null;
            foreach (var d in data)
            {
                campaignTree = new CampaignTree();
                campaignTree.CampaignTreeId = (Int32)d.Element("CampaignTreeId");
                campaignTree.CurrentCampaignStep = CampaignStepFactory.GetCampaignStep((Int32)d.Element("CurrentCampaignStepId"));
                campaignTree.CampaignStepType = CampaignStepTypeFactory.GetCampaignStepType((Int32)d.Element("CampaignStepTypeId"));
                campaignTree.Prestige = (Int32)d.Element("Prestige");
                campaignTree.CampaignBriefing = CampaignBriefingFactory.GetCampaignBriefing((Int32)d.Element("BriefingId"));
                campaignTree.NextCampaignStep = CampaignStepFactory.GetCampaignStep((Int32)d.Element("NextCampaignStepId"));
                CampaignTrees.Add(campaignTree);
            }
        }
Пример #2
0
 public CampaignFactory()
 {
     Campaigns = new List<CampaignInfo>();
     CampaignBriefingFactory = new CampaignBriefingFactory();
     CampaignStepFactory = new CampaignStepFactory();
     CampaignStepTypeFactory = new CampaignStepTypeFactory();
     CampaignTreeFactory = new CampaignTreeFactory();
     PopulateCampaigns();
 }