public Task(TaskManager taskManager , string description, string tipText, string code, string helpKeyword , TaskPriority priority, TaskCategory category, TaskMarker markerType , Location loc , ITaskCommands commands ) { this.taskManager = taskManager; this.code = code; this.description = description; this.tipText = ((tipText == null || tipText.Length == 0) ? description : tipText); this.helpKeyword = helpKeyword; this.priority = priority; this.category = category; this.markerType = markerType; this.commands = commands; location = (loc == null ? new Location(null, null) : loc); initLoc = location.Clone(); persistLoc = location.Clone(); // isChecked = false; // isDeleted = false; // marker = null; // Create markers if the document is already opened. IVsTextLines textLines = location.GetTextLines(false); if (textLines != null) { OnOpenFile(textLines, false); } }
public Task( TaskManager taskManager , string description, string tipText, string code, string helpKeyword , TaskPriority priority, TaskCategory category, TaskMarker markerType , Location loc , ITaskCommands commands ) { this.taskManager = taskManager; this.code = code; this.description = description; this.tipText = ((tipText == null || tipText.Length == 0) ? description : tipText); this.helpKeyword = helpKeyword; this.priority = priority; this.category = category; this.markerType = markerType; this.commands = commands; this.location = (loc == null ? new Location(null, null) : loc); this.initLoc = this.location.Clone(); this.persistLoc = this.location.Clone(); // isChecked = false; // isDeleted = false; // marker = null; // Create markers if the document is already opened. IVsTextLines textLines = this.location.GetTextLines(false); if (textLines != null) { OnOpenFile(textLines); } }
public void Release() { // Called from "OnDelete" // task list makes sure it doesn't show up // and we remove it later when an enumeration is asked. isDeleted = true; if (marker != null) { marker.Invalidate(); marker = null; } if (commands != null) { commands.Dispose(); commands = null; } userContext = null; taskManager = null; if (location != null) { location.Dispose(); location = null; } if (persistLoc != null) { persistLoc.Dispose(); persistLoc = null; } if (initLoc != null) { initLoc.Dispose(); initLoc = null; } }
public void AddTask(string description, string tipText, string code, string helpKeyword , TaskPriority priority, TaskCategory category , TaskMarker marker, Guid outputPane , string projectName , string fileName, int startLine, int startColumn, int endLine, int endColumn , ITaskCommands commands ) { // Add a new task Location span = new Location(projectName, fileName, startLine, startColumn, endLine, endColumn); Task task = new Task(this , description, tipText, code, helpKeyword , priority, category, marker , span , commands); tasks.Add(task); // show standard error in the build output pane if (outputPane != TaskOutputPane.None && description != null) { string kind; switch (category) { case TaskCategory.Error: kind = "error "; break; case TaskCategory.Warning: kind = "warning "; break; case TaskCategory.Message: kind = "message "; break; default: kind = ""; break; } OutputString(span + ": " + kind + (code != null ? code : "") + ": " + description + "\n", outputPane); } }
public void AddTask(string description, string tipText, string code, string helpKeyword ,TaskPriority priority, TaskCategory category ,TaskMarker marker, Guid outputPane ,string projectName ,string fileName, int startLine, int startColumn, int endLine, int endColumn ,ITaskCommands commands ) { // Add a new task Location span = new Location(projectName,fileName, startLine, startColumn, endLine, endColumn); Task task = new Task(this ,description, tipText, code, helpKeyword ,priority, category, marker ,span ,commands); tasks.Add(task); // show standard error in the build output pane if (outputPane != TaskOutputPane.None && description != null) { string kind; switch (category) { case TaskCategory.Error: kind = "error "; break; case TaskCategory.Warning: kind = "warning "; break; case TaskCategory.Message: kind = "message "; break; default: kind = ""; break; } OutputString(span + ": " + kind + (code != null ? code : "") + ": " + description + "\n", outputPane); } }
// Due to the RPC mechanism in VS2012 sometimes the commands object // is no longer accessible. To guard against crashes we wrap all calls // to the commands object in a try-catch wrapper private A WithCommands <A>(A def, Func <A> action) { if (commands == null) { return(def); } try { return(action()); } catch (Exception exn) { Common.Log("Task.SafeCommands exception:\n" + exn.ToString()); if (commands != null) { try { commands.Dispose(); } catch { /* disregard further errors */ } commands = null; } return(def); } }
public TasksController(ITaskCommands taskCommands, ISecurityService securityService) { _taskCommands = taskCommands; _userId = securityService.GetCurrentUserId(); }