private void AppLoop() { while (true) { Clear(); switch (_currentView) { case View.Main: MainMenuView.ShowMainMenu(); _currentView = MainMenuView.MainMenuSelection(UserInput.OptionSelection()); break; case View.Stats: StatsView.ShowStats(); _currentView = StatsView.StatsSelection(); break; case View.AddDay: AddDayView.ShowAddDay(); _currentView = AddDayView.AddDaySelection(); break; case View.Options: OptionsView.ShowOptions(); _currentView = OptionsView.OptionsSelection(); break; default: WriteLine("Invalid input."); MainMenuView.MainMenuSelection(UserInput.OptionSelection()); break; } } }
private void Initializate() { var matchesJson = File.ReadAllText("Matches.json"); var matches = JsonConvert.DeserializeObject <List <Match> >(matchesJson, new StringEnumConverter()); //var s = JsonConvert.SerializeObject(matches, Formatting.Indented, new StringEnumConverter()); //var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); //var p = Path.Combine(appData, "ScoreKeeper"); //Directory.CreateDirectory(p); //var f = Path.Combine(p, "matches.json"); //File.WriteAllText(f, s); matchesView = new MatchesView(); var matchViewModels = new ObservableCollection <MatchViewModel>(matches.Select(m => new MatchViewModel(m))); matchesView.DataContext = new MatchesViewModel(matchViewModels, new RelayCommand(_ => EditMatch(null)), new RelayCommand(m => EditMatch(((MatchViewModel)m).Match), o => o != null)); statsView = new StatsView(); var statsViewModel = new StatsViewModel(matchViewModels); statsView.DataContext = statsViewModel; navigateToView(matchesView); }
public static StatsView Load() { StatsView view = UIView.Load("Views/StatsView", OverriddenViewController.Instance.transform) as StatsView; view.name = "StatsView"; return(view); }
public async Task <ActionResult <StatsView> > GetStats() { try { StatsView statitics = await _mediator.Send(new GetStatsQuery()); return(Ok(statitics)); } catch (Exception e) { return(StatusCode(500)); } }
private void addStatusView() { if (statsView != null) { return; } statsView = new StatsView(this, this); WindowManagerLayoutParams layoutParams = new WindowManagerLayoutParams(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.WrapContent, WindowManagerTypes.SystemOverlay, WindowManagerFlags.NotFocusable | WindowManagerFlags.NotTouchable, Format.Translucent); layoutParams.Gravity = GravityFlags.Right | GravityFlags.Top; layoutParams.Title = "Load Average"; mTabHost.AddView(statsView, layoutParams); statsView.SetBackgroundColor(Color.Black); }
private void Statisticqq() { StatsView nmw = new StatsView(); StatsViewModel contex = new StatsViewModel(); nmw.DataContext = contex; nmw.Width = 500; nmw.Height = 500; IDialogService dialogCheckIn = new DialogService(); dialogCheckIn.ShowTitleDialog(contex, nmw, "Title"); }
public async Task ExecJSONQueryTest() { Stats stats = null; StatsView statsView = null; Assert.NotNull(dbc = new DBContext(settings.Database.ConnectionString, logger)); StatsRepository statsRepos = new StatsRepository(settings, logger, dbc); stats = await statsRepos.GetStats(); statsView = JsonConvert.DeserializeObject <StatsView>(stats.Result); Assert.NotNull(statsView); Assert.True(statsView.TotalContacts > 0); dbc.Close(); }
/// <summary> /// Invokes the window with statistical data for the users. /// </summary> internal void ShowStats() { try { StatsView statsView = new StatsView(); StatsViewModel statsViewModel = new StatsViewModel(this.customers); statsView.DataContext = statsViewModel; statsView.ShowDialog(); } catch (Exception ex) { InfoDialogViewModel.ShowDialog(ex.Message, "Unhandled Exception"); Log.LogException(ex, "MainViewModel.cs"); } }
public HUD(ContentManager content, Score score, Stats stats) { var font = content.Load <SpriteFont>("Fonts/Default"); _scoreView = new ScoreView(score, font) { Colour = Color.Black, Position = new Vector2(Game1.screenWidth / 2, 20), }; _statsView = new StatsView(stats, font) { Colour = Color.Black, Position = new Vector2(Game1.screenWidth / 2, 60), }; }
public async void CheckStatsException() { string expected = "500"; GetStatsQuery getquery = new GetStatsQuery(); StatsView statitics = new StatsView(1, 1); _mediator .Setup(m => m.Send(It.IsAny <GetStatsQuery>(), It.IsAny <CancellationToken>())) .Throws(new Exception()).Verifiable(); var result = await _sut.GetStats(); IStatusCodeActionResult statusCodeResult = result.Result as IStatusCodeActionResult; Assert.Equal(expected, statusCodeResult.StatusCode.ToString()); _mediator.VerifyAll(); }
public async void CheckStats() { string expected = "200"; GetStatsQuery getquery = new GetStatsQuery(); StatsView statitics = new StatsView(1, 1); _mediator .Setup(m => m.Send(It.IsAny <GetStatsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(statitics).Verifiable(); ActionResult <StatsView> actionResult = await _sut.GetStats(); var result = actionResult.Result as OkObjectResult; Assert.Equal(expected, result.StatusCode.ToString()); _mediator.VerifyAll(); }
private void ChangeView(object obj) { if (ActiveControl is UserListView) { AdministrationData.Users = (ActiveControl.DataContext as UserListVM).UserList.ToList(); } switch (obj.ToString()) { case "Stats": ActiveControl = new StatsView(AdministrationData.Statistics); break; case "Users": ActiveControl = new UserListView(AdministrationData.Users, _token); break; case "Company": ActiveControl = new CompanyDataView(AdministrationData.Company, _token); break; } }
public override void Initialise() { base.Initialise(); #region Load content var background = Content.Load <Texture2D>(ContentPaths.Textures.Background); var backgroundMusic = Content.Load <Song>(ContentPaths.Sounds.Background); var buttonClickSound = Content.Load <SoundEffect>(ContentPaths.Sounds.ButtonClicked); var cannon = Content.Load <Texture2D>(ContentPaths.Textures.Cannon); var castleTexture = Content.Load <Texture2D>(ContentPaths.Textures.Castle); var itemPlacedSound = Content.Load <SoundEffect>(ContentPaths.Sounds.ItemPlaced); var map = Content.Load <TiledMap>(ContentPaths.TiledMap.Map); var spikes = Content.Load <Texture2D>(ContentPaths.Textures.SpikesTrap); var tileOverlay = Content.Load <Texture2D>(ContentPaths.Textures.TileOverlay); var wall = Content.Load <Texture2D>(ContentPaths.Textures.Wall); #endregion BackgroundImage = background; var gameMap = new GameMap(map); var hoveredTileOverlay = new HoveredTileOverlay(tileOverlay); var wallManager = new WallManager(wall); var defenceManager = new DefenceManager(); var trapManager = new TrapManager(); var enemyManager = new EnemyManager(); var projectileManager = new ProjectileManager(); var castle = new Castle(castleTexture) { Position = gameMap[map.Width / 2, map.Height / 2].Position }; Services.AddService(gameMap); Services.AddService(wallManager); Services.AddService(defenceManager); Services.AddService(trapManager); Services.AddService(enemyManager); Services.AddService(projectileManager); Services.AddService(castle); AddEntity(gameMap); AddEntity(hoveredTileOverlay); AddEntity(wallManager); AddEntity(defenceManager); AddEntity(trapManager); AddEntity(enemyManager); AddEntity(projectileManager); AddEntity(castle); this.gameMap = gameMap; this.wallManager = wallManager; this.defenceManager = defenceManager; this.trapManager = trapManager; this.enemyManager = enemyManager; this.castle = castle; this.itemPlacedSound = itemPlacedSound; // Center the camera. Camera.LookAt(Vector2.Zero); #region Initialise defence menu defenceMenu = new DefenceMenu(stats, new Vector2(200, GraphicsDevice.Viewport.Height)); defenceMenu.AddItem(DefenceTypes.Wall, wall, 20); defenceMenu.AddItem(DefenceTypes.Cannon, cannon, 80); defenceMenu.AddItem(DefenceTypes.Spikes, spikes, 40); defenceMenu.ItemClicked += () => buttonClickSound.Play(); UserInterface.AddEntity(defenceMenu); #endregion #region Initialise stats view statsView = new StatsView(stats, new Vector2(200, 50)); UserInterface.AddEntity(statsView); statsView.AddPointsButton.OnClick += (e) => { e.Disabled = true; questionStopwatch.Start(); SceneManager.PushScene(new QuestionScene(Game)); }; #endregion if (preferences.IsAudioEnabled) { MediaPlayer.Volume = 0; MediaPlayer.Play(backgroundMusic); MediaPlayer.IsRepeating = true; } spawner = new EnemySpawner(this.gameMap, this.enemyManager); spawnStopwatch.Start(); questionStopwatch.Start(); this.castle.Destroyed += Castle_Destroyed; Game.Exiting += Game_Exiting; }
public void ClickJob(int jobIndex) { Avatar.Instance.Type = (PieceType)jobIndex; UIViewController.ActivateUIView(StatsView.Load()); UIViewController.DeactivateUIView("JobView"); }
private void removeStatusView() { mTabHost.RemoveView(statsView); statsView = null; }
/* Shows statistics view */ private void ShowStatistics() { var statsView = new StatsView(); statsView.ShowDialog(); }
void OnGUI() { if (!isPaused) { return; } if (currentMenu == Menus.Main) { GUI.BeginGroup(new Rect(Screen.width / 2 - 125, Screen.height / 2 - 125, 250, 370)); GUI.Box(new Rect(0, 0, 250, 570), "Menu"); if (GUI.Button(new Rect(25, 20, 200, 50), "Resume")) { unpause(); } if (GUI.Button(new Rect(25, 90, 200, 50), "Levels")) { currentMenu = Menus.Levels; } if (GUI.Button(new Rect(25, 160, 200, 50), "Options")) { if (playerObject) { currentMenu = Menus.Options; } } if (GUI.Button(new Rect(25, 230, 200, 50), "Restart")) { unpause(); Application.LoadLevel(Application.loadedLevel); } if (GUI.Button(new Rect(25, 290, 200, 50), "Exit")) { Application.Quit(); } GUI.EndGroup(); } else if (currentMenu == Menus.Levels) { GUI.BeginGroup(new Rect(Screen.width / 2 - 125, Screen.height / 2 - 125, 500, 370)); GUI.Box(new Rect(0, 0, 250, 570), "Levels"); for (int i = 0; i < availableLevels.Length; i++) { if (GUI.Button(new Rect(25, i * 70 + 20, 200, 50), availableLevels[i])) { Application.LoadLevel(i); unpause(); } } if (GUI.Button(new Rect(25, 290, 200, 50), "Back")) { currentMenu = Menus.Main; } GUI.EndGroup(); } else if (isPaused && currentMenu == Menus.Options && playerObject) { GUI.BeginGroup(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 125, 500, 300)); GUI.Box(new Rect(0, 0, 500, 300), "Menu"); if (GUI.Button(new Rect(150, 240, 200, 50), "Done")) { currentMenu = Menus.Main; } ff.Inverted = GUI.Toggle(new Rect(25, 20, 200, 20), ff.Inverted, "Inverted Controls"); StatsView sv = gameObject.GetComponent <StatsView>(); if (sv) { sv.enabled = GUI.Toggle(new Rect(25, 40, 200, 20), sv.enabled, "Show Physics Statistics"); sv.showAbbreviations = GUI.Toggle(new Rect(25, 60, 200, 20), sv.showAbbreviations, "Show Unit Abbreviations"); if (ff.flightPhysics != null) { //Admittedly, this is a bit hacky. We convert the Unit enum to an integer, //asign the selection to a string array that *matches* the enums by index, //then convert the integer back to a Unit enum. Hacky, but works. Maybe it //would be better to add string-settable unit types to the unit converter. int unitSelection = (int)ff.flightPhysics.Unit; string[] choices = new string[] { "Metric", "Imperial" }; unitSelection = GUI.SelectionGrid(new Rect(25, 80, 150, 30), unitSelection, choices, 2); ff.flightPhysics.Unit = (UnitConverter.Units)unitSelection; } } GUI.EndGroup(); } }