Esempio n. 1
0
        //Filter all the CodeSnippeds by the asigned Values
        public void FilterCodeSnippeds()
        {
            var bc = new BrushConverter();

            //Give all filter values and recieve a list with Items
            List <SnippetInfo> snippets = DbSnippets.GetFilteredSnippeds(
                SearchBox.Text,
                Language.SelectedItem.ToString(),
                Converter.StringToDateFilter(DateType.SelectedItem.ToString()),
                Converter.StringToTypefilter(SearchType.SelectedItem.ToString())
                );

            List <SnippetUI> items = new List <SnippetUI>();

            for (int i = 0; i < snippets.Count; i++)
            {
                items.Add(new SnippetUI(snippets[i]._Name, DbCodeLanguage.ToString(snippets[i]._LanguageID)));
            }


            Page.Containerr.Children.Clear();
            foreach (SnippetInfo i in snippets)
            {
                SnippetItem item = new SnippetItem(i, Page, this)
                {
                    Width = Page.Containerr.Width
                };
                Page.Containerr.Children.Add(item);
            }
            Page.ViewMode = false;
        }
Esempio n. 2
0
        //Main
        public SnippetItem(SnippetInfo info, SnippetsPage page, NavBarSnippet navbar)
        {
            InitializeComponent();

            Info = info;
            Page = page;

            Name.Content       = info._Name;
            Language.Content   = DbCodeLanguage.ToString(info._LanguageID);
            CreateDate.Content = info._CreateDate;
            Navbar             = navbar;
        }
Esempio n. 3
0
        //View-Button-Click
        private void View_Click(object sender, RoutedEventArgs e)
        {
            //Set Code,Usage,Name,Description enz....
            Page.Code.Document.Blocks.Clear();
            Page.Code.Document.Blocks.Add(new Paragraph(new Run(Info._Code)));

            Page.Description.Document.Blocks.Clear();
            Page.Description.Document.Blocks.Add(new Paragraph(new Run(Info._Description)));

            Page.Usage.Document.Blocks.Clear();
            Page.Usage.Document.Blocks.Add(new Paragraph(new Run(Info._UsageExample)));

            Page.Name.Text = Info._Name;
            Page.Language.Items.Clear();
            SetUI.CodeLanguageToCombobox(Page.Language);
            Page.Language.SelectedItem = DbCodeLanguage.ToString(Info._LanguageID);

            Page.ViewMode       = true;
            Page.currentsnippet = Info;
            Page.Nav            = Navbar;
        }
        //Filter all the CodeSnippeds by the asigned Values
        private void FilterCodeSnippeds()
        {
            //Give all filter values and recieve a list with Items
            List <SnippetInfo> snippets = DbSnippets.GetFilteredSnippeds(
                SearchBox_Mysnipped_txb.Text,
                MySnipped_Languages_Cmb.SelectedItem.ToString(),
                Converter.StringToDateFilter(MySnipped_Date_Cmb.SelectedItem.ToString()),
                Converter.StringToTypefilter(MySnipped_Type_Cmb.SelectedItem.ToString())
                );

            //Clear RichTextBox
            Results.Document.Blocks.Clear();


            List <SnippetUI> items = new List <SnippetUI>();

            for (int i = 0; i < snippets.Count; i++)
            {
                items.Add(new SnippetUI(snippets[i]._Name, DbCodeLanguage.ToString(snippets[i]._LanguageID)));
            }

            CodeSnippetsCintainer.ItemsSource = items;
        }