Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            //create but hide the extra windows so that their state is always persistent if opened
            //they can be toggled on by clicking their button and close will be overridden to hide and not delete
            _settingsWindow = new SettingsWindow();
            _toolsWindow    = new ToolsWindow();
            _playerWindow   = new PlayerWindow();
            _settingsWindow.Hide();
            _toolsWindow.Hide();
            _playerWindow.Hide();


            // ReSharper disable once InconsistentNaming
            bool validDB = false;

            try {
                validDB = DatabaseStorage.InitDatabase();
            }
            catch (Exception e) {
                Debug.Print(e.Message);
                Close();
            }

            var names = DatabaseStorage.GetAllShowNames();


            foreach (var name in names)
            {
                try {
                    var showCard = new ShowCard(name, this);
                    Wrapper.Children.Add(showCard);
                    showCard.Width      = 75;
                    showCard.Height     = 75;
                    showCard.Background = Brushes.Green;
                    showCard.Margin     = new Thickness(10, 10, 10, 10);
                }
                catch (Exception e) {
                    Debug.Print(e.Message);
                }
            }
        }