예제 #1
0
        /// <summary>
        /// Initializes the navigation drawer menu.
        /// </summary>
        private void InitNavigationDrawer(global::Android.Support.V7.Widget.Toolbar toolbar) {
            _drawerLayout = this.FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            _drawerToggle = new CustomActionBarDrawerToggle(this, _drawerLayout, toolbar, Resource.String.Vernacular_P0_action_drawer_open, Resource.String.Vernacular_P0_action_drawer_close);
            _drawerLayout.AddDrawerListener(_drawerToggle);
            FindViewById<Button>(Resource.Id.navigation_button_settings).Click += (sender, e) => {
                Intent i = new Intent(this, typeof(SettingsActivity));
                StartActivity(i);
                _drawerLayout.CloseDrawers();
            };
            FindViewById<Button>(Resource.Id.navigation_button_log).Click += (sender, e) => {
                Intent i = new Intent(this, typeof(LogActivity));
                StartActivity(i);
                _drawerLayout.CloseDrawers();
            };
            FindViewById<Button>(Resource.Id.navigation_button_queue).Click += (sender, e) => {
                Intent i = new Intent(this, typeof(QueueActivity));
                StartActivity(i);
                _drawerLayout.CloseDrawers();
            };
            FindViewById<Button>(Resource.Id.navigation_button_stats).Click += (sender, e) => {
                Intent i = new Intent(this, typeof(StatsActivity));
                StartActivity(i);
                _drawerLayout.CloseDrawers();
            };
            FindViewById<Button>(Resource.Id.navigation_button_about).Click += (sender, e) => {
                Intent i = new Intent(this, typeof(AboutActivity));
                StartActivity(i);
                _drawerLayout.CloseDrawers();
            };
            FindViewById<Button>(Resource.Id.navigation_button_game).Click += (sender, e) => {
                Intent i = new Intent(this, typeof(GameActivity));
                StartActivity(i);
                _drawerLayout.CloseDrawers();
            };

            _drawerLayout.DrawerStateChanged += (sender, e) => {
                if(e.NewState == DrawerLayout.StateDragging || e.NewState == DrawerLayout.StateSettling) {
                    // Drawer movement, stop recording
                    SensingService.Do(model => {
                        if(model.IsRecording) {
                            Toast.MakeText(ApplicationContext, UiStrings.MainNotificationSuspendUserAction, ToastLength.Short).Show();
                            model.StopRecordingCommand.Execute(null);
                        }
                    });
                }
            };
        }
예제 #2
0
 private void StopRecording() {
     SensingService.Do(model => {
         model.StopRecordingCommand.Execute(null);
     });
 }