Ejemplo n.º 1
0
        private void SearchTagsAndPublishedBy(object sender, RoutedEventArgs e)
        {
            //BookmarkManagerDesktop.Entrance.ConnectionString = Configuration.ConnectionString;
            BookmarkManagerDesktop.BookmarkManager bookmarkManager = new BookmarkManagerDesktop.BookmarkManager();
            string searchText = textSearch.Text.ToString();

            _Bookmarks  = bookmarkManager.GetUrl(searchText);
            DataContext = _Bookmarks;
        }
Ejemplo n.º 2
0
        private void InitRichTextBoxSource()
        {
            BookmarkManagerDesktop.BookmarkManager bookmarkManager = new BookmarkManagerDesktop.BookmarkManager();

            List <Tag> bmt = bookmarkManager.GetAllTags();

            foreach (var tag in bmt)
            {
                ContentAssistSource.Add(tag.TagName);
            }
        }
Ejemplo n.º 3
0
 private void gethtml()
 {
     try
     {
         using (WebResponse wr = WebRequest.Create(linkBox.Text).GetResponse())
         {
             using (StreamReader sr = new StreamReader(wr.GetResponseStream()))
             {
                 BookmarkManagerDesktop.BookmarkManager bookmarkManager = new BookmarkManagerDesktop.BookmarkManager();
                 string someString = sr.ReadToEnd();
                 bookmarkManager.InsertHTML(linkBox.Text, someString);
                 MessageBox.Show("The HTML from the link you've entered has been saved.", "Success!", MessageBoxButton.OK);
             }
         }
     }
     catch (Exception)
     {
         linkBox.Focus();
         MessageBox.Show("The link is invalid or there is no connection to the entered link.", "Connection error", MessageBoxButton.OK);
     }
 }
Ejemplo n.º 4
0
        private void AddButton(object sender, RoutedEventArgs e)
        {
            if (!Validation())
            {
                MessageBox.Show("Incorect input", "Error", MessageBoxButton.OK);
            }
            else
            {
                //BookmarkManagerDesktop.Configuration.ConnectionString = Configuration.ConnectionString;
                BookmarkManagerDesktop.BookmarkManager bookmarkManager = new BookmarkManagerDesktop.BookmarkManager();

                string url         = Uri.EscapeUriString(linkBox.Text.ToString());
                string description = textDescription.Text.ToString();

                //Tokenizer.Document = flowDoc;


                string tagText = tagGetter();
                if (string.IsNullOrWhiteSpace(tagText))
                {
                    _IsEmpty = true;
                }
                bool isAdded = bookmarkManager.InsertData(url, description, tagText);
                if (isAdded)
                {
                    MessageBoxResult result = MessageBox.Show("Do you want to save the html from the current link?", "Message", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        gethtml();
                    }
                    linkBox.Clear();
                    textDescription.Clear();
                    Tokenizer.Document.Blocks.Clear();
                }
                else
                {
                    MessageBox.Show("Connection error", "Error", MessageBoxButton.OK);
                }
            }
        }