public FindFileDock() { if (_instance == null) { _instance = this; } InitializeComponent(); this.TabText = Resources.FindResults; }
internal static void Inspect(string findWhat, int findFileCount, List<ObjectPair> findObjects) { if (_instance == null) { _instance = new FindFileDock(); _instance.Show(MainWindow.Instance.DockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom); } else { _instance.Show(); } _instance.SetResults(findWhat, findFileCount, findObjects); }
public FindFileDock() { if (_instance != null) { _instance.Close(); _instance = null; } _instance = this; InitializeComponent(); this.TabText = Resources.FindResults; }
internal static void Inspect(string findWhat, int findFileCount, List <ObjectPair> findObjects) { if (_instance != null) { _instance.Close(); _instance = null; } _instance = new FindFileDock(); _instance.Show(MainWindow.Instance.DockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom); _instance.SetResults(findWhat, findFileCount, findObjects); }
protected override void OnClosed(EventArgs e) { _instance = null; base.OnClosed(e); }
private void FindObject(string findWhat, FindRange findRange, bool matchCase, bool matchWholeWord, bool onlyByNodeType, bool onlyByNodeId, FindType findType) { if (string.IsNullOrEmpty(findWhat)) { return; } saveFindSettings(); try { List <Nodes.Node> rootNodes = GetRootNodes(findRange); List <ObjectPair> findObjects = new List <ObjectPair>(); if (!onlyByNodeType) { // by Id int id = int.MinValue; if (int.TryParse(findWhat, out id)) { foreach (Nodes.Node root in rootNodes) { DefaultObject obj = Plugin.GetObjectById(root, id); if (obj != null) { findObjects.Add(new ObjectPair(root, obj)); } } } } if (!onlyByNodeId) { // by Type foreach (Nodes.Node root in rootNodes) { root.GetObjectsByType(root, findWhat, matchCase, matchWholeWord, ref findObjects); } } if (!onlyByNodeId && !onlyByNodeType) { foreach (Nodes.Node root in rootNodes) { root.GetObjectsByPropertyMethod(root, findWhat, matchCase, matchWholeWord, ref findObjects); } } if (findObjects.Count > 0) { if (Plugin.CompareTwoObjectLists(_findObjects, findObjects)) { if (findType == FindType.Next) { _objectIndex++; if (_objectIndex >= findObjects.Count) { _objectIndex = 0; } } else if (findType == FindType.Previous) { _objectIndex--; if (_objectIndex < 0) { _objectIndex = findObjects.Count - 1; } } } else { _objectIndex = 0; _findObjects = findObjects; } if (findType == FindType.All) { FindFileDock.Inspect(findWhat, rootNodes.Count, findObjects); } else { ShowObject(findObjects[_objectIndex]); } return; } } catch (Exception) { } MessageBox.Show(Resources.FindWarningInfo, Resources.FindWarning, MessageBoxButtons.OK); }