protected override void OnTyped(Typer typer) { base.OnTyped(typer); if (typer == _state.CreateCharacter) { SwitchToCharacterCreationScreen(); return; } if (typer == _state.Exit) { Exit(); return; } var characterId = _state.GetCharacterIdFor(typer); if (characterId == null) { return; } // TODO: Refactor this (encapsulate). ConnectAsCharacter(characterId.Replace("select-character-", string.Empty)); }
public IActionResult New(string objectName, IFormCollection form) { ModelState.Clear(); var domainType = Typer.GetTyper(objectName); var vmType = Typer.GetRefTyper("ViewModel", domainType, TyperAction.Insert); if (vmType == null) { return(NotFound()); } var model = BindModel(form, vmType); var viewName = $"{objectName}New"; if (!TryValidateModel(model)) { return(View(viewName, model)); } var entity = Mapper.Map(model, model.GetType(), domainType) as IDefaultEntity; service.Add(entity); uoW.SaveChanges(); return(RedirectToAction("List", new { objectName })); }
public IActionResult Edit(string objectName, Guid id, IFormCollection form) { ModelState.Clear(); var domainType = Typer.GetTyper(objectName); var vmType = Typer.GetRefTyper("ViewModel", domainType, TyperAction.Update); if (vmType == null) { return(NotFound()); } var model = BindModel(form, vmType); if (!TryValidateModel(model)) { var viewName = $"{objectName}/Edit"; return(View(viewName, model)); } var entity = repositoryRead.GetSingle(objectName, id) as IDefaultEntity; Mapper.Map(model, entity, vmType, domainType); service.Update(entity); uoW.SaveChanges(); return(RedirectToAction("List", new { objectName })); }
public PrePlayScreen(int playerOneIndex, int playerTwoIndex) { this.playerOneIndex = playerOneIndex; this.playerTwoIndex = playerTwoIndex; p1Start = SettingsManager.p1Start; p1Select = SettingsManager.p1PowerUp; p1MoveLeft = SettingsManager.p1MoveLeft; p1MoveRight = SettingsManager.p1MoveRight; p2Start = SettingsManager.p2Start; p2Select = SettingsManager.p2PowerUp; p2MoveLeft = SettingsManager.p2MoveLeft; p2MoveRight = SettingsManager.p2MoveRight; playerTyping = Typer.playerOne; colorsP1 = new List <GameObject>(); SetColors(colorsP1, playerOneIndex); colorsP2 = new List <GameObject>(); SetColors(colorsP2, playerTwoIndex); instructionsPlayer1 = "Player one please select color:"; instructionsPlayer2 = "Player two please select color:"; }
// Use this for initialization void Start() { typer = GetComponent <Typer>(); profile = GetComponent <CharacterProfile>(); LoadFile(currentFile); }
/// <summary> /// return the Type of this framework type. /// </summary> /// <returns></returns> public Type GetSystemType() { Type gotType = null; // return the type found in TypeLookup static. if (mTypeLookup.ContainsKey(FullTypeName) == false) { Type tp = Type.GetType(FullTypeName); // search for the type by its FullName. if (tp == null) { tp = Typer.FindType(FullTypeName); } if (tp == null) { throw new Exception("Type of FrameworkType " + TypeText + " is not found"); } mTypeLookup.Add(FullTypeName, tp); } gotType = mTypeLookup[FullTypeName]; return(gotType); }
public void Write(Typer typer) { // Highlight already typed part. Console.ForegroundColor = ConsoleColor.Green; Console.BackgroundColor = ConsoleColor.DarkGray; Console.Write(typer.Typed); // Highlight mistakes. Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Red; Console.Write(typer.Error); // Highlight the rest of text if typer is focused. if (typer.IsStartedTyping) { Console.ForegroundColor = ConsoleColor.DarkYellow; } else { Console.ForegroundColor = ConsoleColor.Gray; } Console.Write(typer.NotTyped); // Revert console color to default. Console.ForegroundColor = ConsoleColor.Gray; }
public void ResetUniqueTyper(Typer typer) { var phrase = GetUniquePhrase(); typer.Reset(phrase); _firstLetterToTypers.Remove(_firstLetterToTypers.Single(x => x.Value == typer).Key); _firstLetterToTypers.Add(phrase[0], typer); }
public void Initialize(string text, Action ok, Action cancel) { _text = text; _ok = TyperPool.MakeUniqueTyper(); _cancel = TyperPool.MakeUniqueTyper(); _okAction = ok; _cancelAction = cancel; }
public MainMenuScreenHandler( ITextGenerator textGenerator, IMainMenuHandler handler, IPrinter <MainMenuPrinter.State> printer) : base(textGenerator, printer) { _createCharacterTyper = MakeUniqueTyper(); _handler = handler; }
protected override bool IsTyperDisabled(Typer typer) { if (typer == _state.CreateCharacter) { return(!_state.CreateCharacterButtonEnabled); } return(base.IsTyperDisabled(typer)); }
public string?GetKeyFor(Typer typer) { if (!_idToTypers.Any(x => x.Value == typer)) { return(null); } return(_idToTypers.Single(x => x.Value == typer).Key); }
///////////////////////////////////////////////////////// private void Awake() { if (instance != null && instance != this) { Destroy(this); return; } instance = this; }
protected override void OnTyped(Typer typer) { if (typer == _returnBackToMainMenuTyper) { _characterCreationHandler.CloseAndReturnToMainMenu(); return; } throw new InvalidOperationException(); }
public IActionResult New(string objectName) { var tipoModel = Typer.GetRefTyper("ViewModel", objectName, TyperAction.GetSingle); var model = tipoModel.CreateInstance(); var viewName = $"{objectName}/New"; return(View(viewName, model)); }
public IActionResult Delete(string objectName, Guid id) { ModelState.Clear(); var type = Typer.GetTyper(objectName); service.Delete(type, id); uoW.SaveChanges(); return(ResponseApi(id)); }
public CharacterCreationScreenHandler( ITextGenerator textGenerator, ICharacterCreationHandler characterCreationHandler, IPrinter <CharacterCreationPrintableState> printer) : base(textGenerator) { _returnBackToMainMenuTyper = MakeUniqueTyper(); _characterCreationHandler = characterCreationHandler; _printer = printer; }
protected override void OnTyped(Typer typer) { if (typer == _ok) { _okAction(); } if (typer == _cancel) { _cancelAction(); } }
public TurmasController( IGenericRepositoryRead repositoryRead, IGenericDomainService service, IMapper mapper, Typer typer) : base() { this.repositoryRead = repositoryRead; this.service = service; this.mapper = mapper; this._typer = typer; }
protected override void OnTyped(Typer typer) { if (typer == _createCharacterTyper) { _handler.SwitchToCharacterCreationScreen(); return; } var characterId = _connectAsCharacterTypers.First(x => x.Value == typer).Key; _handler.ConnectAsCharacter(characterId); }
/// <summary> /// Gets called when the import file button is clicked. /// This opens a file dialog to import a file. /// If the import is succesful the program advances to the typing state. /// </summary> private void ButtonImportFile_Click(object sender, RoutedEventArgs e) { if (FileImporter.OnClickImportFile()) { typer = new Typer(); keyboardHandler.ConnectToTyper(typer); typer.LoadText(FileImporter.GetText()); typer.InitializeTypingState(); ChangeProgramState(ProgramState.typing); } }
public DialogScreenHandler( ITyperPool typerPool, IOutput output) : base(typerPool) { _output = output; _text = null !; _ok = null !; _cancel = null !; _okAction = null !; _cancelAction = null !; }
public DialogModalScreenHandler( ITextGenerator textGenerator, IOutput output) : base(textGenerator) { _output = output; _text = null !; _ok = null !; _cancel = null !; _okAction = null !; _cancelAction = null !; }
} // TODO: Remove public setter. public void TestTyped(Typer typer) { if (FocusedComponent != null) { return; } if (_components.ContainsKey(typer)) { FocusedComponent = _components[typer]; _components[typer].IsFocused = true; } }
public IActionResult List(string objectName) { ModelState.Clear(); var entidades = repositoryRead.GetAll(objectName); var tipoModel = Typer.GetRefTyper("ViewModel", objectName, TyperAction.GetAll); var models = Mapper.Map(entidades, entidades.GetType(), typeof(IEnumerable <>).MakeGenericType(tipoModel)); var viewName = $"{objectName}/List"; return(View(viewName, models)); }
public IActionResult Edit(string objectName, Guid id) { ModelState.Clear(); var entidade = repositoryRead.GetSingle(objectName, id); var tipoModel = Typer.GetRefTyper("ViewModel", objectName, TyperAction.Update); var model = Mapper.Map(entidade, entidade.GetType(), tipoModel); var viewName = $"{objectName}/Edit"; return(View(viewName, model)); }
//private readonly IUnitOfWork uoW; public GenericController( IGenericRepositoryRead repositoryRead, IGenericDomainService service, IMapper mapper, Typer typer /*IUnitOfWork uoW*/) : base() { this.repositoryRead = repositoryRead; this.service = service; this.mapper = mapper; this._typer = typer; //this.uoW = uoW; }
public void InsertOffice(string officeNameFull, string officeNameAbbr, string officehead, string officeheadPos) { DbLink Link = new DbLink(); Typer SqlTyper = new Typer(); using (SqlConnection conn = Link.InitializeSqlConnection()) { int officeCode = 31; int officeheadId = 22; conn.Open(); SqlCommand comm = new SqlCommand("SELECT TOP 1 Office_Code FROM dbo.tbl_A_Certified ORDER BY Office_Code DESC", conn); SqlDataReader reader = comm.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { officeCode = int.Parse(reader.GetString(0)); officeCode++; } } reader.Close(); comm.CommandText = "INSERT INTO dbo.tbl_Officehead (Officehead_Name, Officehead_Pos) " + "VALUES ('" + officehead + "', '" + officeheadPos + "'); SELECT SCOPE_IDENTITY();"; try { officeheadId = int.Parse(comm.ExecuteScalar().ToString()); } catch (SqlException ex) { MessageBox.Show(ex.Message.ToString(), "SqlException occured", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Exception occured", MessageBoxButtons.OK, MessageBoxIcon.Error); } comm.CommandText = "INSERT INTO dbo.tbl_A_Certified (Office_Code, Office_NameFull, Office_NameAbbr, OfficeheadId) " + "VALUES ('" + officeCode + "', '" + officeNameFull + "', '" + officeNameAbbr + "', " + officeheadId + ")"; comm.ExecuteNonQuery(); } }
protected override bool IsTyperDisabled(Typer typer) { var rwTyper = _state.RopeWars.FirstOrDefault(rw => rw.Typer == typer); if (rwTyper != null && _state.CurrentRopeWar != null) { return(false); } if (typer == _state.CreateRopeWarTyper && _state.CurrentRopeWar != null) { return(false); } return(base.IsTyperDisabled(typer)); }
protected override void OnTyped(Typer typer) { base.OnTyped(typer); if (typer == _state.BackToMainMenu) { SwitchBackToMainMenu(); return; } if (typer == _state.CreateCharacter) { CreateCharacter(); return; } }
void Awake() { typer = GetComponentInChildren<Typer>(); menuAnim = GetComponent<Animator>(); }