public static FormFind GetInstance() { if ((null == _FormFind) ||(_FormFind.IsDisposed)) { _FormFind = new FormFind(); } return _FormFind; }
private void formFind_FormClosed(object sender, FormClosedEventArgs e) { formFind = null; foreach (var n in this.trvResults.GetAllNodes()) { n.ForeColor = Color.Black; n.BackColor = Color.White; } }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { if (null == formFind) { formFind = new FormFind(this.trvResults); formFind.FormClosed += new FormClosedEventHandler(formFind_FormClosed); formFind.Owner = this; formFind.Location = this.trvResults.PointToScreen(new Point(this.trvResults.Left + this.trvResults.Width + 20, this.trvResults.Top + 15)); formFind.Show(); } formFind.Activate(); }
//Метод поиска игр. Вызывается кнопкой поиска с формы поиска public void Find(UInt16 mode, FormFind formFind) { //В зависимости от режима производится поиск по какому-либо критерию switch (mode) { case 1: { /*Коллекцию DbSet при некоторых запросах Linq нужно брать, как перечисляемую коллекцию, иначе будет ошибка "Linq to Entity не знает этой команды". * (а именно взаимодействие с элементами управления формы). Если нет возможности представить коллекцию, как перечисляемую, то работу с элементами * формы нужно вынести за предел запроса Linq, как указано в закомментированном примере ниже*/ Communication.found_games = Communication.db.Games.Local.AsEnumerable().Where(x => x.Game_Name.ToLower().Contains(formFind.Controls["textBox1"].Text.ToLower())).ToList(); //string test = formFind.Controls["textBox1"].Text.ToLower(); //Communication.found_games = // Communication.db.Games.Where(x => x.Game_Name.ToLower().Contains(test)).ToList(); break; } case 2: { Communication.found_games = Communication.db.Games.Local.AsEnumerable().Where(x => x.Game_Studio.ToLower().Contains(formFind.Controls["textBox2"].Text.ToLower())).ToList(); break; } case 3: { Communication.found_games = Communication.db.Games.Local.AsEnumerable().Where(x => x.Game_Name.ToLower().Contains(formFind.Controls["textBox1"].Text.ToLower()) && x.Game_Studio.ToLower().Contains(formFind.Controls["textBox2"].Text.ToLower())).ToList(); break; } case 4: { Communication.found_games = Communication.db.Games.Local.AsEnumerable().Where(x => x.Game_StyleId == (formFind.Controls["comboBox1"] as ComboBox).SelectedIndex + 1).ToList(); break; } case 5: { Communication.found_games = Communication.db.Games.Local.AsEnumerable().Where(x => x.Game_ReleaseDate.Year == (formFind.Controls["numericUpDown1"] as NumericUpDown).Value).ToList(); break; } } formFind.Dispose(); //Обновление ДатаГрида поиска Communication.dataGrid.DataSource = Communication.found_games; Communication.dataGrid.Update(); Communication.dataGrid.Refresh(); }
private void toolStripButtonFind_Click(object sender, EventArgs e) { if (formFind == null) { formFind = new FormFind(); formFind.Find += FormFind_Find; formFind.FormClosed += FormFind_FormClosed; formFind.Show(this); } else { formFind.Show(); } }
private void HastaAra() { FormFind form = new FormFind(); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { DataTable table = _patientService.Search(form.SearchText, true); dataGridViewPatients.DataSource = table; for (int i = 1; i <= table.Rows.Count; i++) { dataGridViewPatients.Rows[i - 1].HeaderCell.Value = i.ToString(); } } dataGridViewAppointments.Focus(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormPayload_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F & e.Modifiers == Keys.Control) { tabEvent.SelectedTab = tabPageAscii; txtPayloadAscii.Select(); _formFind = new FormFind(this, txtPayloadAscii); _formFind.Owner = this; _formFind.TopMost = true; _formFind.Show(); } else if (e.KeyCode == Keys.Escape) { this.Close(); } else if (e.KeyCode == Keys.F3) { _formFind.DoSearch(); } }
private void FormFind_FormClosed(object sender, FormClosedEventArgs e) { formFind = null; }
private void formFind_FormClosed( object sender, FormClosedEventArgs e ) { formFind = null; foreach ( var n in this.trvResults.GetAllNodes() ) { n.ForeColor = Color.Black; n.BackColor = Color.White; } }
private void findToolStripMenuItem_Click( object sender, EventArgs e ) { if ( null == formFind ) { formFind = new FormFind( this.trvResults ); formFind.FormClosed += new FormClosedEventHandler( formFind_FormClosed ); formFind.Owner = this; formFind.Location = this.trvResults.PointToScreen( new Point( this.trvResults.Left + this.trvResults.Width + 20, this.trvResults.Top + 15 ) ); formFind.Show(); } formFind.Activate(); }
private void miViewindUpdate_Click(object sender, EventArgs e) { FormFind f = new FormFind(); f.find = find; f.ShowDialog(this); if (!f.isOK) return; find = f.find; if (view == ViewMode.FindUpdate) view = ViewMode.None; // 同じのクリックしても検索するよー ChangeView(ViewMode.FindUpdate); }
private void menuEditFind_Click(object sender, EventArgs e) { if (textMain.TextLength == 0) return; if (formFind == null) formFind = new FormFind() { Owner = this }; formFind.Display(this); }
/// <summary> /// Creates a new FormFind dialog /// </summary> /// <returns>the form find dialog</returns> FormFind ShowFind() { if (_formFind == null || _formFind.IsDisposed) { _formFind = new FormFind(); _formFind.HexBox = this.hexBox; _formFind.FindOptions = _findOptions; _formFind.Show(this); } else { _formFind.Focus(); } return _formFind; }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { FormFind frmFind = new FormFind(); frmFind.ShowDialog(); switch (frmFind.Mode) { case FormFind.SearchMode.None: listBoxList.Items.Clear(); break; case FormFind.SearchMode.ByPos: ListWordsByPos(frmFind.POS); break; case FormFind.SearchMode.ByLength: ListWordsByLength(frmFind.Length); break; } }
private void btnFind_Click(object sender, System.EventArgs e) { FormFind form = new FormFind(); if (form.ShowDialog(this) == DialogResult.OK) { Ship ship = game.Commander.Ship; string[] words = form.SystemName.Split(' '); string first = words.Length > 0 ? words[0] : ""; string second = words.Length > 1 ? words[1] : ""; string third = words.Length > 2 ? words[2] : ""; int num1 = Functions.IsInt(second) ? int.Parse(second) : 0; int num2 = Functions.IsInt(third) ? int.Parse(third) : 0; bool find = false; if (game.CheatEnabled) { switch (first) { case "Bazaar": game.ChanceOfTradeInOrbit = Math.Max(0, Math.Min(1000, num1)); break; case "Cover": if (num1 >= 0 && num1 < ship.Shields.Length && num2 >= 0 && num2 < Consts.Shields.Length) ship.Shields[num1] = (Shield)Consts.Shields[num2].Clone(); break; case "DeLorean": game.Commander.Days = Math.Max(0, num1); break; case "Diamond": ship.HullUpgraded = !ship.HullUpgraded; break; case "Energize": game.CanSuperWarp = !game.CanSuperWarp; break; case "Events": if (second == "Reset") game.ResetVeryRareEncounters(); else { string text = ""; for (IEnumerator list = game.VeryRareEncounters.GetEnumerator(); list.MoveNext();) text += Strings.VeryRareEncounters[(int)list.Current] + Environment.NewLine; text = text.Trim(); FormAlert.Alert(AlertType.Alert, this, "Remaining Very Rare Encounters", text); } break; case "Fame": game.Commander.ReputationScore = Math.Max(0, num1); break; case "Go": game.SelectedSystemName = second; if (game.SelectedSystem.Name.ToLower() == second.ToLower()) { if (game.AutoSave) SaveGame(SAVE_DEPARTURE, false); game.WarpDirect(); if (game.AutoSave) SaveGame(SAVE_ARRIVAL, false); } break; case "Ice": { switch (second) { case "Pirate": game.Commander.KillsPirate = Math.Max(0, num2); break; case "Police": game.Commander.KillsPolice = Math.Max(0, num2); break; case "Trader": game.Commander.KillsTrader = Math.Max(0, num2); break; } } break; case "Indemnity": game.Commander.NoClaim = Math.Max(0, num1); break; case "IOU": game.Commander.Debt = Math.Max(0, num1); break; case "Iron": if (num1 >= 0 && num1 < ship.Weapons.Length && num2 >= 0 && num2 < Consts.Weapons.Length) ship.Weapons[num1] = (Weapon)Consts.Weapons[num2].Clone(); break; case "Juice": ship.Fuel = Math.Max(0, Math.Min(ship.FuelTanks, num1)); break; case "Knack": if (num1 >= 0 && num1 < game.Mercenaries.Length) { string[] skills = third.Split(','); for (int i = 0; i < game.Mercenaries[num1].Skills.Length && i < skills.Length; i++) { if (Functions.IsInt(skills[i])) game.Mercenaries[num1].Skills[i] = Math.Max(1, Math.Min(Consts.MaxSkill, int.Parse(skills[i]))); } } break; case "L'Engle": game.FabricRipProbability = Math.Max(0, Math.Min(Consts.FabricRipInitialProbability, num1)); break; case "LifeBoat": ship.EscapePod = !ship.EscapePod; break; case "Monster.com": (new FormMonster()).ShowDialog(this); break; case "PlanB": game.AutoSave = true; break; case "Posse": if (num1 > 0 && num1 < ship.Crew.Length && num2 > 0 && num2 < game.Mercenaries.Length && !Consts.SpecialCrewMemberIds.Contains((CrewMemberId)num2)) { int skill = ship.Trader; ship.Crew[num1] = game.Mercenaries[num2]; if (ship.Trader != skill) game.RecalculateBuyPrices(game.Commander.CurrentSystem); } break; case "RapSheet": game.Commander.PoliceRecordScore = num1; break; case "Rarity": game.ChanceOfVeryRareEncounter = Math.Max(0, Math.Min(1000, num1)); break; case "Scratch": game.Commander.Cash = Math.Max(0, num1); break; case "Skin": ship.Hull = Math.Max(0, Math.Min(ship.HullStrength, num1)); break; case "Status": { switch (second) { case "Artifact": game.QuestStatusArtifact = Math.Max(0, num2); break; case "Dragonfly": game.QuestStatusDragonfly = Math.Max(0, num2); break; case "Experiment": game.QuestStatusExperiment = Math.Max(0, num2); break; case "Gemulon": game.QuestStatusGemulon = Math.Max(0, num2); break; case "Japori": game.QuestStatusJapori = Math.Max(0, num2); break; case "Jarek": game.QuestStatusJarek = Math.Max(0, num2); break; case "Moon": game.QuestStatusMoon = Math.Max(0, num2); break; case "Reactor": game.QuestStatusReactor = Math.Max(0, num2); break; case "Princess": game.QuestStatusPrincess = Math.Max(0, num2); break; case "Scarab": game.QuestStatusScarab = Math.Max(0, num2); break; case "Sculpture": game.QuestStatusSculpture = Math.Max(0, num2); break; case "SpaceMonster": game.QuestStatusSpaceMonster = Math.Max(0, num2); break; case "Wild": game.QuestStatusWild = Math.Max(0, num2); break; default: string text = "Artifact: " + game.QuestStatusArtifact.ToString() + Environment.NewLine + "Dragonfly: " + game.QuestStatusDragonfly.ToString() + Environment.NewLine + "Experiment: " + game.QuestStatusExperiment.ToString() + Environment.NewLine + "Gemulon: " + game.QuestStatusGemulon.ToString() + Environment.NewLine + "Japori: " + game.QuestStatusJapori.ToString() + Environment.NewLine + "Jarek: " + game.QuestStatusJarek.ToString() + Environment.NewLine + "Moon: " + game.QuestStatusMoon.ToString() + Environment.NewLine + "Princess: " + game.QuestStatusPrincess.ToString() + Environment.NewLine + "Reactor: " + game.QuestStatusReactor.ToString() + Environment.NewLine + "Scarab: " + game.QuestStatusScarab.ToString() + Environment.NewLine + "Sculpture: " + game.QuestStatusSculpture.ToString() + Environment.NewLine + "SpaceMonster: " + game.QuestStatusSpaceMonster.ToString() + Environment.NewLine + "Wild: " + game.QuestStatusWild.ToString(); FormAlert.Alert(AlertType.Alert, this, "Status of Quests", text); break; } } break; case "Swag": if (num1 >= 0 && num1 < ship.Cargo.Length) ship.Cargo[num1] = Math.Max(0, Math.Min(ship.FreeCargoBays + ship.Cargo[num1], num2)); break; case "Test": (new FormTest()).ShowDialog(this); break; case "Tool": if (num1 >= 0 && num1 < ship.Gadgets.Length && num2 >= 0 && num2 < Consts.Gadgets.Length) ship.Gadgets[num1] = (Gadget)Consts.Gadgets[num2].Clone(); break; case "Varmints": ship.Tribbles = Math.Max(0, num1); break; case "Yellow": game.EasyEncounters = true; break; default: find = true; break; } } else { switch (first) { case "Cheetah": FormAlert.Alert(AlertType.Cheater, this); game.CheatEnabled = true; break; default: find = true; break; } } if (find) { game.SelectedSystemName = form.SystemName; if (form.TrackSystem && game.SelectedSystem.Name.ToLower() == form.SystemName.ToLower()) game.TrackedSystemId = game.SelectedSystemId; } UpdateAll(); } }