예제 #1
0
        SnippetsDataSet.SnippetsTableDataTable SnippTable; // the current snippet database, before importing anything

        public SnippetImporter(SnippetsDataSet.SnippetsTableDataTable st)
        {
            snippetList = new ObservableCollection<CodeSnippet>();
            InitializeComponent();
            DataContext = this;
            SnippTable = st;
        }
예제 #2
0
        public void Reload()
        {
            string cSnippetsFile = Path.Combine(Helper.GetSettingsPath(), Consts.cSnippetsFile);

            if (File.Exists(cSnippetsFile))
            {
                snippetsDataSet.Clear();
                snippetsDataSet.ReadXml(cSnippetsFile);
                snippetsTable = snippetsDataSet.SnippetsTable;

                TheView.Refresh();


                //snippetsTableViewSource.SortDescriptions.Clear();
                //snippetsTableViewSource.SortDescriptions.Add(new System.ComponentModel.SortDescription("Category", System.ComponentModel.ListSortDirection.Ascending));
                //snippetsTableViewSource.SortDescriptions.Add(new System.ComponentModel.SortDescription("Name", System.ComponentModel.ListSortDirection.Ascending));
                //lstSnippets.ItemsSource = from rows in snippetsTable
                //                          orderby rows.Name
                //                          group rows by rows.Category into g
                //                          select g;
                //group rows by rows.Category into g
                //orderby g.Key
                //select g;
            }
        }
예제 #3
0
        SnippetsDataSet.SnippetsTableDataTable SnippTable; // the current snippet database, before importing anything

        public SnippetImporter(SnippetsDataSet.SnippetsTableDataTable st)
        {
            snippetList = new ObservableCollection <CodeSnippet>();
            InitializeComponent();
            DataContext = this;
            SnippTable  = st;
        }
예제 #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            /*      if (!File.Exists(Helper.GetSettingsPath() + Consts.cSyntaxFile))
             *    {
             *        MessageBox.Show("Syntax definitions not found");
             *    }
             *    else
             *    {
             *        XmlReader r = new XmlTextReader(Helper.GetSettingsPath() + Consts.cSyntaxFile);
             *        txtSnippetCode.SyntaxHighlighting = HighlightingLoader.Load(r, null);  //HighlightingManager.Instance..GetDefinition("C#");
             *        txtSampleCode.SyntaxHighlighting = txtSnippetCode.SyntaxHighlighting;  //HighlightingManager.Instance..GetDefinition("C#");
             *        r.Close();
             *    }*/

            snippetsDataSet         = ((SnippetsDataSet)(this.FindResource("snippetsDataSet")));
            snippetsTable           = snippetsDataSet.Tables["SnippetsTable"] as SnippetsDataSet.SnippetsTableDataTable;
            snippetsTableViewSource = (CollectionViewSource)this.FindResource("snippetsTableViewSource");
            if (File.Exists(Helper.GetSettingsPath() + Consts.cSnippetsFile))
            {
                snippetsDataSet.ReadXml(Helper.GetSettingsPath() + Consts.cSnippetsFile);         // TODO: Program stops here...very strange ... due to images???
                snippetsTableViewSource.View.Refresh();
            }
        }
예제 #5
0
        public void Reload()
        {
			string cSnippetsFile = Path.Combine(Helper.GetSettingsPath(), Consts.cSnippetsFile);
            if (File.Exists( cSnippetsFile ))
            {
                snippetsDataSet.Clear();
                snippetsDataSet.ReadXml(cSnippetsFile);
                snippetsTable = snippetsDataSet.SnippetsTable;

                TheView.Refresh();


                //snippetsTableViewSource.SortDescriptions.Clear();
                //snippetsTableViewSource.SortDescriptions.Add(new System.ComponentModel.SortDescription("Category", System.ComponentModel.ListSortDirection.Ascending));
                //snippetsTableViewSource.SortDescriptions.Add(new System.ComponentModel.SortDescription("Name", System.ComponentModel.ListSortDirection.Ascending));
                //lstSnippets.ItemsSource = from rows in snippetsTable
                //                          orderby rows.Name
                //                          group rows by rows.Category into g
                //                          select g;
                //group rows by rows.Category into g
                //orderby g.Key
                //select g;
            }
        }