Пример #1
0
        public static Workout FromTemplate(WorkoutTemplate workoutTemplate)
        {
            Workout workout = new Workout()
            {
                Title = workoutTemplate.Title,
                WorkoutTemplatePath = workoutTemplate.WorkoutTemplatePath,
                MinLength = workoutTemplate.MinLength,
                MaxLength = workoutTemplate.MaxLength,
                Template = workoutTemplate
            };

            foreach (WorkoutTemplatePart part in workoutTemplate.WorkoutTemplateParts)
            {
                workout.WorkoutParts.Add(new WorkoutPart()
                {
                    Title = part.Title,
                    Template = part,
                    MinLength = part.MinLength,
                    MaxLength = part.MaxLength
                });
            }

            return workout;
        }
Пример #2
0
        private void openButton_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Filter = "Workout|*.wko|All files|*.*";
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    workout = Workout.Workout.LoadWorkout(dialog.FileName);

                    RefreshWorkout();
                }
            }
        }
Пример #3
0
        public void LoadPlacement(WorkoutCreator.Workout.Workout workout)
        {
            this.workout = workout;

            workoutPartComboBox.Items.Clear();
            workoutPartComboBox.DisplayMember = "Title";
            workoutPartComboBox.ValueMember = "Title";

            fromToComboBox.Items.Clear();

            fromToComboBox.DisplayMember = "Title";
            fromToComboBox.ValueMember = "PlacementValue";

            //fromToComboBox.Items.Add(new SongPlacement() { PlacementValue = 0, Title = "Flytta inte" });
            fromToComboBox.Items.Add(new SongPlacement() { PlacementValue = 1, Title = "Före vald låt" });
            fromToComboBox.Items.Add(new SongPlacement() { PlacementValue = 2, Title = "Efter vald låt" });
            fromToComboBox.SelectedIndex = 0;

            foreach (Workout.WorkoutPart part in workout.WorkoutParts)
            {
                workoutPartComboBox.Items.Add(part);

                Workout.WorkoutSong song = part.Songs.FirstOrDefault(x =>
                    x.Album == albumTextBox.Text &&
                    x.Artist == artistTextBox.Text &&
                    x.Bpm1 == bpm1TextBox.Text.ToInt() &&
                    x.Bpm2 == bpm2TextBox.Text.ToInt() &&
                    x.Description == descriptionTextBox.Text &&
                    x.FromTime == fromTimeTextBox.TotalSeconds &&
                    x.ToTime == toTimeTextBox.TotalSeconds &&
                    x.Title == titleTextBox.Text);

                if (song != null)
                {
                    currentSong = song;
                    currentPart = part;
                    workoutPartComboBox.SelectedItem = part;
                }
            }
        }
Пример #4
0
        private void newButton_Click(object sender, EventArgs e)
        {
            using (NewWorkoutForm form = new NewWorkoutForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    template = form.Template;

                    workout = Workout.Workout.FromTemplate(template);

                    RefreshWorkout();
                }
            }
        }