Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            GhostlyLog.BrowserPage.HomeLocation = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
            SeriousGames.HomeLocation           = GhostlyLog.BrowserPage.HomeLocation;
            base.OnCreate(bundle);

            Forms.Init(this, bundle);
            Instance = this;

            this.RequestPermissions(new String[] {
                Manifest.Permission.ReadExternalStorage,
            }, 1);

            SetContentView(Resource.Layout.GhostlyLogMain);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            SupportActionBar.Title = SeriousGames.GetPatientDirectory(SeriousGames.CurrentPatient);

            FolderPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData));
            BrowserPage mainPage = new BrowserPage(VersionTracking.CurrentVersion);

            mainPage.DetailedPageRequested += MainPage_DetailedPageRequested;
            var mainFragment = mainPage.CreateSupportFragment(this);

            //FragmentManager
            //    .BeginTransaction()
            //    .Replace(Resource.Id.fragment_frame_layout, mainFragment)
            //    .Commit();

            SupportFragmentManager.BackStackChanged += (sender, e) =>
            {
                bool hasBack = SupportFragmentManager.BackStackEntryCount > 0;
                SupportActionBar.SetHomeButtonEnabled(hasBack);
                SupportActionBar.SetDisplayHomeAsUpEnabled(hasBack);
                SupportActionBar.Title = hasBack ? "Detailed report" : "Ghostly Log";
            };
        }
Beispiel #2
0
        internal void Create(Dictionary <string, string> parameters, IGame game, string[] pointNames, float expectedFrameRate, string[] analogChannelNames = null, Int16 analogSamplesPerFrame = 0, bool eventsEnabled = false)
        {
            game.GameFinished += (o, args) =>
            {
                _score = (Int16)args.Score;
                _level = (Int16)args.Level;
            };
            string version = SeriousGames.SoftwareVersion;

            string therapist = SeriousGames.GetTherapistName();
            string player    = SeriousGames.CurrentPatient != null ? SeriousGames.CurrentPatient.Id : "---";
            string gameName  = SeriousGames.CurrentGame != null ? SeriousGames.CurrentGame.Name : "[na]";
            string group     =
                SeriousGames.CurrentPatient != null &&
                SeriousGames.CurrentPatient.Id != null &&
                SeriousGames.CurrentPatient.HospitalId != null ?
                SeriousGames.CurrentPatient.HospitalId : "---";

            therapist = therapist == null ? "---" : therapist;


            _fileName = SeriousGames.GetPatientDirectory(SeriousGames.CurrentPatient) + "/" + gameName +
                        GetTypeName() + TimeIdentifier + ".c3d";

            // TODO
            _uploading                 = new DataUploading();
            _uploading.Id              = player == "Default" ? -2 : -1;
            _uploading.PatientId       = player;
            _uploading.HospitalId      = group;
            _uploading.PerformanceDate = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
            _uploading.C3DFileId       = _fileName;
            _uploading.Uploaded        = 0;
            _uploading.GameID          = game.Definition.GameId;

            _writer = new C3dWriter(pointNames, expectedFrameRate, analogChannelNames, analogSamplesPerFrame, eventsEnabled);
            _writer.SetParameter <string[]>("POINT:DATA_TYPE_LABELS", new string[] {
                "Skeleton",
                "Accelerometer",
                "BalanceBoard",
                "Emg"
            });
            //_writer.Header.AnalogChannels = (short)(7 + game.GameStream.Keys.Count);
            //_analogData = new Int16[_writer.Header.AnalogChannels];
            //_writer.Header.AnalogSamplesPerFrame = 1;

            _writer.SetParameter <string>("SUBJECTS:MARKER_SET", "Using ETRO extended marker set");
            _writer.SetParameter <string>("INFO:SYSTEM", "OpenFeasyo");
            _writer.SetParameter <string>("INFO:EVENT", "gameplay");
            _writer.SetParameter <string>("INFO:GAME_NAME", gameName);

            // set correct value to game level & optimized
            _writer.SetParameter <string>("INFO:GAME_LEVEL_NAME", " --- ");
            _writer.SetParameter <Int16>("INFO:GAME_LEVEL", -1);
            _writer.SetParameter <Int16>("INFO:OPTIMIZED", 0);

            _writer.SetParameter <string>("INFO:VERSION", version);
            //_writer.SetParameter<Int16>("ANALOG:USED", _writer.Header.AnalogChannels);

            _time = DateTime.Now;

            _writer.SetParameter <Int16>("INFO:DURATION", 0);
            _writer.SetParameter <string>("INFO:THERAPIST_ID", therapist);
            _writer.SetParameter <string>("INFO:GROUP_ID", group);
            _writer.SetParameter <string>("SUBJECTS:PLAYER_NAME", player);
            _writer.SetParameter <float>("SUBJECTS:GAME_SCORE", 0.0f);
            _writer.SetParameter <string[]>("INFO:TIME", new string [] {
                _time.Year.ToString(),
                _time.Month.ToString(),
                _time.Day.ToString(),
                _time.Hour.ToString(),
                _time.Minute.ToString(),
            });

            //string [] labels = new string[] {
            //    "year      ",
            //    "month     ",
            //    "day       ",
            //    "hour      ",
            //    "minute    ",
            //    "second    ",
            //    "milisecond"};
            //_writer.SetParameter<string[]>("ANALOG:LABELS", labels.Union<string>(game.GameStream.Keys).ToArray<string>());
        }