private static void updateGui(MeasurementsControl img, WymiaryDTO wymiary) { var isEmpty = img.ReadOnly && (wymiary == null || wymiary == WymiaryDTO.Empty || wymiary.IsEmpty); img.lblEmpty.Visibility = isEmpty ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed; img.grControl.Visibility = isEmpty ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible; img.lblEmpty.Text = ApplicationStrings.MeasurementsControl_Empty; }
public void Fill(WymiaryDTO currentSizes, TrainingDaysHolder holder) { Wymiary = currentSizes; updateGui(this, currentSizes); if (currentSizes != null && holder != null /*&& !ApplicationState.IsFree*/) { ThreadPool.QueueUserWorkItem(delegate { updateChanges(currentSizes, holder); }); } }
public void Fill(WymiaryDTO wymiary) { if (wymiary != null) { txtWeight.Value = (decimal)wymiary.Weight.ToDisplayWeight(); txtRightBiceps.Value = (decimal)wymiary.RightBiceps.ToDisplayLength(); txtLeftBiceps.Value = (decimal)wymiary.LeftBiceps.ToDisplayLength(); txtKlata.Value = (decimal)wymiary.Klatka.ToDisplayLength();; txtPas.Value = (decimal)wymiary.Pas.ToDisplayLength();; txtRightLeg.Value = (decimal)wymiary.RightUdo.ToDisplayLength();; txtLeftLeg.Value = (decimal)wymiary.LeftUdo.ToDisplayLength();; txtRightForearm.Value = (decimal)wymiary.RightForearm.ToDisplayLength();; txtLeftForearm.Value = (decimal)wymiary.LeftForearm.ToDisplayLength();; txtHeight.Value = (decimal)((float)wymiary.Height).ToDisplayLength(); chkNaCzczo.Checked = wymiary.IsNaCzczo; txtTime.Time = wymiary.DateTime; } updateReadOnly(); }
public WymiaryDTO SaveWymiary(WymiaryDTO wymiary) { if (wymiary == null) { wymiary = new WymiaryDTO(); } wymiary.Weight = (float)txtWeight.Value.ToSaveWeight(); wymiary.RightBiceps = (float)txtRightBiceps.Value.ToSaveLength(); wymiary.LeftBiceps = (float)txtLeftBiceps.Value.ToSaveLength(); wymiary.Klatka = (float)txtKlata.Value.ToSaveLength(); wymiary.Pas = (float)txtPas.Value.ToSaveLength(); wymiary.RightUdo = (float)txtRightLeg.Value.ToSaveLength(); wymiary.LeftUdo = (float)txtLeftLeg.Value.ToSaveLength(); wymiary.RightForearm = (float)txtRightForearm.Value.ToSaveLength(); wymiary.LeftForearm = (float)txtLeftForearm.Value.ToSaveLength(); wymiary.Height = (int)txtHeight.Value.ToSaveLength(); wymiary.IsNaCzczo = chkNaCzczo.Checked; wymiary.DateTime = txtTime.Time; return(wymiary); }
public WymiaryDTO SaveWymiary(WymiaryDTO wymiary) { if (wymiary == null) { wymiary = new WymiaryDTO(); } wymiary.Weight = txtWeight.Value.ToSaveWeight(); wymiary.RightBiceps = txtRightBiceps.Value.ToSaveLength(); wymiary.LeftBiceps = txtLeftBiceps.Value.ToSaveLength(); wymiary.Klatka = txtKlata.Value.ToSaveLength(); wymiary.Pas = txtPas.Value.ToSaveLength(); wymiary.RightUdo = txtRightUdo.Value.ToSaveLength(); wymiary.LeftUdo = txtLeftLeg.Value.ToSaveLength(); wymiary.RightForearm = txtRightForearm.Value.ToSaveLength(); wymiary.LeftForearm = txtLeftForearm.Value.ToSaveLength(); wymiary.Height = txtHeight.Value.ToSaveLength(); wymiary.Time.DateTime = txtTime.Value.Value; wymiary.Time.TimeType = (TimeType)cmbTimeType.SelectedIndex; return(wymiary); }
public void Fill(WymiaryDTO wymiary) { isFilling = true; txtTime.Value = DateTime.Now; if (wymiary != null) { txtPas.Value = (double?)wymiary.Pas.ToDisplayLength(); txtWeight.Value = (double?)wymiary.Weight.ToDisplayWeight(); txtRightBiceps.Value = (double?)wymiary.RightBiceps.ToDisplayLength(); txtLeftBiceps.Value = (double?)wymiary.LeftBiceps.ToDisplayLength(); txtKlata.Value = (double?)wymiary.Klatka.ToDisplayLength(); txtRightUdo.Value = (double?)wymiary.RightUdo.ToDisplayLength(); txtLeftLeg.Value = (double?)wymiary.LeftUdo.ToDisplayLength(); txtRightForearm.Value = (double?)wymiary.RightForearm.ToDisplayLength(); txtLeftForearm.Value = (double?)wymiary.LeftForearm.ToDisplayLength(); txtHeight.Value = (double?)wymiary.Height.ToDisplayLength(); tbPas.Text = wymiary.Pas.ToDisplayLength().ToString("#.##"); tbWeight.Text = wymiary.Weight.ToDisplayWeight().ToString("#.##"); tbRightBiceps.Text = wymiary.RightBiceps.ToDisplayLength().ToString("#.##"); tbLeftBiceps.Text = wymiary.LeftBiceps.ToDisplayLength().ToString("#.##"); tbKlata.Text = wymiary.Klatka.ToDisplayLength().ToString("#.##"); tbRightUdo.Text = wymiary.RightUdo.ToDisplayLength().ToString("#.##"); tbLeftLeg.Text = wymiary.LeftUdo.ToDisplayLength().ToString("#.##"); tbRightForearm.Text = wymiary.RightForearm.ToDisplayLength().ToString("#.##"); tbLeftForearm.Text = wymiary.LeftForearm.ToDisplayLength().ToString("#.##"); tbHeight.Text = wymiary.Height.ToDisplayLength().ToString("#.##"); txtTime.Value = wymiary.Time.DateTime; cmbTimeType.SelectedIndex = (int)wymiary.Time.TimeType; tbTime.Text = wymiary.Time.DateTime.ToShortTimeString(); tbTimeType.Text = EnumLocalizer.Default.Translate(wymiary.Time.TimeType); } updateReadOnly(); isFilling = false; }
object getValue(PropertyInfo info, WymiaryDTO obj) { return(info.GetValue(obj, null)); }
private void updateChanges(WymiaryDTO currentSizes, TrainingDaysHolder holder) { var newWay = holder.TrainingDays.SelectMany(d => d.Value.TrainingDay.Objects.OfType <SizeEntryDTO>().Where(h => h.TrainingDay.TrainingDate < currentSizes.Time.DateTime.Date)); var res = (from i in newWay where i.Wymiary.Weight > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousWeight = res.Wymiary.Weight; } res = (from i in newWay where i.Wymiary.Height > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousHeight = res.Wymiary.Height; } res = (from i in newWay where i.Wymiary.Pas > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousPas = res.Wymiary.Pas; } res = (from i in newWay where i.Wymiary.Klatka > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousKlatka = res.Wymiary.Klatka; } res = (from i in newWay where i.Wymiary.LeftBiceps > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousLeftBiceps = res.Wymiary.LeftBiceps; } res = (from i in newWay where i.Wymiary.RightBiceps > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousRightBiceps = res.Wymiary.RightBiceps; } res = (from i in newWay where i.Wymiary.RightForearm > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousRightForearm = res.Wymiary.RightForearm; } res = (from i in newWay where i.Wymiary.LeftForearm > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousLeftForearm = res.Wymiary.LeftForearm; } res = (from i in newWay where i.Wymiary.RightUdo > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousRightUdo = res.Wymiary.RightUdo; } res = (from i in newWay where i.Wymiary.LeftUdo > 0 orderby i.TrainingDay.TrainingDate descending select i).FirstOrDefault(); if (res != null) { PreviousLeftUdo = res.Wymiary.LeftUdo; } Dispatcher.BeginInvoke(delegate { updateChanges(); }); }