//add reset button
 private void Reset_Click(object sender, EventArgs e)
 {
     textBox1.Clear();
     WeightBox.Clear();
     HeightBox.Clear();
     TextResult.Clear();
 }
示例#2
0
        private void WeightDataMouseDown(object sender, MouseEventArgs e)
        {
            enterDatatoBox = WeightBox;
            WeightBox.Clear();

            outputString = "";
        }
示例#3
0
 private void ClearButton()
 {
     WeightBox.Clear();
     HeightBox.Clear();
     ResultBox.Clear();
     outputString  = "0";
     heightValue   = 0.0f;
     weightValue   = 0.0f;
     decimalExists = false;
 }
示例#4
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            ItemsList.RemoveAt(ItemsListBox.SelectedIndex);
            ListBind.DataSource = null;
            ListBind.DataSource = ItemsList;

            NameBox.Clear();
            TypeBox.Clear();
            DescriptionBox.Clear();
            MightBox.Clear();
            DefenceBox.Clear();
            WeightBox.Clear();
            ItemWeightBox.Clear();
            PropertiesBox.Clear();

            foreach (int i in RequirementsCheckedListBox.CheckedIndices)
            {
                RequirementsCheckedListBox.SetItemChecked(i, false);
            }
        }
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     user1.UserSex              = SexBox.Text;
     user1.UserAge              = Int32.Parse(AgeBox.Text);
     user1.UserWeight           = float.Parse(WeightBox.Text);
     user1.UserHeight           = float.Parse(HeightBox.Text);
     user1.UserType             = TypeBox.Text;
     user1.UserdailyActivity    = AcitvityBox.Text;
     user1.UserTSWeekly         = Int32.Parse(SDays.Text);
     user1.UserTSDaily          = Int32.Parse(SMinutes.Text);
     user1.UserTSIntensivity    = SIntensivity.Text;
     user1.UserTAWeekly         = Int32.Parse(ADays.Text);
     user1.UserTADaily          = Int32.Parse(AMinutes.Text);
     user1.UserTAIntensivity    = AIntensivity.Text;
     user1.UserFoodRestrictions = Diary.IsChecked.ToString() + "," + Gluten.IsChecked.ToString() + "," + Meat.IsChecked.ToString();
     user1.UserMealNumber       = Int32.Parse(MealNumber.Text);
     DataBaseSolution.UpdateUserData(user1);
     SexBox.ClearValue(NameProperty);
     AgeBox.Clear();
     WeightBox.Clear();
     HeightBox.Clear();
     TypeBox.ClearValue(NameProperty);
     AActivityBox.ClearValue(NameProperty);
     AcitvityBox.ClearValue(NameProperty);
     SDays.Clear();
     SMinutes.Clear();
     SIntensivity.ClearValue(NameProperty);
     ADays.Clear();
     AMinutes.Clear();
     AIntensivity.ClearValue(NameProperty);
     Diary.IsChecked  = false;
     Gluten.IsChecked = false;
     Meat.IsChecked   = false;
     MealNumber.ClearValue(NameProperty);
     MessageBox.Show("Dane użytkownika zostały zaktualizowane");
 }
 /// <summary>
 /// This is event handler to reset the form
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Resetbutton_Click(object sender, EventArgs e)
 {
     HeightBox.Clear();
     WeightBox.Clear();
     ResulttextBox.Text = "";
 }
示例#7
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            string        name, type, description;
            int           weight, might, defence, carryweight;
            List <string> requirements = new List <string>();
            List <string> properties;
            List <Tuple <string, int> > bonus = new List <Tuple <string, int> >();

            if (NameBox.Text == "")
            {
                MessageBox.Show("Puste pole na imię!");
                return;
            }
            else
            {
                name = NameBox.Text;
            }

            if (TypeBox.Text == "")
            {
                MessageBox.Show("Puste pole określające typ przedmiotu!");
                return;
            }
            else
            {
                type = TypeBox.Text;
            }

            if (DescriptionBox.Text == "")
            {
                MessageBox.Show("Puste pole opisu!");
                return;
            }
            else
            {
                description = DescriptionBox.Text;
            }

            int.TryParse(ItemWeightBox.Text, out weight);
            if (weight == 0)
            {
                MessageBox.Show("Błąd w polu określającym wagę przedmiotu!");
                return;
            }

            bool might_result       = int.TryParse(MightBox.Text, out might);
            bool defence_result     = int.TryParse(DefenceBox.Text, out defence);
            bool carryweight_result = int.TryParse(WeightBox.Text, out carryweight);

            if (!might_result || !defence_result || !carryweight_result)
            {
                MessageBox.Show("Błąd w polach określających bonusy!");
                return;
            }
            else
            {
                Tuple <string, int> MightTuple       = new Tuple <string, int>("Might", might);
                Tuple <string, int> DefenceTuple     = new Tuple <string, int>("Defence", defence);
                Tuple <string, int> CarryWeightTuple = new Tuple <string, int>("CarryWeight", carryweight);
                bonus.Add(MightTuple);
                bonus.Add(DefenceTuple);
                bonus.Add(CarryWeightTuple);
            }

            if (RequirementsCheckedListBox.CheckedItems.Count == 0)
            {
                requirements.Add("Any");
            }
            else
            {
                foreach (object item in RequirementsCheckedListBox.CheckedItems)
                {
                    requirements.Add(item.ToString());
                }
            }

            properties = new List <string>(PropertiesBox.Lines);

            Item New_Item = new Item(name, type, description, requirements, bonus, properties, weight);

            ItemsList.Add(New_Item);
            ListBind.DataSource = null;
            ListBind.DataSource = ItemsList;

            NameBox.Clear();
            TypeBox.Clear();
            DescriptionBox.Clear();
            MightBox.Clear();
            DefenceBox.Clear();
            WeightBox.Clear();
            ItemWeightBox.Clear();
            PropertiesBox.Clear();

            foreach (int i in RequirementsCheckedListBox.CheckedIndices)
            {
                RequirementsCheckedListBox.SetItemChecked(i, false);
            }
        }