//VM _vm; protected override void OnKeyDown(KeyEventArgs e) { char key = GI_Conversores.ObjectToChar(e.Key); if (char.IsLetterOrDigit(key)) { if (SearchFor == SearchFor.Relacionamento) { //_vm = new VM(); window = CreateNewWindow(SearchFor.Relacionamento); this.Text = e.Key.ToString().ToLower(); _eventAggregator.GetEvent <KeyDownEvento>().Publish(e.Key.ToString()); window.Show(); _eventAggregator.GetEvent <KeyDownEvento>().Publish(e.Key.ToString()); } else if (SearchFor == SearchFor.Materiais) { window = CreateNewWindow(SearchFor.Materiais); this.Text = e.Key.ToString().ToLower(); _eventAggregator.GetEvent <KeyDownEvento>().Publish(e.Key.ToString()); window.Show(); _eventAggregator.GetEvent <KeyDownEvento>().Publish(e.Key.ToString()); } } }
protected override void OnKeyDown(KeyEventArgs e) { var strKey = new KeyConverter().ConvertToString(e.Key); char key = GI_Conversores.ObjectToChar(strKey); if (char.IsLetterOrDigit(key)) { this.Text = strKey.ToString().ToLower(); if (ChecksRelationship()) { window = CreateNewWindow(SearchFor.Relacionamento); } else if (ChecksMaterials()) { window = CreateNewWindow(SearchFor.Materiais); } _telaFavored.GetVM().RecebePressedKey(Text); window.ShowDialog(); if (ChecksRelationship() && _telaFavored.GetVM().fav != null) { SetTypeFavored(); } else if (ChecksMaterials() && _telaFavored.GetVM().mat != null) { SetTypeMaterial(); } e.Handled = true; } }