public void CreateSetsInstance() { var testList = new Octgn.DataNew.Entities.Game(); //var ss = StateSave<List<string>>.Create(testList); //Assert.AreEqual(testList, ss.GetInstance()); }
public void GetSetInstanceWorks() { var testList = new Octgn.DataNew.Entities.Game() { Name = "Chicken" }; //var ss = StateSave<Octgn.DataNew.Entities.Game>.Create(new Octgn.DataNew.Entities.Game()); //Assert.AreNotEqual(testList.Name, (ss.GetInstance() as Octgn.DataNew.Entities.Game).Name); //ss.SetInstance(testList); //Assert.AreEqual(testList,ss.GetInstance()); }
public static void SetGameSetting <T>(DataNew.Entities.Game game, string propName, T val) { var defSettings = new Hashtable(); defSettings["name"] = game.Name; var settings = SimpleConfig.Get().ReadValue("GameSettings_" + game.Id.ToString(), defSettings); if (!settings.ContainsKey(propName)) { settings.Add(propName, val); } else { settings[propName] = val; } SimpleConfig.Get().WriteValue("GameSettings_" + game.Id.ToString(), settings); }
private void ReloadGameList() { Dispatcher.Invoke(new Action(() => { stackPanel1.Children.Clear(); var games = GameManager.Get().Games.ToList(); foreach (GameListItem gs in games .OrderBy(x=>x.Name) .Select(g => new GameListItem { Game = g })) { gs.MouseUp += GsMouseUp; stackPanel1.Children.Add(gs); } SelectedGame = null; HandleGameSelectedChanged(); })); }
private void GsMouseUp(object sender, MouseButtonEventArgs e) { var gs = (GameListItem)sender; SelectedGame = SelectedGame == gs.Game ? null : gs.Game; HandleGameSelectedChanged(); }