public MainWindow() { this.Hide(); InitializeComponent(); if (!Config.Init()) { _cfgWin = new ConfigWindow(); } else { try { this.dBDisplay = new DBDisplay(this); this.DBDisplay.Navigate(this.dBDisplay); Thread.Sleep(250); this.RightFrame.Navigate(new PlayerWindow()); Thread.Sleep(250); this.CatFrame.Navigate(new CatSearch(this.dBDisplay)); Thread.Sleep(250); this.playlistShow = new PlaylistShow(); this.Calendar.Navigate(new CalendarPage(this.playlistShow, this)); Thread.Sleep(250); this.Playlist.Navigate(this.playlistShow); } catch (Exception ex) { Debug.WriteLine(ex.Message); Console.WriteLine(ex.Message); } } this.Show(); }
public CatTab(String header, List <object[]> cat, DBDisplay dBDisplay) { this.dBDisplay = dBDisplay; base.Header = header; ScrollViewer scroll = new ScrollViewer(); scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; WrapPanel grid = new WrapPanel(); grid.Orientation = Orientation.Vertical; grid.Background = Brushes.LightGray; grid.MaxHeight = 145; scroll.Content = grid; foreach (var item in cat) { Rectangle rect = new Rectangle(); TextBlock catObj = new TextBlock(); catObj.Text = (String)item[0]; catObj.Name = "Cat" + item[1].ToString(); catObj.MouseLeftButtonUp += Cat_Click; catObj.FontSize = 12; catObj.Background = Brushes.WhiteSmoke; catObj.Margin = new Thickness(2, 2, 2, 2); catObj.Padding = new Thickness(5, 5, 5, 5); grid.Children.Add(catObj); } this.Content = scroll; }
public CatSearch(DBDisplay dBDisplay) { InitializeComponent(); DBHelper.connect(); foreach (var item in DBHelper.getCatGroup()) { List <object[]> cats = DBHelper.getCategories(item.Key); this.CatTab.Items.Add(new CatTab(item.Value, cats, dBDisplay)); } DBHelper.disconnect(); }