public void AddQueryScript(Forms.MainAppWindow mainAppWindow, Models.QueryScript scriptToClone) { // Exit if script name already exists if (QueryScripts.Exists(x => x.Name == scriptToClone.Name)) { return; } Models.QueryScript queryScript = new Models.QueryScript(mainAppWindow: mainAppWindow, queryScriptToClone: scriptToClone); QueryScripts.Add(queryScript); queryScript.QueryScriptWindow.Show(); int index = AppData.GlobalAppData.QueryScripts.Count - 1; index = index % 20; queryScript.QueryScriptWindow.Location = new Point(index * 30, index * 30); queryScript.QueryScriptWindow.Focus(); }
public void AddQueryScript(string name, Forms.MainAppWindow mainAppWindow) { // Exit if script name already exists if (QueryScripts.Exists(x => x.Name == name)) { return; } Models.QueryScript queryScript = new Models.QueryScript(name: name, mainAppWindow: mainAppWindow); QueryScripts.Add(queryScript); queryScript.QueryScriptWindow.Show(); // Set position based on script count int scriptIndex = AppData.GlobalAppData.QueryScripts.Count - 1; int positionIndex = scriptIndex % 20; int position = positionIndex * 30; queryScript.QueryScriptWindow.Location = new Point(position, position); queryScript.QueryScriptWindow.Focus(); }