本文整理汇总了C#中MonoDevelop.Ide.ProgressMonitoring.MessageDialogProgressMonitor.ReportError方法的典型用法代码示例。如果您正苦于以下问题:C# MessageDialogProgressMonitor.ReportError方法的具体用法?C# MessageDialogProgressMonitor.ReportError怎么用?C# MessageDialogProgressMonitor.ReportError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Ide.ProgressMonitoring.MessageDialogProgressMonitor
的用法示例。
在下文中一共展示了MessageDialogProgressMonitor.ReportError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveSolutionItem
public void RemoveSolutionItem (SolutionItem item)
{
string question = GettextCatalog.GetString ("Do you really want to remove project '{0}' from '{1}'?", item.Name, item.ParentFolder.Name);
string secondaryText = GettextCatalog.GetString ("The Remove option remove the project from the solution, but it will not physically delete any file from disk.");
SolutionEntityItem prj = item as SolutionEntityItem;
if (prj == null) {
if (MessageService.Confirm (question, AlertButton.Remove) && IdeApp.Workspace.RequestItemUnload (item))
RemoveItemFromSolution (prj);
return;
}
AlertButton delete = new AlertButton (GettextCatalog.GetString ("Delete from Disk"));
AlertButton result = MessageService.AskQuestion (question, secondaryText,
delete, AlertButton.Cancel, AlertButton.Remove);
if (result == delete) {
if (!IdeApp.Workspace.RequestItemUnload (prj))
return;
ConfirmProjectDeleteDialog dlg = new ConfirmProjectDeleteDialog (prj);
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
// Remove the project before removing the files to avoid unnecessary events
RemoveItemFromSolution (prj);
List<FilePath> files = dlg.GetFilesToDelete ();
dlg.Destroy ();
using (IProgressMonitor monitor = new MessageDialogProgressMonitor (true)) {
monitor.BeginTask (GettextCatalog.GetString ("Deleting Files..."), files.Count);
foreach (FilePath file in files) {
try {
if (Directory.Exists (file))
FileService.DeleteDirectory (file);
else
FileService.DeleteFile (file);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("The file or directory '{0}' could not be deleted.", file), ex);
}
monitor.Step (1);
}
monitor.EndTask ();
}
} else
dlg.Destroy ();
}
else if (result == AlertButton.Remove && IdeApp.Workspace.RequestItemUnload (prj)) {
RemoveItemFromSolution (prj);
}
}
示例2: SwitchToBranch
public static void SwitchToBranch (GitRepository repo, string branch)
{
MessageDialogProgressMonitor monitor = new MessageDialogProgressMonitor (true, false, false, true);
try {
IdeApp.Workbench.AutoReloadDocuments = true;
IdeApp.Workbench.LockGui ();
System.Threading.ThreadPool.QueueUserWorkItem (delegate {
try {
repo.SwitchToBranch (monitor, branch);
} catch (Exception ex) {
monitor.ReportError ("Branch switch failed", ex);
} finally {
monitor.Dispose ();
}
});
monitor.AsyncOperation.WaitForCompleted ();
} finally {
IdeApp.Workbench.AutoReloadDocuments = false;
IdeApp.Workbench.UnlockGui ();
}
}
示例3: ApplyStash
public static Task<bool> ApplyStash (GitRepository repo, int s)
{
var monitor = new MessageDialogProgressMonitor (true, false, false, true);
var statusTracker = IdeApp.Workspace.GetFileStatusTracker ();
var t = Task.Run (delegate {
try {
var res = repo.ApplyStash (monitor, s);
ReportStashResult (res);
return true;
} catch (Exception ex) {
string msg = GettextCatalog.GetString ("Stash operation failed.");
monitor.ReportError (msg, ex);
return false;
}
finally {
monitor.Dispose ();
statusTracker.Dispose ();
}
});
return t;
}
示例4: SwitchToBranch
public async static Task<bool> SwitchToBranch (GitRepository repo, string branch)
{
var monitor = new MessageDialogProgressMonitor (true, false, false, true);
try {
IdeApp.Workbench.AutoReloadDocuments = true;
IdeApp.Workbench.LockGui ();
var t = await Task.Run (delegate {
try {
return repo.SwitchToBranch (monitor, branch);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Branch switch failed"), ex);
return false;
} finally {
monitor.Dispose ();
}
});
return t;
} finally {
IdeApp.Workbench.AutoReloadDocuments = false;
IdeApp.Workbench.UnlockGui ();
}
}
示例5: ApplyStash
public static IAsyncOperation ApplyStash (Stash s)
{
MessageDialogProgressMonitor monitor = new MessageDialogProgressMonitor (true, false, false, true);
var statusTracker = IdeApp.Workspace.GetFileStatusTracker ();
ThreadPool.QueueUserWorkItem (delegate {
try {
NGit.Api.MergeCommandResult result;
using (var gm = new GitMonitor (monitor))
result = s.Apply (gm);
ReportStashResult (monitor, result);
} catch (Exception ex) {
string msg = GettextCatalog.GetString ("Stash operation failed.");
monitor.ReportError (msg, ex);
}
finally {
monitor.Dispose ();
statusTracker.NotifyChanges ();
}
});
return monitor.AsyncOperation;
}
示例6: SwitchToBranch
public static void SwitchToBranch (GitRepository repo, string branch)
{
var monitor = new MessageDialogProgressMonitor (true, false, false, true);
try {
IdeApp.Workbench.AutoReloadDocuments = true;
IdeApp.Workbench.LockGui ();
Task.Run (delegate {
try {
repo.SwitchToBranch (monitor, branch);
} catch (Exception ex) {
monitor.ReportError ("Branch switch failed", ex);
} finally {
monitor.Dispose ();
}
}).Wait ();
} finally {
IdeApp.Workbench.AutoReloadDocuments = false;
IdeApp.Workbench.UnlockGui ();
}
}
示例7: ApplyStash
public static IAsyncOperation ApplyStash (GitRepository repo, int s)
{
var monitor = new MessageDialogProgressMonitor (true, false, false, true);
var statusTracker = IdeApp.Workspace.GetFileStatusTracker ();
ThreadPool.QueueUserWorkItem (delegate {
try {
ReportStashResult (repo.ApplyStash (monitor, s));
} catch (Exception ex) {
string msg = GettextCatalog.GetString ("Stash operation failed.");
monitor.ReportError (msg, ex);
}
finally {
monitor.Dispose ();
statusTracker.Dispose ();
}
});
return monitor.AsyncOperation;
}