Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DrinkItem"/> class.
        /// </summary>
        public DrinkItem()
        {
            InitializeComponent();
            ParentChanged += drinkItem_ParentChanged;
            Disposed      += drinkItem_Disposed;

            cmbUnit.ValueMember   = "key";
            cmbUnit.DisplayMember = "value";

            lbLiquidAmount.Text     = Localization.GetMessage("txtAmount", "Amount");
            lbVolumePercentage.Text = Localization.GetMessage("txtVolumePercentage", "Alcohol percentage (vol-%)");
            lbUnit.Text             = Localization.GetMessage("txtUnit", "Unit");
            lbCalories.Text         = Localization.GetMessage("txtKCal", "Calories (kcal)");

            foreach (var value in (UnitsEnum[])Enum.GetValues(typeof(UnitsEnum)))
            {
                cmbUnit.Items.Add(new KeyValuePair <UnitsEnum, string>(value, SiUnitsLiquid.UnitName(value, Localization)));
            }

            cmbUnit.SelectedItem = new KeyValuePair <UnitsEnum, string>(UnitsEnum.CentiLitre, SiUnitsLiquid.UnitName(UnitsEnum.CentiLitre, Localization));
        }
Ejemplo n.º 2
0
        public FormMain()
        {
            InitializeComponent();
            pnDrinkControls.Width += SystemInformation.VerticalScrollBarWidth;

            cmbAlcoholUnit.ComboBox !.ValueMember   = "key";
            cmbAlcoholUnit.ComboBox !.DisplayMember = "value";

            //Localization.OverrideLocale = "fi";

            Localization.GetLocalizedTexts(Properties.Resources.tabdeli_messages);

            LocalizeUi();

            DrinkItem.Localization = Localization;

            foreach (var value in (UnitsEnum[])Enum.GetValues(typeof(UnitsEnum)))
            {
                cmbAlcoholUnit.Items.Add(new KeyValuePair <UnitsEnum, string>(value, SiUnitsLiquid.UnitName(value, Localization)));
            }

            cmbAlcoholUnit.SelectedItem = new KeyValuePair <UnitsEnum, string>(UnitsEnum.CentiLitre, SiUnitsLiquid.UnitName(UnitsEnum.CentiLitre, Localization));
        }