Ejemplo n.º 1
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <PoliticsInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <PoliticsInfo> list = new List <PoliticsInfo>();

            Query q = Politics.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            PoliticsCollection collection = new  PoliticsCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Politics politics  in collection)
            {
                PoliticsInfo politicsInfo = new PoliticsInfo();
                LoadFromDAL(politicsInfo, politics);
                list.Add(politicsInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Ejemplo n.º 2
0
        //数据持久化
        internal static void  SaveToDb(PoliticsInfo pPoliticsInfo, Politics pPolitics, bool pIsNew)
        {
            pPolitics.PoliticsId   = pPoliticsInfo.politicsId;
            pPolitics.PoliticsName = pPoliticsInfo.politicsName;
            pPolitics.IsNew        = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pPolitics.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(PoliticsInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pPoliticsInfo.politicsId = pPolitics.PoliticsId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(PoliticsInfo)))
            {
                ResetCache();
            }
        }
Ejemplo n.º 3
0
        public static bool ParseCountry(string path)
        {
            string f = File.ReadAllText(path);

            currentFile = RemoveWhiteSpace(f);
            string tag = Regex.Match(path.Split(@"\").Last(), @"([A-Z]+) - .+").Groups[1].Value.ToUpper();

            //string tag = path.Split(@"\").Last().Substring(1, 3).ToUpper();

            if (!Regex.IsMatch(tag, @"[A-Z]+"))
            {
                Status = $"Country tag {tag} is not valid for {path}.";
                return(false);
            }

            string   pol = FindKey("set_politics");
            string   pop = FindKey("set_popularities");
            Politics p   = new Politics();

            if (pop != string.Empty)
            {
                p.neutrality = FindKeyInt("neutrality", pop);
                p.democracy  = FindKeyInt("democratic", pop);
                p.fascism    = FindKeyInt("fascism", pop);
                p.communism  = FindKeyInt("communism", pop);
            }
            ;

            if (pol != string.Empty)
            {
                p.rulingParty       = (Ideology)Enum.Parse(typeof(Ideology), FindKey("ruling_party", pol), true);
                p.lastElection      = DateTime.Parse(FindKey("last_election", pol));
                p.electionFrequency = FindKeyInt("election_frequency", pol);
                p.electionsAllowed  = FindKey("election_allowed", pol) == "yes";
            }

            if (Country.Create(tag))
            {
                Country c = Country.Get(tag);
                c.Name           = Localisation.Get($"{tag}_{p.rulingParty.ToString().ToLower()}");
                c.Oob            = FindKey("oob");
                c.ResearchSlots  = FindKeyInt("set_research_slots");
                c.Convoys        = FindKeyInt("set_convoys");
                c.Stability      = FindKeyDouble("set_stability");
                c.WarSupport     = FindKeyDouble("set_war_support");
                c.Politics       = p;
                c.FactionName    = FindKey("create_faction");
                c.FactionMembers = FindMultipleKey("add_to_faction");
                c.Capital        = FindKeyInt("capital");
                c.SetUnmodified();
            }
            else
            {
                Status = $"Error creating country {tag} for {path}.";
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            Politics politics = db.Politics.Find(id);

            db.Politics.Remove(politics);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
 public Country()
 {
     funds = 10;
     clout = 10;
     economy = new Economy();
     military = new Military();
     politics = new Politics();
     climate = new Climate();
 }
Ejemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "PoliticsId,StateId,VordId,VordName,PolitianName1,PolitianParty1,PolitianName2,PolitianParty2,PolitianResult")] Politics politics)
 {
     if (ModelState.IsValid)
     {
         db.Entry(politics).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(politics));
 }
Ejemplo n.º 7
0
        public ActionResult Create([Bind(Include = "PoliticsId,StateId,VordId,VordName,PolitianName1,PolitianParty1,PolitianName2,PolitianParty2,PolitianResult")] Politics politics)
        {
            if (ModelState.IsValid)
            {
                db.Politics.Add(politics);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(politics));
        }
Ejemplo n.º 8
0
        // GET: Politics/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Politics politics = db.Politics.Find(id);

            if (politics == null)
            {
                return(HttpNotFound());
            }
            return(View(politics));
        }
Ejemplo n.º 9
0
        private void EditPartyIdeologyCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            Country  selectedCountry = (Country)CountryList.SelectedItem;
            Politics p = selectedCountry.Politics;
            string   selectedIdeology = EditPartyIdeologyCombo.SelectedItem.ToString();

            EditPartyNameTextBox.Text = baseGame.LocalisationLookup.ContainsKey(selectedCountry.Tag + "_" + selectedIdeology + "_party") ?
                                        baseGame.LocalisationLookup[selectedCountry.Tag + "_" + selectedIdeology + "_party"] : "UNNAMED";
            if (p.IdeologyPopularity.ContainsKey(selectedIdeology))
            {
                //Console.WriteLine("Pop: "+ p.IdeologyPopularity[selectedIdeology].ToString());
            }
            EditPartyPopularityNumeric.Value = p.IdeologyPopularity.ContainsKey(selectedIdeology) ? p.IdeologyPopularity[selectedIdeology] : 0;
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 保存
 /// </summary>
 public override void Save()
 {
     if (!m_Loaded)           //新增
     {
         Politics politics = new Politics();
         SaveToDb(this, politics, true);
     }
     else            //修改
     {
         Politics politics = new Politics(politicsId);
         if (politics.IsNew)
         {
             throw new AppException("该数据已经不存在了");
         }
         SaveToDb(this, politics, false);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns>是否成功</returns>
        public override void Delete()
        {
            if (!m_Loaded)
            {
                throw new AppException("尚未初始化");
            }
            bool result = (Politics.Delete(PoliticsId) == 1);

            //更新缓存
            if (result && CachedEntityCommander.IsTypeRegistered(typeof(PoliticsInfo)))
            {
                ResetCache();
            }
            if (!result)
            {
                throw new AppException("删除失败,数据可能被删除");
            }
        }
Ejemplo n.º 12
0
        public static void InitData()
        {
            DebugLog.LogToFileOnly("InitData");
            TransportLineData.DataInit();
            VehicleData.DataInit();
            BuildingData.DataInit();
            CitizenUnitData.DataInit();
            CitizenData.DataInit();
            RealCityEconomyManager.DataInit();

            Politics.DataInit();

            //System.Random rand = new System.Random();
            //RealCityEconomyExtension.partyTrend = (byte)rand.Next(5);
            //RealCityEconomyExtension.partyTrendStrength = (byte)rand.Next(300);

            DebugLog.LogToFileOnly("InitData Done");
        }
Ejemplo n.º 13
0
 private void LoadFromId(int politicsId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(PoliticsInfo)))
     {
         PoliticsInfo politicsInfo = Find(GetList(), politicsId);
         if (politicsInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(politicsInfo, this);
     }
     else
     {
         Politics politics = new Politics(politicsId);
         if (politics.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, politics);
     }
 }
Ejemplo n.º 14
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {
                if (Next == "Business")
                {
                    Business frm = new Business(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Religious")
                {
                    Religious_1 frm = new Religious_1(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Environment")
                {
                    Environment frm = new Environment(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Sports")
                {
                    Sports_1 frm = new Sports_1(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }

                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }
            }

            else
            {
                Finish frm = new Finish();
                frm.Show();
            }

            this.Close();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 处理市民
        /// </summary>
        /// <param name="homeID"></param>
        /// <param name="data"></param>
        /// <param name="isPre"></param>
        public static void ProcessCitizen(uint homeID, ref CitizenUnit data, bool isPre)
        {
            FieldInfo fieldInfo;

            if (isPre)
            {
                CitizenUnitData.familyMoney[homeID] = 0;
                for (int i = 0; i <= 4; i++)
                {
                    fieldInfo = data.GetType().GetField($"m_citizen{i}");
                    uint m_citizenI = (uint)fieldInfo.GetValue(data);
                    if (m_citizenI != 0)
                    {
                        Citizen citizenData = Singleton <CitizenManager> .instance.m_citizens.m_buffer[m_citizenI];
                        if ((citizenData.m_flags & Citizen.Flags.MovingIn) == Citizen.Flags.None)
                        {
                            if (citizenData.Dead == false)
                            {
                                RealCityResidentAI.citizenCount++;
                                CitizenUnitData.familyMoney[homeID] += CitizenData.citizenMoney[m_citizenI];
                            }
                        }
                    }
                }
            }
            else
            {
                // post-process
                if (CitizenUnitData.familyMoney[homeID] < MainDataStore.lowWealth)
                {
                    RealCityResidentAI.familyWeightStableLow++;
                }
                else if (CitizenUnitData.familyMoney[homeID] >= MainDataStore.highWealth)
                {
                    RealCityResidentAI.familyWeightStableHigh++;
                }

                int temp = 0;
                for (int i = 0; i <= 4; i++)
                {
                    fieldInfo = data.GetType().GetField($"m_citizen{i}");
                    uint m_citizenI = (uint)fieldInfo.GetValue(data);

                    if (m_citizenI != 0)
                    {
                        Citizen citizenData = Singleton <CitizenManager> .instance.m_citizens.m_buffer[m_citizenI];
                        if (((citizenData.m_flags & Citizen.Flags.MovingIn) == Citizen.Flags.None) && (citizenData.Dead == false))
                        {
                            ++temp;
#if FASTRUN
#else
                            //add a party.chancce by its citizen data
                            //GetVoteChance(m_citizenI, citizenData, homeID);
                            if (Politics.IsOnElection() && Politics.IsOverVotingAge(Citizen.GetAgeGroup(citizenData.m_age)))
                            {
                                ElectionVoter v = new ElectionVoter(m_citizenI, ref citizenData, homeID, Election.CurrentElectionInfo);
                                v.VoteTicket();
                            }
#endif
                        }
                    }
                }

                if (temp != 0)
                {
                    for (int i = 0; i <= 4; i++)
                    {
                        fieldInfo = data.GetType().GetField($"m_citizen{i}");
                        uint m_citizenI = (uint)fieldInfo.GetValue(data);

                        if (m_citizenI != 0)
                        {
                            Citizen citizenData = Singleton <CitizenManager> .instance.m_citizens.m_buffer[m_citizenI];
                            if (((citizenData.m_flags & Citizen.Flags.MovingIn) == Citizen.Flags.None) && (citizenData.Dead == false))
                            {
                                CitizenData.citizenMoney[m_citizenI] = CitizenUnitData.familyMoney[homeID] / temp;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 16
0
 //从后台获取数据
 internal static void  LoadFromDAL(PoliticsInfo pPoliticsInfo, Politics pPolitics)
 {
     pPoliticsInfo.politicsId   = pPolitics.PoliticsId;
     pPoliticsInfo.politicsName = pPolitics.PoliticsName;
     pPoliticsInfo.Loaded       = true;
 }
Ejemplo n.º 17
0
        public static void GetVoteChance(uint citizenID, Citizen citizen, uint homeID)
        {
            //如果即将选举,而且达到投票年龄 if (gonna be election) and (over Voting Age)
            if (Politics.IsOnElection() &&
                Politics.IsOverVotingAge(Citizen.GetAgeGroup(citizen.m_age)))
            {
                ////重置机率
                Politics.cPartyChance = 0;
                Politics.gPartyChance = 0;
                Politics.sPartyChance = 0;
                Politics.lPartyChance = 0;
                Politics.nPartyChance = 0;


                Politics.cPartyChance += (ushort)(Politics.education[(int)citizen.EducationLevel, 0] << 1);
                Politics.gPartyChance += (ushort)(Politics.education[(int)citizen.EducationLevel, 1] << 1);
                Politics.sPartyChance += (ushort)(Politics.education[(int)citizen.EducationLevel, 2] << 1);
                Politics.lPartyChance += (ushort)(Politics.education[(int)citizen.EducationLevel, 3] << 1);
                Politics.nPartyChance += (ushort)(Politics.education[(int)citizen.EducationLevel, 4] << 1);


                int choiceIndex = 14;
                //根据工作地点决定投票策略
                if (RealCityResidentAI.IsGoverment(citizen.m_workBuilding))
                {
                    choiceIndex = 0;
                }
                switch (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_subService)
                {
                case ItemClass.SubService.CommercialLow:
                case ItemClass.SubService.CommercialHigh:
                    if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level1)
                    {
                        choiceIndex = 1;
                    }
                    else if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level2)
                    {
                        choiceIndex = 2;
                    }
                    else if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level3)
                    {
                        choiceIndex = 3;
                    }
                    break;

                case ItemClass.SubService.CommercialTourist:
                case ItemClass.SubService.CommercialLeisure:
                    choiceIndex = 4; break;

                case ItemClass.SubService.CommercialEco:
                    choiceIndex = 5; break;

                case ItemClass.SubService.IndustrialGeneric:
                    if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level1)
                    {
                        choiceIndex = 6;
                    }
                    else if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level2)
                    {
                        choiceIndex = 7;
                    }
                    else if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level3)
                    {
                        choiceIndex = 8;
                    }
                    break;

                case ItemClass.SubService.IndustrialFarming:
                case ItemClass.SubService.IndustrialForestry:
                case ItemClass.SubService.IndustrialOil:
                case ItemClass.SubService.IndustrialOre:
                    choiceIndex = 9; break;

                case ItemClass.SubService.OfficeGeneric:
                    if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level1)
                    {
                        choiceIndex = 10;
                    }
                    else if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level2)
                    {
                        choiceIndex = 11;
                    }
                    else if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[citizen.m_workBuilding].Info.m_class.m_level == ItemClass.Level.Level3)
                    {
                        choiceIndex = 12;
                    }
                    break;

                case ItemClass.SubService.OfficeHightech:
                    choiceIndex = 13; break;
                }
                if (choiceIndex < 0 || choiceIndex > 14)
                {
                    DebugLog.LogToFileOnly($"Error: GetVoteChance workplace idex {choiceIndex}");
                }
                Politics.cPartyChance += (ushort)(Politics.workplace[choiceIndex, 0] << 1);
                Politics.gPartyChance += (ushort)(Politics.workplace[choiceIndex, 1] << 1);
                Politics.sPartyChance += (ushort)(Politics.workplace[choiceIndex, 2] << 1);
                Politics.lPartyChance += (ushort)(Politics.workplace[choiceIndex, 3] << 1);
                Politics.nPartyChance += (ushort)(Politics.workplace[choiceIndex, 4] << 1);


                if (CitizenUnitData.familyMoney[homeID] < 5000)
                {
                    choiceIndex = 0;
                }
                else if (CitizenUnitData.familyMoney[homeID] >= 20000)
                {
                    choiceIndex = 2;
                }
                else
                {
                    choiceIndex = 1;
                }
                if (choiceIndex < 0 || choiceIndex > 3)
                {
                    DebugLog.LogToFileOnly($"Error: GetVoteChance Invaid money idex = {choiceIndex}");
                }
                Politics.cPartyChance += (ushort)(Politics.money[choiceIndex, 0] << 1);
                Politics.gPartyChance += (ushort)(Politics.money[choiceIndex, 1] << 1);
                Politics.sPartyChance += (ushort)(Politics.money[choiceIndex, 2] << 1);
                Politics.lPartyChance += (ushort)(Politics.money[choiceIndex, 3] << 1);
                Politics.nPartyChance += (ushort)(Politics.money[choiceIndex, 4] << 1);


                int temp = (int)Citizen.GetAgeGroup(citizen.m_age) - 2;
                if (temp < 0)
                {
                    DebugLog.LogToFileOnly($"Error: GetVoteChance temp = {temp} < 0, GetAgeGroup = {Citizen.GetAgeGroup(citizen.m_age)}");
                }
                Politics.cPartyChance += Politics.age[temp, 0];
                Politics.gPartyChance += Politics.age[temp, 1];
                Politics.sPartyChance += Politics.age[temp, 2];
                Politics.lPartyChance += Politics.age[temp, 3];
                Politics.nPartyChance += Politics.age[temp, 4];


                temp = (int)Citizen.GetGender(citizenID);
                Politics.cPartyChance += Politics.gender[temp, 0];
                Politics.gPartyChance += Politics.gender[temp, 1];
                Politics.sPartyChance += Politics.gender[temp, 2];
                Politics.lPartyChance += Politics.gender[temp, 3];
                Politics.nPartyChance += Politics.gender[temp, 4];


                if (RealCityEconomyExtension.partyTrend == 0)
                {
                    Politics.cPartyChance += RealCityEconomyExtension.partyTrendStrength;
                }
                else if (RealCityEconomyExtension.partyTrend == 1)
                {
                    Politics.gPartyChance += RealCityEconomyExtension.partyTrendStrength;
                }
                else if (RealCityEconomyExtension.partyTrend == 2)
                {
                    Politics.sPartyChance += RealCityEconomyExtension.partyTrendStrength;
                }
                else if (RealCityEconomyExtension.partyTrend == 3)
                {
                    Politics.lPartyChance += RealCityEconomyExtension.partyTrendStrength;
                }
                else if (RealCityEconomyExtension.partyTrend == 4)
                {
                    Politics.nPartyChance += RealCityEconomyExtension.partyTrendStrength;
                }
                else
                {
                    DebugLog.LogToFileOnly($"Error: GetVoteChance Invalid partyTrend = {RealCityEconomyExtension.partyTrend}");
                }
                GetVoteTickets();
            }
        }
Ejemplo n.º 18
0
        //获取政治面貌信息表
        public static DataTable getPoliticsList()
        {
            Query q = Politics.Query();

            return(q.ExecuteDataSet().Tables[0]);
        }
Ejemplo n.º 19
0
 private void LoadFromId(int politicsId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(PoliticsInfo)))
     {
         PoliticsInfo politicsInfo=Find(GetList(), politicsId);
         if(politicsInfo==null)
             throw new AppException("未能在缓存中找到相应的键值对象");
         Copy(politicsInfo, this);
     }
     else
     {	Politics politics=new Politics( politicsId);
         if(politics.IsNew)
         throw new AppException("尚未初始化");
        	LoadFromDAL(this, politics);
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Is on election?
 /// </summary>
 /// <returns></returns>
 public static bool IsOnElection()
 {
     return(Politics.IsOnElection());
 }
Ejemplo n.º 21
0
 //从后台获取数据
 internal static void LoadFromDAL(PoliticsInfo pPoliticsInfo, Politics  pPolitics)
 {
     pPoliticsInfo.politicsId = pPolitics.PoliticsId;
      		pPoliticsInfo.politicsName = pPolitics.PoliticsName;
     pPoliticsInfo.Loaded=true;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// 保存
 /// </summary>
 public override void Save()
 {
     if(!m_Loaded)//新增
     {
         Politics politics=new Politics();
         SaveToDb(this, politics,true);
     }
     else//修改
     {
         Politics politics=new Politics(politicsId);
         if(politics.IsNew)
             throw new AppException("该数据已经不存在了");
         SaveToDb(this, politics,false);
     }
 }
Ejemplo n.º 23
0
        private void CountryList_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedCountry = (Country)CountryList.SelectedItem;

            if (selectedCountry != null)
            {
                string tag = selectedCountry.Tag;

                UpdateFieldEditability(selectedCountry);

                UpdateCountryNameFields(tag);

                lblCountryTag.Text = tag + ": " + selectedCountry.Name;

                SetFlagPicture(NeutralFlagPicture, tag + "_neutrality.tga");
                SetFlagPicture(DemocracyFlagPicture, tag + "_democratic.tga");
                SetFlagPicture(FascistFlagPicture, tag + "_fascism.tga");
                SetFlagPicture(CommunistFlagPicture, tag + "_communism.tga");
                CountryColourBox.BackColor = selectedCountry.MainColour;

                DemocracyNameLabel.Text = baseGame.LocalisationLookup[tag + "_democratic"];
                NeutralNameLabel.Text   = baseGame.LocalisationLookup[tag + "_neutrality"];
                FascistNameLabel.Text   = baseGame.LocalisationLookup[tag + "_fascism"];
                CommunistNameLabel.Text = baseGame.LocalisationLookup[tag + "_communism"];

                foreach (string key in selectedCountry.Politics.IdeologyPopularity.Keys)
                {
                    //Console.WriteLine(key +": "+selectedCountry.Politics.IdeologyPopularity[key]);
                }

                CountryPoliticsBox.Text  = selectedCountry.Politics.ToString();
                CountryPoliticsBox.Text += "\n\nCountry Leaders:\n";
                foreach (Leader l in selectedCountry.Leaders)
                {
                    CountryPoliticsBox.Text += l.Name + " (" + l.Ideology + ")\n";
                }


                CountryPoliticsBox.Text += "\n\nField Marshals:\n";
                foreach (Commander c in selectedCountry.FieldMarshals)
                {
                    CountryPoliticsBox.Text += c.Name + " (" + c.Skill.ToString() + ")\n";
                }

                CountryPoliticsBox.Text += "\n\nCorps Commanders:\n";
                foreach (Commander c in selectedCountry.CorpsCommanders)
                {
                    CountryPoliticsBox.Text += c.Name + " (" + c.Skill.ToString() + ")\n";
                }

                CountryPoliticsBox.Text += "\n\nNaval Commanders:\n";
                foreach (Commander c in selectedCountry.NavalCommanders)
                {
                    CountryPoliticsBox.Text += c.Name + " (" + c.Skill.ToString() + ")\n";
                }

                // Set politics
                Politics p = selectedCountry.Politics;
                string   selectedIdeology = EditPartyIdeologyCombo.SelectedItem.ToString();
                EditPartyNameTextBox.Text = baseGame.LocalisationLookup.ContainsKey(selectedCountry.Tag + "_" + selectedIdeology + "_party") ?
                                            baseGame.LocalisationLookup[selectedCountry.Tag + "_" + selectedIdeology + "_party"] : "UNNAMED";
                EditPartyPopularityNumeric.Value = p.IdeologyPopularity.ContainsKey(selectedIdeology) ? p.IdeologyPopularity[selectedIdeology] : 0;
                lblNeutralityPopularity.Text     = p.IdeologyPopularity.ContainsKey("neutrality") ? "neutrality: " + p.IdeologyPopularity["neutrality"].ToString() : "neutrality: 0";
                lblDemocraticPopularity.Text     = p.IdeologyPopularity.ContainsKey("democratic") ? "democratic: " + p.IdeologyPopularity["democratic"].ToString() : "democratic: 0";
                lblFascismPopularity.Text        = p.IdeologyPopularity.ContainsKey("fascism") ? "fascism: " + p.IdeologyPopularity["fascism"].ToString() : "fascism: 0";
                lblCommunismPopularity.Text      = p.IdeologyPopularity.ContainsKey("communism") ? "communism: " + p.IdeologyPopularity["communism"].ToString() : "communism: 0";

                EditCountryRulingPartyCombo.SelectedIndex = selectedCountry.Politics.GetRulingPartyIndex();
                EditCountryElectionDatePicker.Value       = selectedCountry.Politics.GetLastElectionDate();
                EditCountryElectionFrequencyNumeric.Value = selectedCountry.Politics.ElectionFrequency > 0 ? selectedCountry.Politics.ElectionFrequency : 48;
                EditCountryElectionsBannedCheck.Checked   = selectedCountry.Politics.GetElectionsAllowed();

                if (LeaderTypeDropdown.SelectedIndex == 0)
                {
                    UpdateCountryLeadersListBox(selectedCountry);
                }
                else
                {
                    UpdateCountryCommandersListBox(selectedCountry);
                }
            }
            else
            {
                UpdateCountryNameFields("");
            }
        }
Ejemplo n.º 24
0
        public void GenerateWorld()
        {
#if !DEBUG
            try
#endif
            {
                CurrentState = GenerationState.Generating;

                LoadingMessage = "Init..";
                OverworldMap.heightNoise.Seed = Overworld.Seed;
                Overworld.Map.Map             = new OverworldCell[Overworld.Width, Overworld.Height];

                Progress = 0.01f;

                LoadingMessage           = "Height Map ...";
                float[,] heightMapLookup = null;
                heightMapLookup          = OverworldMap.GenerateHeightMapLookup(Overworld.Width, Overworld.Height);
                Overworld.Map.CreateHeightFromLookup(heightMapLookup);

                Progress = 0.05f;

                int numRains       = (int)Overworld.GenerationSettings.NumRains;
                int rainLength     = 250;
                int numRainSamples = 3;

                for (int x = 0; x < Overworld.Width; x++)
                {
                    for (int y = 0; y < Overworld.Height; y++)
                    {
                        Overworld.Map.Map[x, y].Erosion    = 1.0f;
                        Overworld.Map.Map[x, y].Weathering = 0;
                        Overworld.Map.Map[x, y].Faults     = 1.0f;
                    }
                }

                LoadingMessage = "Climate";
                for (int x = 0; x < Overworld.Width; x++)
                {
                    for (int y = 0; y < Overworld.Height; y++)
                    {
                        Overworld.Map.Map[x, y].Temperature = ((float)(y) / (float)(Overworld.Height)) * Overworld.GenerationSettings.TemperatureScale;
                    }
                }

                OverworldImageOperations.Distort(Overworld.Map.Map, Overworld.Width, Overworld.Height, 30.0f, 0.005f, OverworldField.Temperature);
                for (int x = 0; x < Overworld.Width; x++)
                {
                    for (int y = 0; y < Overworld.Height; y++)
                    {
                        Overworld.Map.Map[x, y].Temperature = Math.Max(Math.Min(Overworld.Map.Map[x, y].Temperature, 1.0f), 0.0f);
                    }
                }

                int numVoronoiPoints = (int)Overworld.GenerationSettings.NumFaults;

                Progress       = 0.1f;
                LoadingMessage = "Faults ...";

                Voronoi(Overworld.Width, Overworld.Height, numVoronoiPoints);
                Overworld.Map.CreateHeightFromLookupWithErosion(heightMapLookup);

                Progress = 0.2f;

                Overworld.Map.CreateHeightFromLookupWithErosion(heightMapLookup);

                Progress = 0.25f;

                LoadingMessage = "Erosion...";
                var buffer = new float[Overworld.Width, Overworld.Height];
                Erode(Overworld.Width, Overworld.Height, Overworld.GenerationSettings.SeaLevel, Overworld.Map.Map, numRains, rainLength, numRainSamples, buffer);
                Overworld.Map.CreateHeightFromLookupWithErosion(heightMapLookup);

                Progress = 0.9f;

                LoadingMessage = "Blur.";
                OverworldImageOperations.Blur(Overworld.Map.Map, Overworld.Width, Overworld.Height, OverworldField.Erosion);

                LoadingMessage = "Generate height.";
                Overworld.Map.CreateHeightFromLookupWithErosion(heightMapLookup);

                LoadingMessage = "Rain";
                CalculateRain(Overworld.Width, Overworld.Height);

                LoadingMessage = "Biome";
                for (int x = 0; x < Overworld.Width; x++)
                {
                    for (int y = 0; y < Overworld.Height; y++)
                    {
                        Overworld.Map.Map[x, y].Biome = Library.GetBiomeForConditions(Overworld.Map.Map[x, y].Temperature, Overworld.Map.Map[x, y].Rainfall, Overworld.Map.Map[x, y].Height).Biome;
                    }
                }

                LoadingMessage = "Volcanoes";
                GenerateVolcanoes(Overworld.Width, Overworld.Height);

                LoadingMessage = "Factions";
                FactionSet library = new FactionSet();
                library.Initialize(null, new CompanyInformation());

                Overworld.Natives = new List <OverworldFaction>();
                foreach (var fact in library.Factions)
                {
                    Overworld.Natives.Add(fact.Value.ParentFaction); // Todo: Don't create a whole faction just to grab the overworldfactions from them.
                }
                for (int i = 0; i < Overworld.GenerationSettings.NumCivilizations; i++)
                {
                    Overworld.Natives.Add(library.GenerateOverworldFaction(Overworld, i, Overworld.GenerationSettings.NumCivilizations));
                }
                Politics.Initialize(Overworld);

                Overworld.ColonyCells      = new CellSet("World\\colonies");
                Overworld.InstanceSettings = new InstanceSettings(Overworld.ColonyCells.GetCellAt(16, 0));

                SeedCivs();
                GrowCivs();

                for (int x = 0; x < Overworld.Width; x++)
                {
                    Overworld.Map.Map[x, 0] = Overworld.Map.Map[x, 1];
                    Overworld.Map.Map[x, Overworld.Height - 1] = Overworld.Map.Map[x, Overworld.Height - 2];
                }

                for (int y = 0; y < Overworld.Height; y++)
                {
                    Overworld.Map.Map[0, y] = Overworld.Map.Map[1, y];
                    Overworld.Map.Map[Overworld.Width - 1, y] = Overworld.Map.Map[Overworld.Width - 2, y];
                }

                CurrentState   = GenerationState.Finished;
                LoadingMessage = "";
                Progress       = 1.0f;
            }
#if !DEBUG
            catch (Exception exception)
            {
                ProgramData.WriteExceptionLog(exception);
                throw;
            }
#endif
        }
Ejemplo n.º 25
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {
                if (Next == "Environment")
                {
                    Environment frm = new Environment(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Sports")
                {
                    Sports_1 frm = new Sports_1(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }
                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }
            }

            else
            {
                Finish frm = new Finish();
                frm.Show();
            }

            this.Close();
        }
Ejemplo n.º 26
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {
                if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }
                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }
            }
            else
            {
                Finish frm = new Finish();
                frm.Show();
            }

            this.Close();
        }
Ejemplo n.º 27
0
 //数据持久化
 internal static void SaveToDb(PoliticsInfo pPoliticsInfo, Politics  pPolitics,bool pIsNew)
 {
     pPolitics.PoliticsId = pPoliticsInfo.politicsId;
      		pPolitics.PoliticsName = pPoliticsInfo.politicsName;
     pPolitics.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pPolitics.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(PoliticsInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pPoliticsInfo.politicsId = pPolitics.PoliticsId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(PoliticsInfo)))
     {
         ResetCache();
     }
 }
Ejemplo n.º 28
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                  sw.WriteLine("James Cameron's big-budget (and even bigger-grossing) films create unreal worlds all their own. In this talk, he reveals his childhood fascination with the fantastic  from reading science fiction to deep-sea diving and how it ultimately drove the success of his blockbuster hits Aliens,The Terminator,Titanic and Avatar.James Cameron is the director of Avatar, Titanic, Terminator, The Abyss and many other blockbusters. While his outsize films push the bounds of technology, they're always anchored in human stories with heart and soul.");
                    sw.WriteLine("Film producer Jeff Skoll (An Inconvenient Truth) talks about his film company, Participant Productions, and the people who've inspired him to do good.Jeff Skoll was the first president of eBay; he used his dot-com fortune to found the film house Participant Productions, making movies to inspire social change, including Syriana; Good Night, and Good Luck; Murderball; An Inconvenient Trut");
                    sw.WriteLine("Movies have the power to create a shared narrative experience and to shape memories and worldviews. British film director Beeban Kidron invokes iconic film scenes -- from Miracle in Milan to Boyz n the Hood -- as she shows how her group FILMCLUB shares great films with kids. Beeban Kidron directed Bridget Jones: The Edge of Reason and Oranges Are Not the Only Fruit. She also cofounded FILMCLUB, a charity for students devoted to the art of storytelling through film");
                    sw.WriteLine("Nathaniel Kahn shares clips from his documentary My Architect, about his quest to understand his father, the legendary architect Louis Kahn. It's a film with meaning to anyone who seeks to understand the relationship between art and love. Nathaniel Kahn is an Oscar- and Emmy-nominated maker of documentary films. His journey to understand his distant father -- the legendary modern architect Louis Kahn -- became the film My Architect.");
                    sw.WriteLine("Every act of communication is, in some way, an act of translation. Onstage at TEDxRainier, writer Chris Bliss thinks hard about the way that great comedy can translate deep truths for a mass audience. (Filmed at TEDxRainier.) Chris Bliss explores the inherent challenge of communication, and how comedy opens paths to new perspectives.");
                    sw.WriteLine("At TED2012, filmmaker Karen Bass shares some of the astonishing nature footage she's shot for the BBC and National Geographic -- including brand-new, previously unseen footage of the tube-lipped nectar bat, who feeds in a rather unusual way … Karen Bass has traveled the world to explore and capture footage from every environment across the Earth");
                    sw.Close();
                    aFile.Close();
                }
            }

             if (length == 4 || length == 3 || length == 1)
             {

                 if (Next == "Business")
                 {
                     Business frm = new Business(NewUserSlections);
                     frm.Show();
                 }

                 else if (Next == "Religious")
                 {
                     Religious_1 frm = new Religious_1(NewUserSlections);
                     frm.Show();
                 }

                 else if (Next == "Environment")
                 {
                     Environment frm = new Environment(NewUserSlections);
                     frm.Show();
                 }

                 else if (Next == "Sports")
                 {
                     Sports_1 frm = new Sports_1(NewUserSlections);
                     frm.Show();
                 }

                 else if (Next == "Politics")
                 {
                     Politics frm = new Politics(NewUserSlections);
                     frm.Show();
                 }

                 else if (Next == "Medical")
                 {
                     Medical frm = new Medical(NewUserSlections);
                     frm.Show();
                 }

                 else if (Next == "Science")
                 {
                     Science frm = new Science(NewUserSlections);
                     frm.Show();
                 }

                 else
                 {
                     Finish frm = new Finish();
                     frm.Show();
                 }
             }

             else
             {
                 Finish frm = new Finish();
                 frm.Show();
             }

             this.Close();
        }
Ejemplo n.º 29
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {

                if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }
                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }

            }
                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }

            this.Close();
        }
Ejemplo n.º 30
0
        public void Initialize(DateTime now)
        {
            TimeSpan forever = new TimeSpan(999999, 0, 0, 0);
            foreach (var faction in Factions.Factions)
            {
                foreach (var otherFaction in Factions.Factions)
                {
                    Pair<Faction> pair = new Pair<Faction>(faction.Value, otherFaction.Value);

                    if (FactionPolitics.ContainsKey(pair))
                        continue;

                    if (faction.Key == otherFaction.Key)
                    {
                        FactionPolitics[pair] = new Politics()
                        {
                            Faction = faction.Value,
                            HasMet = true,
                            RecentEvents = new List<PoliticalEvent>()
                            {
                                new PoliticalEvent()
                                {
                                    Change = 1.0f,
                                    Description = "We belong to the same faction.",
                                    Duration = forever,
                                    Time = now
                                }
                            }
                        };
                    }
                    else
                    {
                        Politics politics = new Politics()
                        {
                            Faction = otherFaction.Value,
                            HasMet = false,
                            RecentEvents = new List<PoliticalEvent>()
                        };

                        if (faction.Value.Race == otherFaction.Value.Race)
                        {
                            politics.RecentEvents.Add(new PoliticalEvent()
                            {
                                Change = 0.5f,
                                Description = "We belong to the same race.",
                                Duration = forever,
                                Time = now
                            });

                        }
                        FactionPolitics[pair] = politics;
                    }

                }
            }
        }
Ejemplo n.º 31
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {

                 if (Next == "Environment")
                {
                    Environment frm = new Environment(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Sports")
                {
                    Sports_1 frm = new Sports_1(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }
                 else
                 {
                     Finish frm = new Finish();
                     frm.Show();
                 }
            }

                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }

            this.Close();
        }