Пример #1
0
        public DataTable GetHistory()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Title");
            dt.Columns.Add("URL");

            UrlHistoryWrapperClass urlhistory = new UrlHistoryWrapperClass();

            UrlHistoryWrapperClass.STATURLEnumerator enumerator = urlhistory.GetEnumerator();

            while (enumerator.MoveNext())
            {
                try
                {
                    string url   = enumerator.Current.URL.Replace('\'', ' ');
                    string title = string.IsNullOrEmpty(enumerator.Current.Title)
                              ? enumerator.Current.Title.Replace('\'', ' ') : "";

                    dt.Rows.Add(new string[] { title, url });
                }
                catch
                {
                }
            }

            enumerator.Reset();
            urlhistory.ClearHistory();

            return(dt);
        }
Пример #2
0
    public IEnumerable <URL> GetHistory()
    {
        // Initiate main object
        UrlHistoryWrapperClass urlhistory = new UrlHistoryWrapperClass();

        // Enumerate URLs in History
        UrlHistoryWrapperClass.STATURLEnumerator enumerator =
            urlhistory.GetEnumerator();
        // Iterate through the enumeration
        while (enumerator.MoveNext())
        {
            // Obtain URL and Title
            string url = enumerator.Current.URL.Replace('\'', ' ');
            // In the title, eliminate single quotes to avoid confusion
            string title = string.IsNullOrEmpty(enumerator.Current.Title)
                ? enumerator.Current.Title.Replace('\'', ' ') : "";
            // Create new entry
            URL U = new URL(url, title, "Internet Explorer");
            // Add entry to list
            URLs.Add(U);
        }
        // Optional
        enumerator.Reset();
        // Clear URL History
        urlhistory.ClearHistory();
        return(URLs);
    }
Пример #3
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     if (DialogResult.OK == MessageBox.Show(this, "Are you sure ?", "UrlHistoryDemo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
     {
         urlHistory.ClearHistory();
         resetFilter_Click(this, EventArgs.Empty);
         Enumerate_Click(this, EventArgs.Empty);
     }
 }