Пример #1
0
        private void MakeLight(object sender, RoutedEventArgs e)
        {
            var theme = new PaletteHelper().GetTheme();

            theme.SetBaseTheme(Theme.Light);
            new PaletteHelper().SetTheme(theme);
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();
            ITheme theme = new PaletteHelper().GetTheme();

            theme.SetBaseTheme(Theme.Dark);

            theme.SetPrimaryColor(Color.FromRgb(255, 65, 81));

            theme.SetSecondaryColor(Color.FromRgb(253, 71, 78));


            theme.PrimaryMid = new ColorPair(Color.FromRgb(253, 71, 78), Colors.White);

            new PaletteHelper().SetTheme(theme);
            DBConnection db = DBConnection.Instance();

            if (db.IsConnect())
            {
                try
                {
                    connection = db.Connection;

                    command             = connection.CreateCommand();
                    command.CommandText = "SELECT * FROM color";
                    command.ExecuteNonQuery();
                    dr = command.ExecuteReader();
                    Dictionary <int, string> coloritems = new Dictionary <int, string>();
                    while (dr.Read())
                    {
                        bolcherColor.Items.Add(new Item(dr.GetString("name_color"), dr.GetInt32("id_color")));
                    }

                    dr.Close();

                    command.CommandText = "SELECT * FROM taste_type";
                    command.ExecuteNonQuery();
                    dr = command.ExecuteReader();
                    while (dr.Read())
                    {
                        bolchertype.Items.Add(new Item(dr.GetString("taste_type"), dr.GetInt32("id_taste_type")));
                    }

                    dr.Close();
                    command.CommandText = "SELECT * FROM taste_sourness";
                    command.ExecuteNonQuery();
                    dr = command.ExecuteReader();
                    while (dr.Read())
                    {
                        bolchersourness.Items.Add(new Item(dr.GetString("taste_sourness"),
                                                           dr.GetInt32("id_taste_sourness")));
                    }

                    dr.Close();
                    command.CommandText = "SELECT * FROM taste_strength";
                    command.ExecuteNonQuery();
                    dr = command.ExecuteReader();
                    while (dr.Read())
                    {
                        bolcherstrenth.Items.Add(new Item(dr.GetString("taste_strength"),
                                                          dr.GetInt32("id_taste_strength")));
                    }

                    dr.Close();
                }
                catch (Exception e)
                {
                    string           messageBoxText = e.Message;
                    string           caption        = "Birgers Bolcher";
                    MessageBoxButton button         = MessageBoxButton.OK;
                    MessageBoxImage  icon           = MessageBoxImage.Error;
                    MessageBox.Show(messageBoxText, caption, button, icon);
                }
            }
            else
            {
                string           messageBoxText = "Cannot connect to database, please contact application support";
                string           caption        = "Birgers Bolcher";
                MessageBoxButton button         = MessageBoxButton.OK;
                MessageBoxImage  icon           = MessageBoxImage.Error;
                MessageBox.Show(messageBoxText, caption, button, icon);
            }
        }