public WorkloadStatistics(DatabaseOperations db)
        {
            this.db = db;

            this.performanceStatTypes = new List<string>() {
                "Weight/reps", "Reps/sets", "Weight/secs", "Secs/sets", "Weight" };
            this.performanceTypeToMethodDict = new Dictionary<string, Func<TotalWorkloadAtDate, double>>() {
                { "Weight/reps", this.GetWeightRepsRatio },{ "Reps/sets", this.GetRepsSetsRatio },
                { "Weight/secs", this.GetWeightSecsRatio },{ "Secs/sets", this.GetSecsSetsRatio },
                { "Weight", this.GetWeight }};

            DateTime firstMonth, lastMonth;
            try
            {
                firstMonth = this.db.GetFirstDayInDb();
                lastMonth = this.db.GetLastDayInDb();
            } catch (InvalidCastException)
            {
                //no dates in the db yet, so no statistics to load.
                return;
            }

            //load all the work done from the first month to the last.
            LoadData(firstMonth, lastMonth);
        }
        public CalenderCellControl(DatabaseOperations db)
        {
            InitializeComponent();
            this.db = db;

            this.Dock = DockStyle.Fill;
            
        }
 public CalenderControl(DatabaseOperations db)
 {
     this.db = db;
     this.selectedMonth = DateTime.Now;
     InitializeComponent();
     
     InitializeCalender();
 }
Example #4
0
        public WorkoutControl(DatabaseOperations db, DateTime date)
        {
            InitializeComponent();

            this.db = db;
            this.date = date;

            DisplayWorkout();
        }
        public WorkoutSelectorForm(DatabaseOperations db, Action<DateTime> openWorkoutCallback, 
            Action<string, DateTime> updateCalenderCallback, DateTime date)
        {
            InitializeComponent();

            this.db = db;
            this.openWorkoutCallback = openWorkoutCallback;
            this.updateCalenderCallback = updateCalenderCallback;
            this.date = date;

            UpdateExistingWorkouts();
        }
Example #6
0
        public SetRowControl(DatabaseOperations db, int setSeqNum, Workload workload, 
            int activityId, DateTime date)
        {
            InitializeComponent();

            this.db = db;
            this.exerciseNameLbl.Text = "Set " + (setSeqNum + 1).ToString();

            foreach (string unit in workload.format)
            {
                AddUnitToControl(new WorkloadInputMetadata(unit, activityId, setSeqNum, date), 
                    workload.GetUnitValue(unit), this.workloadFlp);
            }

        }
        /* Drag/drop related variables end */

        
        public WorkoutCreatorForm(DatabaseOperations db)
        {
            InitializeComponent();

            this.exstExercisesListBox.MouseDown += new MouseEventHandler(exstExercisesListBox_MouseDown);
            this.exstExercisesListBox.DragEnter += new DragEventHandler(ExerciseList_DragEnter);

            this.dropAreaFlp.DragEnter += new DragEventHandler(DropField_DragEnter);
            this.dropAreaFlp.DragDrop += new DragEventHandler(DropField_DragDrop);
            this.dropAreaFlp.DragOver += new DragEventHandler(DropField_DragOver);

            //create the bar and info label. 
            //note that resizing not is supported (and it is also disabled in the form itself).
            this.bar = new Label
            {
                BorderStyle = BorderStyle.Fixed3D,
                Text = "",
                AutoSize = false,
                Height = 2,
                Width = this.dropAreaFlp.Width,
                Margin = new Padding(0),
                Padding = new Padding(0),
            };
            this.dropAreaInfoLbl = new Label
            {
                Text = "Drop exercises here",
                AutoSize = false,
                Margin = new Padding(0),
                Padding = new Padding(0),
                Height = this.dropAreaFlp.Height,
                Width = this.dropAreaFlp.Width,
                Font = new Font(Font, FontStyle.Italic),
                TextAlign = ContentAlignment.MiddleCenter
            };
            this.dropAreaFlp.Controls.Add(dropAreaInfoLbl);
            
            this.db = db;

            this.selectedExercises = new List<Exercise>();
            UpdateExerciseList();
            UpdateExistingWorkoutsList();
            InitExerciseContextMenuStrip();

        }
Example #8
0
        public MainForm()
        {
            InitializeComponent();

            this.FormClosed += MainForm_FormClosed;

            //sqlite only accepts '.' as decimal separator. make sure double/float/decimal 
            //to string conversions do too.
            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)
                System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";
            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            this.db = new DatabaseOperations();

            //set up the calender and the progress chart.
            CreateCalenderControl();
            CreateProgressChartControl();
        }
 /* Constructor. If exerciseListUpdateMethod is specified, it will be called 
  * when a new exercise is created. If a prefillExercise is passed, the form will 
  * be filled out using it.
  */
 public ExerciseCreatorForm(DatabaseOperations db, Action exerciseListUpdateMethod = null)
 {
     InitializeComponent();
     this.db = db;
     this.updateMethod = exerciseListUpdateMethod;
 }