本文整理汇总了C#中MonoDevelop.Ide.Tasks.Task类的典型用法代码示例。如果您正苦于以下问题:C# Task类的具体用法?C# Task怎么用?C# Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Task类属于MonoDevelop.Ide.Tasks命名空间,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTask
public static void AddTask(string fileName, string message, int column, int line, TaskSeverity taskType)
{
// HACK: Use a compiler error since we cannot add an error
// task otherwise (task type property is read-only and
// no constructors usable).
BuildError error = new BuildError ();
error.Column = column;
error.Line = line;
error.ErrorText = message;
error.FileName = fileName;
error.IsWarning = false;
//Task task = new Task(fileName, message, column, line);
Task task = new Task (error);
TaskService.Errors.Add(task);
}
示例2: MessageBubbleTextMarker
public MessageBubbleTextMarker (TextEditor editor, Task task, LineSegment lineSegment, bool isError, string errorMessage)
{
this.editor = editor;
this.task = task;
this.IsVisible = true;
this.lineSegment = lineSegment;
this.initialText = editor.Document.GetTextAt (lineSegment);
this.Flags = TextMarkerFlags.DrawsSelection;
AddError (isError, errorMessage);
editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged;
errorPixbuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Error, Gtk.IconSize.Menu);
warningPixbuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
}
示例3: FindTask
static TreeIter FindTask (ListStore store, Task task)
{
TreeIter iter;
if (!store.GetIterFirst (out iter))
return TreeIter.Zero;
do {
Task t = store.GetValue (iter, (int)Columns.Task) as Task;
if (t == task)
return iter;
}
while (store.IterNext (ref iter));
return TreeIter.Zero;
}
示例4: RemoveGeneratedTask
void RemoveGeneratedTask (Task t)
{
TreeIter iter = FindTask (store, t);
if (!iter.Equals (TreeIter.Zero))
store.Remove (ref iter);
}
示例5: NewUserTaskClicked
void NewUserTaskClicked (object obj, EventArgs e)
{
Task task = new Task ();
task.WorkspaceObject = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem;
updating = true;
TaskService.UserTasks.Add (task);
updating = false;
TreeIter iter = store.AppendValues (GettextCatalog.GetString (Enum.GetName (typeof (TaskPriority), task.Priority)), task.Completed, task.Description, task, GetColorByPriority (task.Priority), task.Completed ? (int)Pango.Weight.Light : (int)Pango.Weight.Bold);
view.Selection.SelectIter (iter);
TreePath path = store.GetPath (iter);
view.ScrollToCell (path, view.Columns[(int)Columns.Description], true, 0, 0);
view.SetCursorOnCell (path, view.Columns[(int)Columns.Description], cellRendDesc, true);
TaskService.SaveUserTasks (task.WorkspaceObject);
}
示例6: AddError
public void AddError (Task task, bool isError, string errorMessage)
{
var match = mcsErrorFormat.Match (errorMessage);
if (match.Success)
errorMessage = match.Groups [1].Value;
errors.Add (new ErrorText (task, isError, errorMessage));
DisposeLayout ();
}
示例7: AddTaskInternal
void AddTaskInternal (Task t)
{
if (tasks.Contains (t)) return;
Gdk.Pixbuf stock;
switch (t.Severity) {
case TaskSeverity.Error:
stock = iconError;
errorCount++;
UpdateErrorsNum ();
break;
case TaskSeverity.Warning:
stock = iconWarning;
warningCount++;
UpdateWarningsNum ();
break;
default:
stock = iconInfo;
infoCount++;
UpdateMessagesNum ();
break;
}
tasks [t] = t;
store.AppendValues (stock, false, t);
}
示例8: SetText
static void SetText (CellRendererText textRenderer, TreeModel model, TreeIter iter, Task task, string text)
{
textRenderer.Text = text;
textRenderer.Weight = (int)((bool)model.GetValue (iter, DataColumns.Read) ? Pango.Weight.Normal : Pango.Weight.Bold);
textRenderer.Strikethrough = task.Completed;
}
示例9: MessageBubbleTextMarker
internal MessageBubbleTextMarker (MessageBubbleCache cache, Task task, LineSegment lineSegment, bool isError, string errorMessage)
{
this.cache = cache;
this.task = task;
this.IsVisible = true;
this.lineSegment = lineSegment;
this.initialText = editor.Document.GetTextAt (lineSegment);
this.Flags = TextMarkerFlags.DrawsSelection;
AddError (isError, errorMessage);
// cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
}
示例10: ErrorText
public ErrorText (Task task, bool isError, string errorMessage)
{
this.Task = task;
this.IsError = isError;
this.ErrorMessage = errorMessage;
}
示例11: SignPackageDone
void SignPackageDone (IProgressMonitor monitor, BuildResult result)
{
monitor.EndTask ();
if (result != null && result.Errors.Count > 0) {
var tasks = new Task [result.Errors.Count];
for (int n = 0; n < tasks.Length; n++) {
tasks [n] = new Task (result.Errors [n], this);
}
TaskService.Errors.AddRange (tasks);
TaskService.ShowErrors ();
}
monitor.Dispose ();
}
示例12: StyleCopCoreViolationEncountered
/// <summary>
/// Called when a violation is found.
/// </summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event arguments.</param>
internal static void StyleCopCoreViolationEncountered(object sender, ViolationEventArgs e)
{
Param.Ignore(sender, e);
// Check the violation count. At some point we don't allow any more violations so we cancel the analyze run.
if (e.SourceCode.Project.MaxViolationCount > 0 && styleCopAnalysisResultList.Count == e.SourceCode.Project.MaxViolationCount)
{
IdeApp.ProjectOperations.CancelStyleCopAnalysis();
}
string trimmedNamespace = e.Violation.Rule.Namespace;
string searchValue = global::StyleCop.Constants.ProductName + ".";
int indexOfProductName = trimmedNamespace.IndexOf(searchValue, StringComparison.Ordinal);
if (indexOfProductName != -1 && indexOfProductName < trimmedNamespace.Length - 1)
{
trimmedNamespace = trimmedNamespace.Substring(indexOfProductName + searchValue.Length);
int indexOfRulesString = trimmedNamespace.LastIndexOf("Rules", StringComparison.Ordinal);
trimmedNamespace = indexOfRulesString != -1 ? trimmedNamespace.Substring(0, indexOfRulesString) : trimmedNamespace;
}
else
{
trimmedNamespace = string.Empty;
}
string fileName = string.Empty;
if (e.Element != null)
{
fileName = e.Element.Document.SourceCode.Path;
}
else
{
if (e.SourceCode != null)
{
fileName = e.SourceCode.Path;
}
}
TaskSeverity severity = TaskSeverity.Error;
if (e.Warning || !e.SourceCode.Project.ViolationsAsErrors)
{
severity = TaskSeverity.Warning;
}
Task styleCopWarning = new Task(
fileName,
string.Concat(e.Violation.Rule.CheckId, " : ", trimmedNamespace, " : ", e.Message),
e.Location != null ? e.Location.Value.StartPoint.IndexOnLine : 1,
e.LineNumber,
severity,
TaskPriority.Normal,
ProjectUtilities.Instance.CachedProjects.GetProjectForFile(fileName),
ProjectOperationsExtensions.ownerObject);
styleCopAnalysisResultList.Add(styleCopWarning);
}
示例13: AddTaskInternal
void AddTaskInternal (Task t)
{
if (tasks.Contains (t)) return;
Xwt.Drawing.Image stock;
switch (t.Severity) {
case TaskSeverity.Error:
stock = iconError;
errorCount++;
UpdateErrorsNum ();
break;
case TaskSeverity.Warning:
stock = iconWarning;
warningCount++;
UpdateWarningsNum ();
break;
default:
stock = iconInfo;
infoCount++;
UpdateMessagesNum ();
break;
}
tasks [t] = t;
var indexOfNewLine = t.Description.IndexOfAny (new [] { '\n', '\r' });
if (indexOfNewLine != -1) {
var iter = store.AppendValues (stock, false, t, t.Description.Remove (indexOfNewLine));
store.AppendValues (iter, iconEmpty, false, null, t.Description);
} else {
store.AppendValues (stock, false, t, t.Description);
}
UpdatePadIcon ();
}
示例14: OnViolationEncountered
/// <summary>
/// Reports violations encountered by stylecop to the error pad
/// </summary>
/// <param name="sender">
/// A <see cref="System.Object"/> determining which object sends this violation
/// </param>
/// <param name="args">
/// A <see cref="ViolationEventArgs"/> determining elements composing the violation
/// </param>
private void OnViolationEncountered(object sender, ViolationEventArgs args)
{
try
{
MonoDevelop.Projects.BuildError b = new MonoDevelop.Projects.BuildError(args.Element.Document.SourceCode.Path, args.LineNumber, 0, args.Violation.Rule.CheckId, args.Message);
b.IsWarning = args.Warning;
Task errorTask = new Task(b, RunStyleCopHandler.styleCopAddinOwner);
this.errorPad.AddTask(errorTask);
}
catch (Exception e)
{
this.logger.WriteLine("Error: {0}\nStackTrace:{1}", e.Message, e.StackTrace);
}
}
示例15: GetPath
static string GetPath (Task task)
{
if (task.WorkspaceObject != null)
return FileService.AbsoluteToRelativePath (task.WorkspaceObject.BaseDirectory, task.FileName);
return task.FileName;
}