// event handlers
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // make sure name and unit are not empty string
            if (string.IsNullOrWhiteSpace(TextBoxName.Text))
            {
                FlyoutWarmingText.Text = "Name cannot be empty!";
                FlyoutWarming.ShowAt(TextBoxName);
                args.Cancel = true;
                return;
            }
            if (ComboBoxCategory.SelectedIndex == -1)
            {
                FlyoutWarmingText.Text = "Category cannot be empty!";
                FlyoutWarming.ShowAt(ComboBoxCategory);
                args.Cancel = true;
                return;
            }
            if (ComboBoxUnit.SelectedIndex == -1)
            {
                FlyoutWarmingText.Text = "Unit cannot be empty!";
                FlyoutWarming.ShowAt(ComboBoxUnit);
                args.Cancel = true;
                return;
            }

            // perform real update
            TextBoxName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            ComboBoxCategory.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateSource();
            ComboBoxUnit.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateSource();
            ImageThumbnail.GetBindingExpression(Image.SourceProperty).UpdateSource();
            this.ingredient.ThumbnailFilename = this.thumbnailFilename;
        }
示例#2
0
 private void ClearControls()
 {
     TextBoxCode.Clear();
     TextBoxName.Clear();
     TextBoxCost.Clear();
     ComboBoxCategory.ResetText();
 }
示例#3
0
        private void DgvMenuItems_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 0)
                {
                    MenuItemsIdforUpdate = Convert.ToInt32(DgvMenuItems.Rows[e.RowIndex].Cells[2].Value);
                    TxtItemName.Text     = DgvMenuItems.Rows[e.RowIndex].Cells[5].Value.ToString();
                    TxtRate.Text         = (DgvMenuItems.Rows[e.RowIndex].Cells[7].Value.ToString());
                    TxtDiscount.Text     = (DgvMenuItems.Rows[e.RowIndex].Cells[8].Value.ToString());
                    TxtBarCode.Text      = (DgvMenuItems.Rows[e.RowIndex].Cells[11].Value.ToString());
                    if (Convert.ToInt32(DgvMenuItems.Rows[e.RowIndex].Cells[9].Value) == 1)
                    {
                        CheckBoxStatus.Checked = true;
                    }
                    else
                    {
                        CheckBoxStatus.Checked = false;
                    }

                    List <menuCategory> L1 = new List <menuCategory>();
                    L1 = objMenuItemsService.Get_CategoryName(Convert.ToInt32(DgvMenuItems.Rows[e.RowIndex].Cells[3].Value));
                    ComboBoxCategory.SelectedIndex = ComboBoxCategory.FindString(L1[0].name);

                    List <section> L2 = new List <section>();
                    L2 = objMenuItemsService.Get_SectionyName(Convert.ToInt32(DgvMenuItems.Rows[e.RowIndex].Cells[6].Value));
                    ComboBoxSection.SelectedIndex = ComboBoxSection.FindString(L2[0].sectionname);

                    TxtColorPickerMenuItem.BackColor = System.Drawing.ColorTranslator.FromHtml(DgvMenuItems.Rows[e.RowIndex].Cells[4].Value.ToString());
                    colorHexValMenuItem = HexConverter(ColorDialogMenuItem.Color);
                    BtnSaveLbl.Text     = "Update";
                    brcode.Text         = DgvMenuItems.Rows[e.RowIndex].Cells[11].Value.ToString();
                    bc = DgvMenuItems.Rows[e.RowIndex].Cells[11].Value.ToString();
                }
                else if (e.ColumnIndex == 1)
                {
                    DeleteDialogBox obj = new DeleteDialogBox();
                    obj.ShowDialog();
                    if (DeleteDialogBox.delete == 1)
                    {
                        if (objMenuItemsService.Delete_MenuItems_tables(Convert.ToInt32(DgvMenuItems.Rows[e.RowIndex].Cells[2].Value)))
                        {
                            MessageBox.Show("Deleted Successfully.!");
                            LoadAllTables();
                            ClearAll();
                        }
                        else
                        {
                            MessageBox.Show("Deleted failed");
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "Exception Error");
            }
        }
        private void ButtonAddExpense_Click(object sender, RoutedEventArgs e)
        {
            var messageQueue = SnackbarThree.MessageQueue;

            if (TextBoxValue.Text == string.Empty)
            {
                TextBoxValue.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe o valor da saída"));
                return;
            }

            if (DatePickerData.Text == string.Empty)
            {
                DatePickerData.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe a data saída"));
                return;
            }

            if (ComboBoxCategory.Text == string.Empty)
            {
                ComboBoxCategory.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe a categoria da saída"));
                return;
            }

            if (ComboBoxAccounts.Text == string.Empty)
            {
                ComboBoxAccounts.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe a conta da saída"));
                return;
            }

            Double   value    = Double.Parse(TextBoxValue.Text, NumberStyles.Currency);
            DateTime date     = DatePickerData.SelectedDate ?? DateTime.Now;
            var      account  = ComboBoxAccounts.SelectedItem;
            var      goal     = ComboBoxGoals.SelectedItem;
            var      category = ComboBoxCategory.SelectedItem;

            if (goal != null)
            {
                control.DebitGoal(goal, value);
            }

            control.SaveExpense(value, date, account, category);
            LoadExpenses();

            TextBoxValue.Text = string.Empty;
            ComboBoxAccounts.SelectedIndex = -1;
            DatePickerData.Text            = string.Empty;
            ComboBoxGoals.SelectedIndex    = -1;
            ComboBoxCategory.SelectedIndex = -1;
        }
示例#5
0
        private void ComboBoxCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ComboBoxCategory.SelectedIndex != -1)
            {
                TextBoxSelectedCategory.Text = ComboBoxCategory.GetItemText(ComboBoxCategory.SelectedItem);
            }

            if (ComboBoxCategory.SelectedIndex == 0)
            {
                LoadGameMods(SelectedGame.Id);
            }
            else
            {
                LoadGameMods(SelectedGame.Id, ComboBoxCategory.GetItemText(ComboBoxCategory.SelectedItem));
            }
        }
        private void ButtonAddIncoming_Click(object sender, RoutedEventArgs e)
        {
            var messageQueue = SnackbarThree.MessageQueue;

            if (TextBoxValue.Text == string.Empty)
            {
                TextBoxValue.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Saisir la valeur de l'entrée"));
                return;
            }

            if (DatePickerData.Text == string.Empty)
            {
                DatePickerData.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Saisir la date d'entrée"));
                return;
            }

            if (ComboBoxCategory.Text == string.Empty)
            {
                ComboBoxCategory.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Entrez la catégorie d'entrée"));
                return;
            }

            if (ComboBoxAccounts.Text == string.Empty)
            {
                ComboBoxAccounts.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Saisissez la facture d'entrée"));
                return;
            }

            Double   value    = Double.Parse(TextBoxValue.Text, NumberStyles.Currency);
            DateTime date     = DatePickerData.SelectedDate ?? DateTime.Now;
            var      account  = ComboBoxAccounts.SelectedItem;
            var      category = ComboBoxCategory.SelectedItem;

            control.SaveIncoming(value, date, account, category);
            LoadIncomings();

            TextBoxValue.Text = string.Empty;
            ComboBoxAccounts.SelectedIndex = -1;
            DatePickerData.Text            = string.Empty;
            ComboBoxCategory.SelectedIndex = -1;
        }
        public void InterpolateBetween(ComboBoxCategory firstState, ComboBoxCategory secondState, float interpolationValue)
        {
                #if DEBUG
            if (float.IsNaN(interpolationValue))
            {
                throw new System.Exception("interpolationValue cannot be NaN");
            }
                #endif
            switch (firstState)
            {
            case  ComboBoxCategory.Enabled:
                break;

            case  ComboBoxCategory.Disabled:
                break;

            case  ComboBoxCategory.Highlighted:
                break;

            case  ComboBoxCategory.Pushed:
                break;
            }
            switch (secondState)
            {
            case  ComboBoxCategory.Enabled:
                break;

            case  ComboBoxCategory.Disabled:
                break;

            case  ComboBoxCategory.Highlighted:
                break;

            case  ComboBoxCategory.Pushed:
                break;
            }
            if (interpolationValue < 1)
            {
                mCurrentComboBoxCategoryState = firstState;
            }
            else
            {
                mCurrentComboBoxCategoryState = secondState;
            }
        }
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(ComboBoxCategory state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  ComboBoxCategory.Enabled:
                break;

            case  ComboBoxCategory.Disabled:
                break;

            case  ComboBoxCategory.Highlighted:
                break;

            case  ComboBoxCategory.Pushed:
                break;
            }
            return(newState);
        }
 public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateToRelative(ComboBoxCategory toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing, object owner = null)
 {
     Gum.DataTypes.Variables.StateSave           current       = GetCurrentValuesOnState(toState);
     Gum.DataTypes.Variables.StateSave           toAsStateSave = AddToCurrentValuesWithState(toState);
     FlatRedBall.Glue.StateInterpolation.Tweener tweener       = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing);
     if (owner == null)
     {
         tweener.Owner = this;
     }
     else
     {
         tweener.Owner = owner;
     }
     tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition);
     tweener.Ended          += () => this.CurrentComboBoxCategoryState = toState;
     tweener.Start();
     StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
     return(tweener);
 }
示例#10
0
            public SquadronUI(int baseAirCorpsID, int squadronID, DialogBaseAirCorpsSimulation parent)
            {
                BaseAirCorpsID = baseAirCorpsID;
                SquadronID     = squadronID;

                AircraftCategory               = new ComboBox();
                AircraftCategory.Size          = new Size(160, AircraftCategory.Height);
                AircraftCategory.Anchor        = AnchorStyles.None;
                AircraftCategory.Margin        = new Padding(2, 0, 2, 0);
                AircraftCategory.DropDownStyle = ComboBoxStyle.DropDownList;
                AircraftCategory.Items.AddRange(ComboBoxCategory.GetAllCategories().ToArray());
                AircraftCategory.SelectedValueChanged += AircraftCategory_SelectedValueChanged;

                Aircraft                       = new ComboBox();
                Aircraft.Size                  = new Size(240, Aircraft.Height);
                Aircraft.Anchor                = AnchorStyles.None;
                Aircraft.Margin                = new Padding(2, 0, 2, 0);
                Aircraft.DropDownStyle         = ComboBoxStyle.DropDownList;
                Aircraft.SelectedValueChanged += Aircraft_SelectedValueChanged;

                AircraftCount               = new NumericUpDown();
                AircraftCount.Size          = new Size(60, AircraftCount.Height);
                AircraftCount.Anchor        = AnchorStyles.None;
                AircraftCount.Maximum       = AircraftCount.Minimum = 0;
                AircraftCount.TextAlign     = HorizontalAlignment.Right;
                AircraftCount.Margin        = new Padding(2, 0, 2, 0);
                AircraftCount.ValueChanged += AircraftCount_ValueChanged;

                AirSuperioritySortie     = NewLabel();
                AirSuperiorityAirDefense = NewLabel();
                Distance         = NewLabel();
                Bomber           = NewLabel();
                Torpedo          = NewLabel();
                OrganizationCost = NewLabel();

                Parent          = parent;
                ToolTipInternal = parent.ToolTipInfo;

                Update();
            }
示例#11
0
文件: ProductSave.cs 项目: psnwd/shop
        private void FormProductAdd_Load(object sender, EventArgs e)
        {
            Categories = DAO.Categories.List();
            ComboBoxCategory.Items.AddRange(Categories.Select(Category => Category.Name).ToArray());

            if (Product == null)
            {
                Product = new Product();
                ProductPanelPreview.Product = Product;
            }
            else
            {
                ProductPanelPreview.Product = Product;

                TextBoxName.Text                 = Product.Name;
                TextBoxDescription.Text          = Product.Description;
                NumericQuantity.Value            = Product.Quantity;
                NumericValue.Value               = Convert.ToDecimal(Product.Value);
                NumericPromotionPercentage.Value = Product.PromotionPercentage;
                CheckBoxPromotion.Checked        = Product.Promotion;
                ComboBoxCategory.SelectedIndex   = ComboBoxCategory.FindStringExact(Product.Category.Name);
            }
        }
示例#12
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtBname.Text == "")
     {
         MessageBox.Show("Please enter Brand Name");
         txtBname.Focus();
         return;
     }
     if (ComboBoxCategory.SelectedIndex == -1)
     {
         MessageBox.Show("Please Select Category Name");
         ComboBoxCategory.Focus();
         return;
     }
     try
     {
         string s = "";
         if (TxtBID.Text == "0")
         {
             s = "insert into brand(bname,cid)values('" + txtBname.Text + "','" + ComboBoxCategory.SelectedValue.ToString() + "')";
         }
         else
         {
             s = "update brand set bname='" + txtBname.Text + "',cid='" + ComboBoxCategory.SelectedValue.ToString() + "' where bid='" + TxtBID.Text + "'";
         }
         o.con.Open();
         SqlCommand cmd = new SqlCommand(s, o.con);
         cmd.ExecuteNonQuery();
         btnClear_Click(sender, e);
         loadgrid();
         o.con.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }