private string SearchPlcncliTool(bool isSecondTry = false, bool showMessages = true) { string toolLocation = ToolLocationFinder.SearchPlcncliTool(optionPage); if (!string.IsNullOrEmpty(toolLocation)) { return(toolLocation); } if (isSecondTry) { if (showMessages) { _ = MessageBox.Show("PLCnCLI not found. PLCnext Technology Extension will not work properly. Set location in Tools->Options->PLCnext Technology."); } return(string.Empty); } if (showMessages) { _ = MessageBox.Show("PLCnCLI not found. Please enter correct location in Tools->Options->PLCnext Technology"); } if (_asyncServiceProvider is Package) { DTE2 dte = (DTE2)Package.GetGlobalService(typeof(DTE)); if (dte != null) { dte.ExecuteCommand("Tools.Options", "E0865D49-D384-4D95-89D5-A04B1D51EC43"); return(SearchPlcncliTool(true)); } } return(string.Empty); }
protected PlcncliTask() { PlcncliLocation = Environment.GetEnvironmentVariable("plcncli_toollocation"); if (string.IsNullOrEmpty(PlcncliLocation)) { PlcncliLocation = ToolLocationFinder.SearchPlcncliTool(null); if (string.IsNullOrEmpty(PlcncliLocation)) { throw new ArgumentException("PLCnCLI tool location could not be resolved."); } } Communication = new PlcncliProcessCommunication(null, PlcncliLocation); }