public void displaySessionDetails(Session s)
        {
            DScsv file = new DScsv();
            List<string[]> data = file.getData(s.GetDataFilePath());
            int max = 0;
            int current = 0;
            for(int i = 0; i < data.Count; i++)
            {
                current = 0;
                for(int j = 0; j < data[i].Length; j++)
                {
                    current++;
                }
                if (current > max)
                    max = current;
            }

            DataTable dt = new DataTable("Session");
            //name columns
            for (int i = 0; i < max; i++)
            {
                dt.Columns.Add((i+1).ToString());
            }
            //add rows
            for(int i = 0; i < data.Count; i++)
            {
                dt.Rows.Add(data[i]);
            }            
            DataView dv = new DataView(dt);
            dataGridView1.DataSource = dv;
        }
Exemple #2
0
 public virtual void Initialize(
     GraphicsDeviceManager g, ContentManager c, SpriteBatch sb,
     int screenHeight, int screenWidth,
     Session s, Vector3 position)
 {
     conditionMet = false;
     endCondition.isNewExecution = true;
     Position = position;
     output = s.GetCSV();
     output.startTask(this);
 }
 public FormSessionDetail(Session s)
 {
     InitializeComponent();
     try
     {
         displaySessionDetails(s);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Load error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #4
0
        public override void Initialize(
            GraphicsDeviceManager g, ContentManager c, SpriteBatch sb,
            int screenHeight, int screenWidth, Session s, Vector3 position)
        {
            base.Initialize(g, c, sb, screenHeight, screenWidth, s, position);
            primaryInput.Initialize(Position);
            foreach (InputDevice id in additionalInput)
            {
                id.Initialize(Position);
            }

            if (region.Shape == ShapeType.Hoop)
            {
                cursor = new Basketball(g, c, Position, Vector3.One, Color.Red);
            }
            else
            {
                cursor = new Ellipsoid(g, c, Position, Vector3.One, Color.Red);
            }

            cursor.Scale = new Vector3(0.02f, 0.02f, 0.02f);

            primaryInput.writeFields(output);
            primaryInput.Handling = inputHandling;
            foreach (InputDevice ID in additionalInput)
            {
                ID.writeFields(output);
                ID.Handling = inputHandling;
            }

            taskData = new TaskData();
            taskData.TaskName = this.Name;
            taskData.Metrics.primary = (int)performanceMetric;
            s.TaskDatas.Add(taskData);

            if ((endCondition.GetType() == typeof(TimeLimitEndCondition) &&  ((TimeLimitEndCondition)endCondition).Type == TimeLimitType.TimeInRegion) ||
                (endCondition.GetType() == typeof(TimeLimitEndCondition) && ((TimeLimitEndCondition)endCondition).Type == TimeLimitType.TimeOutRegion))
                output.addField("IsInRegion");
            output.addField("RegionX1");
            output.addField("RegionX2");
            output.addField("RegionY1");
            output.addField("RegionY2");
            output.addField("RegionZ1");
            output.addField("RegionZ2");

            output.writeHeader();
        }
Exemple #5
0
 public Game(Therapy t, Profile p, bool fullscreen)
 {
     therapy = t;
     profile = p;
     session = new Session();
     session.Initialize(profile, therapy);
     profile.Sessions.Add(session);
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     graphics.PreferredBackBufferWidth = PREFERRED_WIDTH; // GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
     graphics.PreferredBackBufferHeight = PREFERRED_HEIGHT; // GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
     graphics.IsFullScreen = fullscreen;
     InputDevice.GAME_WIDTH = graphics.PreferredBackBufferWidth;
     InputDevice.GAME_HEIGHT = graphics.PreferredBackBufferHeight;
     this.IsFixedTimeStep = true;
     this.TargetElapsedTime = new TimeSpan(defaultTargetElapsedTime);
     graphics.PreferMultiSampling = true;
 }
Exemple #6
0
        public override void Initialize(
            GraphicsDeviceManager g, ContentManager c, SpriteBatch sb,
            int screenHeight, int screenWidth, Session s, Vector3 position)
        {
            base.Initialize(g, c, sb, screenHeight, screenWidth, s, position);

            textBox = new GameTextBox();
            String buttonText = "";
            /* create some space in the text message before printing the end condition critera */
            if (endCondition.GetType() == typeof(ButtonEndCondition))
            {
                buttonText = "\n\nHit the " + ((ButtonEndCondition)endCondition).getButtonText() + " to continue.";
            }
            else if (endCondition.GetType() == typeof(TimeLimitEndCondition))
            {
                buttonText = "\n\n\nTherapy will continue in " + ((TimeLimitEndCondition)endCondition).TimeLimit + " seconds.";
            }

            textBox.Initialize(displayText + buttonText, c, sb, screenHeight, screenWidth);
        }
Exemple #7
0
 public override void Initialize(
     GraphicsDeviceManager g, ContentManager c, SpriteBatch sb,
     int screenHeight, int screenWidth, Session s, Vector3 position)
 {
     this.g = g;
     this.c = c;
     this.sb = sb;
     this.screenHeight = screenHeight;
     this.screenWidth = screenWidth;
     this.s = s;
     currTask = 0; currRep = 0; iterRepeat = 0;
     foreach (Task t in tasks)
     {
         t.totalReps = this.numRepeats;
         t.currRep = 0;
     }
     if (tasks.Count > 0)
         tasks[0].Initialize(g, c, sb, screenHeight, screenWidth, s, position);
     conditionMet = false;
     endCondition.isNewExecution = true;
     Position = position;
 }
Exemple #8
0
        public override void Initialize(
            GraphicsDeviceManager g, ContentManager c, SpriteBatch sb,
            int screenHeight, int screenWidth, Session s, Vector3 position)
        {
            base.Initialize(g, c, sb, screenHeight, screenWidth, s, position);
            // determine shape size position on parameter type and repetition.
            int l, h;
            foreach (RegionParameter r in region.rParams.Values)
            {
                // update current position x,y,z
                if (r.SL_pos == SpecifierLabel.Static)
                    r.cPos = r.pos[1];
                else if (r.SL_pos == SpecifierLabel.Random)
                {
                    l = (int)((r.pos[0] + 1) * 100);
                    h = (int)((r.pos[1] + 1) * 100);
                    r.cPos = ((float)rand.Next(l, h) / 100) - 1;
                }
                else if (r.SL_pos == SpecifierLabel.Dynamic)
                {
                    if (currRep == 0)
                        r.cPos = r.pos[0];
                    else if (currRep < totalReps)
                        r.cPos += (r.pos[1] - r.pos[0])/(totalReps-1);
                }
                // update current size x,y,z
                if (r.SL_size == SpecifierLabel.Static)
                    r.cSize = r.size[1];
                else if (r.SL_size == SpecifierLabel.Random)
                {
                    l = (int)((r.size[0]) * 100);
                    h = (int)((r.size[1]) * 100);
                    r.cSize = ((float)rand.Next(l, h) / 100);
                }
                else if (r.SL_size == SpecifierLabel.Dynamic)
                {
                    if (currRep == 0)
                        r.cSize = r.size[0];
                    else if (currRep < totalReps)
                        r.cSize += (r.size[1] - r.size[0]) / (totalReps-1);
                }
                // make sure no region is partially outside the coordinate system
                if (region.Shape == ShapeType.Rectangle)
                {
                    if (r.cPos - r.cSize / 2 < -1)
                        r.cPos += (-1 - (r.cPos - r.cSize / 2));
                    else if (r.cPos + r.cSize / 2 > 1)
                        r.cPos -= (-1 + (r.cPos + r.cSize / 2));
                }
                this.swish = c.Load<SoundEffect>("Sounds\\bbswish");
            }

            if (region.Shape == ShapeType.Rectangle)
            {
                rectangle = new Cuboid(g,
                                       c,
                                       new Vector3(((RegionParameter)region.rParams[regPT.X]).cPos, ((RegionParameter)region.rParams[regPT.Y]).cPos, 0.0f),
                                       new Vector3(((RegionParameter)region.rParams[regPT.X]).cSize, ((RegionParameter)region.rParams[regPT.Y]).cSize, 0.0f),
                                       Color.DarkBlue);
            }
            else if (region.Shape == ShapeType.Ellipse)
            {
                ellipse = new Ellipsoid(g,
                                        c,
                                       new Vector3(((RegionParameter)region.rParams[regPT.X]).cPos, ((RegionParameter)region.rParams[regPT.Y]).cPos, 0.0f),
                                       new Vector3(((RegionParameter)region.rParams[regPT.X]).cSize/2, ((RegionParameter)region.rParams[regPT.Y]).cSize/2, 0.0f),
                                       Color.DarkBlue);
            }
            else if (region.Shape == ShapeType.Hoop)
            {
                hoop = new Hoop(g,
                                c,
                                new Vector3(((RegionParameter)region.rParams[regPT.X]).cPos, ((RegionParameter)region.rParams[regPT.Y]).cPos, 0.0f),
                                new Vector3(((RegionParameter)region.rParams[regPT.X]).cSize, ((RegionParameter)region.rParams[regPT.Y]).cSize, 0.0f),
                                Color.DarkBlue);
            }
        }
Exemple #9
0
 public void Initialize(Session s)
 {
     session = s;
     gameTime = new TimeSpan();
     fieldData = new Hashtable();
     Initialize();
 }
Exemple #10
0
 public static void exportSession(Session session, String saveFile)
 {
     File.Copy(session.GetDataFilePath(), saveFile);
 }
Exemple #11
0
 public void deleteSession(Session s)
 {
     s.delete();
     Sessions.Remove(s);
 }