Esempio n. 1
0
        public void Clear()
        {
            ListHistory.Clear();
            HistoryItem h = new HistoryItem();

            h.Title   = "Google";
            h.Url     = "https:\\www.google.com";
            h.Tanggal = DateTime.UtcNow;
            h.Id      = Utils.GenerateNewUCID();
            ListHistory.Add(h);
            Save();
            Load();
        }
Esempio n. 2
0
        public void Add(string title, string url)
        {
            foreach (HistoryItem item in ListHistory)
            {
                if (item.Url == url && item.Title == title)
                {
                    ListHistory.Remove(item);
                }
            }
            HistoryItem h = new HistoryItem();

            h.Title   = title;
            h.Url     = url;
            h.Tanggal = DateTime.UtcNow;
            h.Id      = Utils.GenerateNewUCID();
            ListHistory.Add(h);
        }
Esempio n. 3
0
 public History()
 {
     if (!File.Exists(HistoryFile))
     {
         HistoryItem h = new HistoryItem();
         h.Title   = "Google";
         h.Url     = "https:\\www.google.com";
         h.Tanggal = DateTime.UtcNow;
         h.Id      = Utils.GenerateNewUCID();
         ListHistory.Add(h);
         var history = JsonConvert.SerializeObject(ListHistory);
         Utils.WriteFileAsync(HistoryFile, history);
         Load();
     }
     else
     {
         Load();
     }
 }