/// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary> /// <param term='commandName'>The name of the command to execute.</param> /// <param term='executeOption'>Describes how the command should be run.</param> /// <param term='varIn'>Parameters passed from the caller to the command handler.</param> /// <param term='varOut'>Parameters passed from the command handler to the caller.</param> /// <param term='handled'>Informs the caller if the command was handled or not.</param> /// <seealso class='Exec' /> public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled) { handled = false; if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault) { DTE2 dte = ServiceCache.ExtensibilityModel.DTE as DTE2; if (commandName == "MyAddin1.Connect.MyAddin1") { Document activeDocument = null; IScriptFactory scriptFactory = ServiceCache.ScriptFactory; if (scriptFactory != null) { scriptFactory.CreateNewBlankScript(ScriptType.Sql); activeDocument = dte.ActiveDocument; } if (activeDocument != null) { TextSelection ts = activeDocument.Selection as TextSelection; ts.Insert("This Query Window was created with our TestAddin.", (int)vsInsertFlags.vsInsertFlagsInsertAtStart); } handled = true; } if (commandName == "MyAddin1.Connect.MyAddin1ToolWindowForm") { Windows2 MyWindow = (Windows2)dte.Windows; Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); object MyControl = null; Window toolWindow = MyWindow.CreateToolWindow2(_addInInstance, asm.Location, "MyAddin1.MyAddinWindow", "MyAddin1.MyAddin1ToolWindowForm", "{5B7F8C1C-65B9-2aca-1Ac3-12AcBbAF21d5}", MyControl); toolWindow.Visible = true; handled = true; /*Assembly a = Assembly.GetExecutingAssembly(); * object controlObject = null; * * Windows2 toolWindows = dte.Windows as Windows2; * Window2 toolWindow; * * * toolWindow = (Window2)toolWindows.CreateToolWindow2(_addInInstance,a.Location, "MyAddin1.MyAddin1ToolWindowForm ", "", Guid.NewGuid().ToString(), ref controlObject); * * toolWindow.WindowState = vsWindowState.vsWindowStateNormal; * toolWindow.IsFloating = false; * toolWindow.Visible = true; * * handled = true;*/ } else { String s = varIn.ToString(); string s2 = varOut.ToString(); } } }
// Constructors // ============ public RegistryWorker(IScriptFactory <IScriptStorageModel> scriptFactory, IMessagePrompt messagePrompt, ISettings settings, IIconPicker iconPicker) { this.scriptFactory = scriptFactory; this.messagePrompt = messagePrompt; this.settings = settings; this.iconPicker = iconPicker; }
public GetInputScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IScript callbackScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_callbackScript = callbackScript; }
public OnReadyScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IScript callbackScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_callbackScript = callbackScript; }
private static void Build( IFolder root, string fullPath, IScriptFactory factory, List <IScript> scripts) { fullPath = fullPath == null ? root.Name : Path.Combine(fullPath, root.Name); var files = root .GetFiles() .Where(i => factory.IsSupported(i.Name)) .OrderBy(i => i.Name) .Select(factory.FromFile); foreach (var file in files) { file.DisplayName = Path.Combine(fullPath, file.DisplayName); scripts.Add(file); } var folders = root .GetFolders() .OrderBy(i => i.Name); foreach (var subFolder in folders) { Build(subFolder, fullPath, factory, scripts); } }
public WhileScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction<bool> expression, IScript loopScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_expression = expression; m_loopScript = loopScript; }
public static void AddOtherwiseScript(IScript firstTimeScript, string script, IScriptFactory scriptFactory) { // Get script after "otherwise" keyword script = script.Substring(9).Trim(); string otherwise = Utility.GetScript(script); IScript otherwiseScript = scriptFactory.CreateScript(otherwise); ((FirstTimeScript)firstTimeScript).SetOtherwiseScript(otherwiseScript); }
public ShowMenuScript(IScriptFactory scriptFactory, IFunction caption, IFunction options, IFunction allowCancel, IScript callbackScript) { m_scriptFactory = scriptFactory; m_caption = caption; m_options = options; m_allowCancel = allowCancel; m_callbackScript = callbackScript; }
public AskScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction<string> caption, IScript callbackScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_caption = caption; m_callbackScript = callbackScript; }
public WhileScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction <bool> expression, IScript loopScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_expression = expression; m_loopScript = loopScript; }
public AskScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction <string> caption, IScript callbackScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_caption = caption; m_callbackScript = callbackScript; }
public ForScript(IScriptFactory scriptFactory, string variable, IFunction from, IFunction to, IScript loopScript, IFunction step) { m_scriptFactory = scriptFactory; m_variable = variable; m_from = from; m_to = to; m_loopScript = loopScript; m_step = step; }
public ForScript(WorldModel worldModel, IScriptFactory scriptFactory, string variable, IFunction<int> from, IFunction<int> to, IScript loopScript) { m_worldModel = worldModel; m_scriptFactory = scriptFactory; m_variable = variable; m_from = from; m_to = to; m_loopScript = loopScript; }
public ForScript(ScriptContext scriptContext, IScriptFactory scriptFactory, string variable, IFunction <int> from, IFunction <int> to, IScript loopScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_variable = variable; m_from = from; m_to = to; m_loopScript = loopScript; }
public ShowMenuScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction<string> caption, IFunctionGeneric options, IFunction<bool> allowCancel, IScript callbackScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_caption = caption; m_options = options; m_allowCancel = allowCancel; m_callbackScript = callbackScript; }
public ShowMenuScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction <string> caption, IFunctionGeneric options, IFunction <bool> allowCancel, IScript callbackScript) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_scriptFactory = scriptFactory; m_caption = caption; m_options = options; m_allowCancel = allowCancel; m_callbackScript = callbackScript; }
public MergeSprocsService( ILogger <MergeSprocsService> logger, IDataAccess dataAccess, IScriptFactory scriptFactory, IDatabaseStructure databaseStructure) { this.logger = logger; _databaseStructure = databaseStructure; _dataAccess = dataAccess; _scriptFactory = scriptFactory; }
public MergeScriptGenerator( ILogger <MergeScriptGenerator> logger, IDataAccess dataAccess, IDatabaseStructure databaseStructure, IScriptVariableFactory scriptVariableFactory, IScriptFactory scriptFactory) { _logger = logger; _databaseStructure = databaseStructure; _dataAccess = dataAccess; _scriptFactory = scriptFactory; _scriptVariableFactory = scriptVariableFactory; }
//internal static string GetConnectionStringForCurrentNode() //{ // var objectExplorerNode = NodeManager.CurrentNode as IOeNode; // IConnectionInfo ci = null; // if (objectExplorerNode != null // && objectExplorerNode.HasConnection // && objectExplorerNode.TryGetConnection(out ci)) // { // var builder = new SqlConnectionStringBuilder(ci.ConnectionString); // return builder.ConnectionString; // } // throw new InvalidOperationException("No selected db node or other problem..."); //} public static string GetConnectionStringForCurrentWindow() { IScriptFactory scriptFactory = ServiceCache.ScriptFactory; if (scriptFactory != null) { return(GetConnectionString(scriptFactory.CurrentlyActiveWndConnectionInfo.UIConnectionInfo)); } else { throw new InvalidOperationException("ServiceCache.ScriptFactory is null. This usually happens when wrong assemblies have been referenced."); } }
public ScriptService(IScriptFactory scriptFactory, _DTE dte) { if (scriptFactory == null) { throw new ArgumentNullException("scriptFactory"); } if (dte == null) { throw new ArgumentNullException("dte"); } _scriptFactory = scriptFactory; _dte = dte; }
public FlubuSession( ILogger <FlubuSession> log, TargetTree targetTree, CommandArguments args, IScriptFactory scriptFactory, ITaskFactory taskFactory, IFluentInterfaceFactory fluentFactory, IBuildPropertiesSession properties, IBuildSystem buildServers) : base(log, properties, args, targetTree, buildServers, taskFactory, fluentFactory) { HasFailed = true; ScriptFactory = scriptFactory; }
public ServerConnectionService(IScriptFactory scriptFactory, IObjectExplorerService objectExplorerService) { if (scriptFactory == null) { throw new ArgumentNullException("scriptFactory"); } if (objectExplorerService == null) { throw new ArgumentNullException("objectExplorerService"); } _scriptFactory = scriptFactory; _objectExplorerService = objectExplorerService; }
private void SetupKernel() { using (var kernel = CreateKernel()) { m_ObjectStore = kernel.Get <IObjectStore>(); m_Log = kernel.Get <ILoggerFactory>().GetCurrentClassLogger(); m_ScriptFactory = kernel.Get <IScriptFactory>(); m_ParameterFactory = kernel.Get <IParameterFactory>(); if (DirtyRangeFlagger.IsEnabled()) { m_DirtyRangeFlagger = kernel.Get <DirtyRangeFlagger>(); } } }
public IResultGrid GetFocusedResultGrid() { BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance; IScriptFactory scriptFactor = ServiceCache.ScriptFactory; IVsMonitorSelection monitorSelection = ServiceCache.VSMonitorSelection; object editorControl = ServiceCache.ScriptFactory .GetType() .GetMethod("GetCurrentlyActiveFrameDocView", bindingFlags) .Invoke(scriptFactor, new object[] { monitorSelection, false, null }); FieldInfo resultControlField = editorControl.GetType() .GetField("m_sqlResultsControl", bindingFlags); if (resultControlField == null) { return(null); } object resultsControl = resultControlField.GetValue(editorControl); object resultsTabPage = resultsControl .GetType() .GetField("m_gridResultsPage", bindingFlags) .GetValue(resultsControl); IGridControl grid = (IGridControl)resultsTabPage .GetType() .BaseType .GetProperty("FocusedGrid", bindingFlags) .GetValue(resultsTabPage, null); if (grid == null) { return(null); } return(new ResultGrid(grid)); }
/// <summary> /// ��ʼ���ű����л��� /// </summary> /// <param name="factory">The factory.</param> private void InitScript(IScriptFactory factory) { var objs = new List<Type> { typeof(IUser), typeof(IScriptFactory), typeof(IEncrypt), typeof(IScriptFactory), GetType() }; var runtime = factory.CreateIronRubyRuntime(objs, true, false); ScriptEngine = runtime.GetEngine("ruby"); ScriptScope = ScriptEngine.CreateScope(); }
/// <summary> /// Initializes a new instance of the <see cref="AuthorizationFactory"/> class. /// </summary> /// <param name="service">The service.</param> /// <param name="eventAggregator">The event aggregator.</param> /// <param name="scriptFactory">The script factory.</param> public AuthorizationFactory(IAuthorityService service, IEventAggregator eventAggregator, IScriptFactory scriptFactory) { InitScript(scriptFactory); AuthorityService = service; ReloadSecurityAction(new List<SecurityActionResource>()); EventAggregator = eventAggregator; EventAggregator.Subscribe<RoleChangedEvent>(a => { if (_log.IsDebugEnabled) _log.Debug("����ɫ�仯�¼�" + a.Target); ReloadRole(); }); ReloadRole(); }
public OnReadyScript(IScriptFactory scriptFactory, IScript callbackScript) { m_scriptFactory = scriptFactory; m_callbackScript = callbackScript; }
public ForScript(IScriptFactory scriptFactory, string variable, IFunction from, IFunction to, IScript loopScript) : this(scriptFactory, variable, from, to, loopScript, null) { }
public ForScript(ScriptContext scriptContext, IScriptFactory scriptFactory, string variable, IFunction<int> from, IFunction<int> to, IFunction<int> step, IScript loopScript) : this(scriptContext, scriptFactory, variable, from, to, loopScript) { m_step = step; }
public ScriptFactoryWrapper(IScriptFactory obj) : base(obj) { }
public WaitScript(IScriptFactory scriptFactory, IScript callbackScript) { m_scriptFactory = scriptFactory; m_callbackScript = callbackScript; }
public GetInputScript(IScriptFactory scriptFactory, IScript callbackScript) { m_scriptFactory = scriptFactory; m_callbackScript = callbackScript; }
public SetScriptScript(SetScriptConstructor constructor, ScriptContext scriptContext, IFunction<Element> appliesTo, string property, IScript script) : base(constructor, scriptContext, appliesTo, property) { m_script = script; m_scriptFactory = constructor.ScriptFactory; }
public ForScript(ScriptContext scriptContext, IScriptFactory scriptFactory, string variable, IFunction <int> from, IFunction <int> to, IFunction <int> step, IScript loopScript) : this(scriptContext, scriptFactory, variable, from, to, loopScript) { m_step = step; }
/// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary> /// <param term='commandName'>The name of the command to execute.</param> /// <param term='executeOption'>Describes how the command should be run.</param> /// <param term='varIn'>Parameters passed from the caller to the command handler.</param> /// <param term='varOut'>Parameters passed from the command handler to the caller.</param> /// <param term='handled'>Informs the caller if the command was handled or not.</param> /// <seealso class='Exec' /> public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled) { handled = false; if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault) { //ext.Documents.Add(); //ext.Documents.Add(ext.ActiveDocument.Kind.ToString().Replace("{", "").Replace("}", "")); //ext.WindowConfigurations.Add("test window"); //ext.ExecuteCommand("QueryDesigner.Select"); //ext.ExecuteCommand("QueryDesigner.SQL"); //ext.ExecuteCommand("QueryDesigner.ExecuteSQL"); if (commandName == "SSMSAddin.Connect.ViewReferencedValue") { var sqlParser = new SimpleSqlParser(); var ext = ((DTE2)ServiceCache.ExtensibilityModel); IScriptFactory scriptFactory = ServiceCache.ScriptFactory; var window = (Window)ext.ActiveWindow; var scriptWindow = _windowExtensions.ContainsKey(window) ? _windowExtensions[window] : null; var values = scriptWindow?.GetSelectedValues(); foreach (var val in values.Where(v => v?.Values?.Count > 0)) { var s = scriptFactory.CreateNewBlankScript(ScriptType.Sql, scriptFactory.CurrentlyActiveWndConnectionInfo.UIConnectionInfo, null); Document document = ext.ActiveDocument; if (document != null) { var sql = scriptWindow.GetQuery(); var table = sqlParser.GetTableFromSql(sql, val.ColumnName); var split = table.Split('.'); var schema = "dbo"; if (split.Length == 3) { schema = split[1].Replace("[", "").Replace("]", ""); table = split[2].Replace("[", "").Replace("]", ""); } else if (split.Length == 2) { schema = split[0].Replace("[", "").Replace("]", ""); table = split[1].Replace("[", "").Replace("]", ""); } else if (split.Length == 1) { table = split[0].Replace("[", "").Replace("]", ""); } var sqlToGetReferences = $@" SELECT S2.name AS SchemaName, T2.name AS TableName, C2.name AS ColumnName FROM sys.tables T JOIN sys.schemas S ON S.schema_id = T.schema_id JOIN sys.columns C ON C.object_id = T.object_id JOIN sys.foreign_key_columns FK ON FK.parent_object_id = T.object_id AND FK.parent_column_id = C.column_id JOIN sys.tables T2 ON T2.object_id = FK.referenced_object_id JOIN sys.columns C2 ON C2.object_id = T2.object_id AND C2.column_id = FK.referenced_column_id JOIN sys.schemas S2 ON S2.schema_id = T2.schema_id WHERE T.name = '{table}' AND S.name = '{schema}' AND C.name = '{val.ColumnName}' "; var conInfo = scriptFactory.CurrentlyActiveWndConnectionInfo.UIConnectionInfo; SqlCommand cmd = new SqlCommand(sqlToGetReferences, new SqlConnection($"Server={conInfo.ServerNameNoDot};Database={conInfo.AdvancedOptions["DATABASE"]};Trusted_Connection=True;")); cmd.Connection.Open(); var referencedTable = string.Empty; var referencedSchema = string.Empty; var referencedColumn = string.Empty; using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { referencedSchema = (string)reader["SchemaName"]; referencedTable = (string)reader["TableName"]; referencedColumn = (string)reader["ColumnName"]; } } cmd.Connection.Close(); //replace currently selected text if (!string.IsNullOrEmpty(referencedSchema) && !string.IsNullOrEmpty(referencedTable) && !string.IsNullOrEmpty(referencedColumn)) { TextSelection selection = (TextSelection)document.Selection; selection.Insert($"SELECT * FROM [{referencedSchema}].[{referencedTable}] WHERE [{referencedColumn}] {val?.WhereClause()}", (Int32)EnvDTE.vsInsertFlags.vsInsertFlagsContainNewText); ext.ExecuteCommand("Query.Execute"); } } } handled = true; return; } } }
public SetScriptScript(SetScriptConstructor constructor, IFunction appliesTo, string property, IScript script, GameLoader loader) : base(constructor, appliesTo, property, loader) { m_script = script; m_scriptFactory = constructor.ScriptFactory; }
public AskScript(IScriptFactory scriptFactory, IFunction caption, IScript callbackScript) { m_scriptFactory = scriptFactory; m_caption = caption; m_callbackScript = callbackScript; }
public WaitScript(WorldModel worldModel, IScriptFactory scriptFactory, IScript callbackScript) { m_worldModel = worldModel; m_scriptFactory = scriptFactory; m_callbackScript = callbackScript; }
public SetScriptScript(SetScriptConstructor constructor, ScriptContext scriptContext, IFunction <Element> appliesTo, string property, IScript script) : base(constructor, scriptContext, appliesTo, property) { m_script = script; m_scriptFactory = constructor.ScriptFactory; }
public FirstTimeScript(WorldModel worldModel, IScriptFactory scriptFactory, IScript firstTimeScript) { m_worldModel = worldModel; m_scriptFactory = scriptFactory; m_firstTimeScript = firstTimeScript; }