public ResponseModel AddScreenAction(ScreenAction screenAction) { ResponseModel result = new ResponseModel(); string action = ((ModelType)screenAction.ActionType).ToString(); int value; if (int.TryParse(action, out value)) { result.ResponseStatus = false; result.ResponseText = "Sorry, Action Type has some error."; return(result); } if (!Context.Set <ScreenAction>().Any(x => x.FK_screenId == screenAction.FK_screenId && x.IsDeleted == false && x.ActionType == screenAction.ActionType)) { screenAction.CreatedBy = 0; screenAction.CreatedDate = DateTime.UtcNow; screenAction.IsDeleted = false; Context.Set <ScreenAction>().Add(screenAction); SaveChanges(); result.ResponseStatus = true; result.ResponseText = "ScreenAction created successfully."; } else { result.ResponseStatus = false; result.ResponseText = "Sorry Duplicate Records exists."; } return(result); }
public virtual void ForEachScreen(ScreenAction screenAction) { foreach (AppScreen appScreen in screenCache.Values) { screenAction.Invoke(appScreen); } }
// Use this for initialization void Start () { deathListeners = new List<DeathListener> (); screenAction = GameObject.Find ("Screen").GetComponent<ScreenAction> (); playerSprite = GetComponent<SpriteRenderer> (); playerControl = GetComponent<PlayerControl> (); // playerAnimator = GetComponent<Animator> (); foreach (Transform child in this.gameObject.transform) { if (child.name == "Ghost") { ghosty = child.gameObject; } } if (isLocalPlayer) { hearts = new Image[maxHealth]; // panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0"); for (int i = 0; i < maxHealth; i++) { hearts [i] = GameObject.Find ("Heart" + (i + 1)).GetComponent<Image> (); } // playerAnimator = GetComponent<Animator> (); // playerSprite = GetComponent<SpriteRenderer> (); // foreach (Transform child in this.gameObject.transform) { // if (child.name == "Ghost") { // ghosty = child.gameObject; // } // } } else { // Need to actually use the // panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0"); return; } // healthBarBackground = panel.FindChild ("Health Background").GetComponent<RectTransform> (); // healthBar = healthBarBackground.FindChild ("Health Foreground").GetComponent<RectTransform> (); notificationText = GameObject.Find("Notice").GetComponent<NotificationText> (); }
public bool DeleteScreenAction(int id) { ScreenAction screenaction = Context.Set <ScreenAction>().FirstOrDefault(x => x.ActionId == id && !x.IsDeleted); screenaction.IsDeleted = true; screenaction.DeletedBy = 1; screenaction.DeletedDate = DateTime.UtcNow; SaveChanges(); return(true); }
public void EditScreenAction(ScreenAction screenAction) { var screenactionObject = Context.Set <ScreenAction>().FirstOrDefault(x => x.ActionId == screenAction.ActionId); screenactionObject.ActionName = screenAction.ActionName; screenactionObject.ActionType = screenAction.ActionType; screenactionObject.ModifiedBy = screenAction.ModifiedBy; screenactionObject.ModifiedDate = DateTime.UtcNow; screenactionObject.CreatedDate = screenAction.CreatedDate; SaveChanges(); }
public void CreateAction(ConsoleKey key, IPresenter presenter) { if (!m_keyAction.ContainsKey(key)) { m_keyAction.Add(key, null); } m_keyAction[key] = new ScreenAction() { Presenter = presenter }; }
public void CreateAction(ConsoleKey key, IPresenter presenter, string description) { if (!m_keyAction.ContainsKey(key)) { m_keyAction.Add(key, null); } m_keyAction[key] = new ScreenAction() { Presenter = presenter, Description = description }; }
private ScreenAction GetScreenAction(Type screenType) { ScreenAction screenAction; _screenActions.TryGetValue(screenType, out screenAction); if (screenAction == null) { screenAction = new ScreenAction(); _screenActions[screenType] = screenAction; } return(screenAction); }
public void shortcut_creates_a_button() { var command = MockRepository.GenerateMock <ICommand>(); var shortcut = new ScreenAction { Name = "some text", Binding = new InputBinding(command, new KeyGesture(Key.F8)), Icon = Icon.Run }; shortcut.BuildButton(_commands); _commands.AssertWasCalled(x => x.AddCommand("some text", command, Icon.Run)); }
public void Menu(string text, Icon icon) { if (_item.ContextMenu == null) { _item.ContextMenu = new ContextMenu(); } var action = new ScreenAction() { Binding = new InputBinding(_command, _gesture), Icon = icon, Name = text }; _item.ContextMenu.Items.Add(CommandMenuItem.Build(action)); }
public static MenuItem Build(ScreenAction screenAction) { var item = new MenuItem() { //Header = new DockPanel().Left<Label>(x => x.Content = screenAction.Name), Header = screenAction.Name, InputGestureText = screenAction.KeyString, Tag = screenAction, Command = screenAction.Command }; item.Icon = new Image().Configure(x => x.SetIcon(screenAction.Icon)); return(item); }
public void Add(Icon icon, string text, Action action, KeyGesture gesture) { var screenAction = new ScreenAction() { Binding = new InputBinding(new ActionCommand(action), gesture), Icon = icon, Name = text }; InputBindings.Add(screenAction.Binding); var item = CommandMenuItem.Build(screenAction); item.StaysOpenOnClick = true; Items.Add(item); }
private static void GoTo_AddDialogueHistory(DialogueScreen screen, ScreenAction action) { (string line, bool isPlayerLine, bool isTechnical)historyEntry = ("", true, false); var dialogue = action.Dialogue?.Invoke(); if (string.IsNullOrWhiteSpace(dialogue)) { historyEntry.line = $"\"{dialogue}\""; } else { historyEntry.line = action.Description?.Invoke() ?? ""; } screen.DialogueHistory.Add(historyEntry); }
public override void WriteJson(JsonWriter writer, object?value, JsonSerializer serializer) { JObject jObject = new JObject(); ScreenAction action = value as ScreenAction; if (action == null) { throw new Exception($"{nameof(value)} should be {nameof(ScreenAction)}"); } jObject.Add("Description", new JValue(action.Description?.Invoke() ?? "")); jObject.Add("Dialogue", new JValue(action.Dialogue?.Invoke() ?? "")); jObject.Add("SilverPrice", new JValue(action.SilverPrice?.Invoke() ?? 0)); jObject.Add("GoldPrice", new JValue(action.GoldPrice?.Invoke() ?? 0)); jObject.Add("DiamondsPrice", new JValue(action.DiamondsPrice?.Invoke() ?? 0)); jObject.Add("EnergyPrice", new JValue(action.EnergyPrice?.Invoke() ?? 0)); jObject.WriteTo(writer); }
// [HandleException] public ActionResult EditScreenAction(ScreenAction screenaction) { try { string action = ((ModelType)screenaction.ActionType).ToString(); int value; if (int.TryParse(action, out value)) { return(RedirectToAction("Index")); } _screenAPIController.EditScreenAction(screenaction); return(RedirectToAction("Index")); } catch { return(View()); } }
private void CreateMenuScreen() { bool f2key = false; bool f3key = false; bool f5key = false; string menu = "Menu: "; foreach (KeyValuePair <ConsoleKey, ScreenAction> item in m_keyAction) { if (item.Key > ConsoleKey.F2 && !f2key && EnableSave) { f2key = true; menu += "F2:Salvar e Sair | "; } else if (item.Key > ConsoleKey.F3 && !f3key && EnableSearch) { f3key = true; menu += "F3:Pesquisar | "; } else if (item.Key > ConsoleKey.F5 && !f5key && EnableSelectItem) { f5key = true; menu += "F5:Digite a posição e pressione F5 para selecionar | "; } ScreenAction act = item.Value; string value = act.Description; if (string.IsNullOrEmpty(value) && act.Presenter != null) { value = act.Presenter.Name; } menu += string.Format("{0}:{1} | ", Convert.ToString(item.Key), value); } menu += "F12:Sair |"; Console.SetCursorPosition(0, 25); Console.Write(menu); }
// Use this for initialization void Start() { deathListeners = new List <DeathListener> (); screenAction = GameObject.Find("Screen").GetComponent <ScreenAction> (); playerSprite = GetComponent <SpriteRenderer> (); playerControl = GetComponent <PlayerControl> (); // playerAnimator = GetComponent<Animator> (); foreach (Transform child in this.gameObject.transform) { if (child.name == "Ghost") { ghosty = child.gameObject; } } if (isLocalPlayer) { hearts = new Image[maxHealth]; // panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0"); for (int i = 0; i < maxHealth; i++) { hearts [i] = GameObject.Find("Heart" + (i + 1)).GetComponent <Image> (); } // playerAnimator = GetComponent<Animator> (); // playerSprite = GetComponent<SpriteRenderer> (); // foreach (Transform child in this.gameObject.transform) { // if (child.name == "Ghost") { // ghosty = child.gameObject; // } // } } else { // Need to actually use the // panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0"); return; } // healthBarBackground = panel.FindChild ("Health Background").GetComponent<RectTransform> (); // healthBar = healthBarBackground.FindChild ("Health Foreground").GetComponent<RectTransform> (); notificationText = GameObject.Find("Notice").GetComponent <NotificationText> (); }
public ActionResult ScreenAction([Bind(Include = "ActionId,FK_screenId,ActionName,ActionType")] ScreenAction screenAction) { // _iRolesAPIController = new RolesAPIController(); // if (ModelState.IsValid) { string action = ((ModelType)screenAction.ActionType).ToString(); int value; if (int.TryParse(action, out value)) { ResponseModel _result1 = new ResponseModel(); _result1.ResponseStatus = false; _result1.ResponseText = "Sorry, Action Type has some error."; return(this.Json(_result1, JsonRequestBehavior.DenyGet)); } // role.Active = true; ResponseModel _result = _screenAPIController.AddScreenAction(screenAction); // return RedirectToAction("Index"); if (_result.ResponseStatus) { //return RedirectToAction("Index"); return(this.Json(_result, JsonRequestBehavior.DenyGet)); } else { if (Request.IsAjaxRequest()) { return(this.Json(_result, JsonRequestBehavior.DenyGet)); } else { return(View(screenAction)); } } } return(View(screenAction)); }
public BindingExpression(string name, ScreenObjectRegistry registry) { _screenAction = new ScreenAction(); _screenAction.Name = name; _registry = registry; }
private void register(ScreenAction screenAction) { _actions.Add(screenAction); }
public void EditScreenAction(ScreenAction screenAction) { _screenService.EditScreenAction(screenAction); }
public ResponseModel AddScreenAction(ScreenAction screenAction) { return(_screenService.AddScreenAction(screenAction)); }
private void ActivateKeyboard() { bool end = false; do { ConsoleKeyInfo key = Console.ReadKey(true); ScreenAction action = null; if (m_keyAction.TryGetValue(key.Key, out action) && action.Presenter != null) { action.Presenter.Show(m_instance); } else { switch (key.Key) { case ConsoleKey.F1: case ConsoleKey.F4: case ConsoleKey.F6: case ConsoleKey.F7: case ConsoleKey.F8: case ConsoleKey.F9: case ConsoleKey.F10: case ConsoleKey.F11: break; case ConsoleKey.F2: if (m_presenter != null) { string msgErr = null; if (!m_presenter.Save(out msgErr)) { WriteMessageOnFooter(msgErr); } else if (m_presenter.ParentPresenter != null) { m_presenter.ParentPresenter.Show(m_instance); } } break; case ConsoleKey.F3: if (m_presenter != null) { m_presenter.Search(m_instance); } break; case ConsoleKey.F5: if (m_presenter != null) { int position = 0; string value = GetCurrentScreenItemValue(); if (!string.IsNullOrEmpty(value) && int.TryParse(value, out position)) { m_presenter.SelectedItem(m_instance, position); } } break; case ConsoleKey.F12: end = true; break; case ConsoleKey.UpArrow: MoveToPreviousScreenItem(); break; case ConsoleKey.Enter: case ConsoleKey.DownArrow: MoveToNextScreenItem(); break; default: ReadData(key); break; } } } while (!end); }
public void EditScreenAction(ScreenAction screenAction) { screenAction.CreatedDate = DateTime.Now; _screenRepository.EditScreenAction(screenAction); }
// add screenAction public ResponseModel AddScreenAction(ScreenAction screenAction) { return(_screenRepository.AddScreenAction(screenAction)); }