Ejemplo n.º 1
0
 TrainingPlanTreeItemViewModel selectProcess(TrainingPlanViewModel mainViewModel, BAGlobalObject planBase)
 {
     foreach (TrainingPlanDayViewModel node in mainViewModel.Days)
     {
         if (node.Item == planBase)
         {
             return(node);
         }
         foreach (var entryViewModel in node.Entries)
         {
             if (entryViewModel.Item == planBase)
             {
                 return(entryViewModel);
             }
             foreach (var setViewModel in entryViewModel.Sets)
             {
                 if (setViewModel.Item == planBase)
                 {
                     return(setViewModel);
                 }
             }
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
 public TrainingPlanDayViewModel(TrainingPlanViewModel parent, TrainingPlanDay day)
 {
     this.day    = day;
     this.parent = parent;
     Entries     = new ObservableCollection <TrainingPlanEntryViewModel>();
     Image       = "pack://application:,,,/BodyArchitect.Client.Module.StrengthTraining;component/Images/TrainingDay.gif";
     foreach (var entry in day.Entries)
     {
         Entries.Add(new TrainingPlanEntryViewModel(this, entry));
     }
 }
Ejemplo n.º 3
0
        public void Fill(TrainingPlanSetViewModel set, TrainingPlanViewModel viewModel)
        {
            //this.set = set;
            DataContext    = set;
            this.viewModel = viewModel;
            //if (set != null)
            //{
            //    cmbSet.SelectedIndex = (int)set.RepetitionsType;
            //    cmbDropSet.SelectedIndex = (int)set.DropSet;
            //    txtRepetitionsRange.Text = set.ToStringRepetitionsRange();

            //    if (set.Comment != null)
            //    {
            //        set.Comment = set.Comment.Replace("\n", "\r\n");
            //    }
            //    txtComment.Text = set.Comment;
            //}
        }
Ejemplo n.º 4
0
        public void Fill(TrainingPlanEntryViewModel entry, TrainingPlanViewModel viewModel)
        {
            this.entry                 = entry;
            this.viewModel             = viewModel;
            cmbExercises.SelectedIndex = -1;
            cmbExercises.ClearFilter();
            if (entry != null)
            {
                cmbExerciseDoneWay.SelectedValue = entry.Entry.DoneWay;
                cmbExercises.SelectedValue       = entry.Entry.Exercise;

                txtRestTime.Value = entry.Entry.RestSeconds;
                if (entry.Entry.Comment != null)
                {
                    entry.Entry.Comment = entry.Entry.Comment.Replace("\n", "\r\n");
                }
                txtComment.Text = entry.Entry.Comment;
            }
        }
Ejemplo n.º 5
0
        public TrainingPlanEditorWindow()
        {
            InitializeComponent();
            viewModel = new TrainingPlanViewModel();

            Binding binding = new Binding("Header");

            binding.Mode = BindingMode.OneWay;
            SetBinding(HeaderProperty, binding);

            binding      = new Binding("IsModified");
            binding.Mode = BindingMode.OneWay;
            SetBinding(IsModifiedProperty, binding);

            DataContext = viewModel;
            //usrTrainingPlanSerieEditor1.TrainingPlanSetChanged += new EventHandler<ParameterEventArgs<TrainingPlanSerie>>(usrTrainingPlanSerieEditor1_TrainingPlanSetChanged);
            this.UsrTrainingPlanEntryEditor1.TrainingPlanChanged += new System.EventHandler <ParameterEventArgs <TrainingPlanEntry> >(this.UsrTrainingPlanEntryEditor1_TrainingPlanChanged);

            updateDetailsControl();

            foreach (WorkoutPlanPurpose purpose in Enum.GetValues(typeof(WorkoutPlanPurpose)))
            {
                cmbPurpose.Items.Add(new ListItem <WorkoutPlanPurpose>(EnumLocalizer.Default.Translate(purpose), purpose));
            }

            foreach (TrainingPlanDifficult diff in Enum.GetValues(typeof(TrainingPlanDifficult)))
            {
                cmbDifficult.Items.Add(new ListItem <TrainingPlanDifficult>(EnumLocalizer.Default.Translate(diff), diff));
            }

            var types = (TrainingType[])Enum.GetValues(typeof(TrainingType));

            cmbTypes.ItemsSource = types;

            this.cmbLanguages.ItemsSource = BodyArchitect.Service.V2.Model.Language.Languages;
        }
Ejemplo n.º 6
0
 public void FillDetailsTree(TrainingPlanViewModel viewModel)
 {
     this.viewModel = viewModel;
     DataContext    = viewModel;
 }