示例#1
0
        //保存文章到数据库
        public static void SavePassage(Passage passage)
        {
            List <Passage> database_passages = new List <Passage>();

            database_passages = UserDataDB.instance.LoadPassage();

            foreach (var i in database_passages)
            {
                Debug.WriteLine(i.Content + "\n");
            }
            historyPassages = database_passages;
            int index = historyPassages.IndexOf(historyPassages.Where(x => x.HeadName == passage.HeadName).FirstOrDefault());

            if (index < 0)
            {
                historyPassages.Add(passage);
                UserDataDB.instance.SavaPassage(passage);  //文章存入数据库
            }
            else
            {
                historyPassages.RemoveAt(index);
                historyPassages.Add(passage);
                UserDataDB.instance.SavaPassage(passage); //文章存入数据库
            }
        }
示例#2
0
        //获取初始文章
        public Passage GetPassage()
        {
            Passage p = new Passage();

            //p.Content = "Donald Trump has pulled back from a potential trade war with Europe by postponing a decision on imposing steel and aluminum tariffs until 1 June.The US president imposed a worldwide 25 % tariff on steel imports and a 10 % tariff on aluminum in March but granted temporary exemptions to Canada, Mexico, Brazil, the European Union(EU), Australia and Argentina.These were due to expire at 12.01am on Tuesday.The extension offers temporary reprieve for French president Emmanuel Macron and German chancellor Angela Merkel, who lobbied Trump during visits to the White House last week.It could also be seen by political analysts as the latest issue on which Trump’s bark has proved worse than his bite.The administration “reached agreements in principle with Argentina, Australia, and Brazil with respect to steel and aluminum, the details of which will be finalized shortly”, the White House said on Monday. “The Administration is also extending negotiations with Canada, Mexico, and the European Union for a final 30 days. ";
            p.Content = "This is an example passage:   A London-based British Council employee has been arrested during a family visit to Iran, as the authorities in the country step up targeting people with ties to UK institutions.Aras Amiri, a 32 - cases are a worrying development for Nazanin Zaghari-Ratcliffe, the British woman who is serving a five - year jail sentence in Tehran on alleged spying charges and whose family insists she is being punished as a tool of diplomatic pressure.year - old Iranian national, was visiting her home country to see her ailing grandmother before the Persian new year, in March, when she was detained, said her cousin, Mohsen Omrani, on Wednesday.Amiri’s detention is the latest in a string of recent arrests involving British dual nationals or Iranians linked with British institutions. Last week it emerged that Abbas Edalat, a professor at Imperial College London, had been arrested in April by the hardline Revolutionary Guards.";

            p.HeadName = "Example";
            return(p);
        }
示例#3
0
 //删除文章
 public static void DeletePassage(Passage p)
 {
     try { UserDataDB.instance.DeletePassage(p.HeadName); }
     catch { }
 }