本文整理汇总了C#中MonoDevelop.Ide.AlertButton类的典型用法代码示例。如果您正苦于以下问题:C# AlertButton类的具体用法?C# AlertButton怎么用?C# AlertButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlertButton类属于MonoDevelop.Ide命名空间,在下文中一共展示了AlertButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewWebReference
public void NewWebReference()
{
// Get the project and project folder
DotNetProject project = CurrentNode.GetParentDataItem (typeof(DotNetProject), true) as DotNetProject;
// Check and switch the runtime environment for the current project
if (project.TargetFramework.Id == TargetFrameworkMoniker.NET_1_1)
{
string question = "The current runtime environment for your project is set to version 1.0.";
question += "Web Service is not supported in this version.";
question += "Do you want switch the runtime environment for this project version 2.0 ?";
AlertButton switchButton = new AlertButton ("_Switch to .NET2");
if (MessageService.AskQuestion(question, AlertButton.Cancel, switchButton) == switchButton)
project.TargetFramework = Runtime.SystemAssemblyService.GetTargetFramework (TargetFrameworkMoniker.NET_2_0);
else
return;
}
WebReferenceDialog dialog = new WebReferenceDialog (project);
dialog.NamespacePrefix = project.DefaultNamespace;
try {
if (MessageService.RunCustomDialog (dialog) == (int)Gtk.ResponseType.Ok) {
dialog.SelectedService.GenerateFiles (project, dialog.Namespace, dialog.ReferenceName);
IdeApp.ProjectOperations.Save(project);
}
}
catch(Exception exception) {
MessageService.ShowException (exception);
} finally {
dialog.Destroy ();
}
}
示例2: MapResultToFileConflictResolution
FileConflictResolution MapResultToFileConflictResolution(AlertButton result)
{
if (result == AlertButton.Yes) {
return FileConflictResolution.Overwrite;
} else if (result == YesToAllButton) {
return FileConflictResolution.OverwriteAll;
} else if (result == NoToAllButton) {
return FileConflictResolution.IgnoreAll;
} else {
return FileConflictResolution.Ignore;
}
}
示例3: TakeSnapshot
public override void TakeSnapshot ()
{
AlertButton button = new AlertButton (GettextCatalog.GetString ("Terminate"));
bool terminate = MessageService.Confirm (
GettextCatalog.GetString ("Heap-Buddy requires the application to terminate cleanly.\nAre you sure you want to terminate the application (this might result in the loss of some profiling data)?")
, button
);
if (terminate) {
lock (sync) {
State = ProfilerState.TakingSnapshot;
System.Diagnostics.Process.Start ("kill", "-PROF " + Context.AsyncOperation.ProcessId);
ThreadPool.QueueUserWorkItem (new WaitCallback (AsyncTakeSnapshot));
}
}
}
示例4: Migrate
public bool Migrate (MSBuildProject project, string fileName, string language)
{
var buttonBackupAndMigrate = new AlertButton (GettextCatalog.GetString ("Back up and migrate"));
var buttonMigrate = new AlertButton (GettextCatalog.GetString ("Migrate"));
var buttonIgnore = new AlertButton (GettextCatalog.GetString ("Ignore"));
var response = MessageService.AskQuestion (
GettextCatalog.GetString ("Migrate MonoMac Project?"),
GettextCatalog.GetString (
"The MonoMac project '{0}' must be migrated to a new format. " +
"After migration, it will not be able to be opened in " +
"older versions of MonoDevelop.\n\n" +
"If you choose to back up the project before migration, a copy of the project " +
"file will be saved in a 'backup' directory in the project directory.", Path.GetFileNameWithoutExtension (fileName)),
buttonIgnore, buttonMigrate, buttonBackupAndMigrate);
if (response == buttonIgnore)
return false;
FilePath baseDir = Path.GetDirectoryName (fileName);
bool backup = response == buttonBackupAndMigrate;
if (backup) {
var backupDirFirst = baseDir.Combine ("backup");
string backupDir = backupDirFirst;
int i = 0;
while (Directory.Exists (backupDir)) {
backupDir = backupDirFirst + "-" + i.ToString ();
if (i > 20) {
throw new Exception ("Too many backup directories");
}
}
Directory.CreateDirectory (backupDir);
File.Copy (fileName, Path.Combine (backupDir, Path.GetFileName (fileName)));
}
// Migrate 'Page' build action to 'InterfaceDefinition' (see Bug 147 - XIB files need Build Action other than Page)
// NOTE: Work around mono bug by calling ToList() before iterating: http://bugzilla.xamarin.com/show_bug.cgi?id=520
foreach (var item in project.GetAllItems ().Where (item => item.Name == "Page").ToList ()) {
var newElement = project.doc.CreateElement (BuildAction.InterfaceDefinition);
newElement.InnerXml = item.Element.InnerXml;
foreach (System.Xml.XmlAttribute attribute in item.Element.Attributes)
newElement.SetAttribute (attribute.Name, attribute.Value);
item.Element.ParentNode.ReplaceChild (newElement, item.Element);
}
return true;
}
示例5: Publish
public static bool Publish (IWorkspaceObject entry, FilePath localPath, bool test)
{
if (test)
return true;
if (!VersionControlService.CheckVersionControlInstalled ())
return false;
List<FilePath> files = new List<FilePath> ();
// Build the list of files to be checked in
string moduleName = entry.Name;
if (localPath == entry.BaseDirectory) {
GetFiles (files, entry);
} else if (entry is Project) {
foreach (ProjectFile file in ((Project)entry).Files.GetFilesInPath (localPath))
if (file.Subtype != Subtype.Directory)
files.Add (file.FilePath);
} else
return false;
if (files.Count == 0)
return false;
SelectRepositoryDialog dlg = new SelectRepositoryDialog (SelectRepositoryMode.Publish);
try {
dlg.ModuleName = moduleName;
dlg.Message = GettextCatalog.GetString ("Initial check-in of module {0}", moduleName);
do {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok && dlg.Repository != null) {
AlertButton publishButton = new AlertButton ("_Publish");
if (MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to publish the project?"), GettextCatalog.GetString ("The project will be published to the repository '{0}', module '{1}'.", dlg.Repository.Name, dlg.ModuleName), AlertButton.Cancel, publishButton) == publishButton) {
PublishWorker w = new PublishWorker (dlg.Repository, dlg.ModuleName, localPath, files.ToArray (), dlg.Message);
w.Start ();
break;
}
} else
break;
} while (true);
} finally {
dlg.Destroy ();
}
return true;
}
示例6: Run
protected override void Run ()
{
System.Threading.ThreadPool.QueueUserWorkItem (delegate {
// Process cached crash reports if there are any and uploading is enabled
LogReportingService.ProcessCache ();
});
// Attach a handler for when exceptions need to be processed
LogReportingService.UnhandledErrorOccured = (enabled, ex, willShutdown) => {
var doNotSend = new AlertButton (GettextCatalog.GetString ("Do _Not Send"));
var sendOnce = new AlertButton (GettextCatalog.GetString ("_Send This Time"));
var alwaysSend = new AlertButton (GettextCatalog.GetString ("_Always Send"));
AlertButton[] buttons = null;
string message = null;
string title = willShutdown
? GettextCatalog.GetString ("A fatal error has occurred")
: GettextCatalog.GetString ("An error has occurred");
if (!ShouldPromptToOptIn && enabled.GetValueOrDefault ()) {
message = GettextCatalog.GetString (
"Details of this error have been automatically sent to Xamarin for analysis.");
if (willShutdown) {
message += GettextCatalog.GetString (" {0} will now close.", BrandingService.ApplicationName);
}
MessageService.ShowException (ex, message, title, AlertButton.Ok);
return enabled;
}
message = GettextCatalog.GetString (
"Details of errors, along with anonymous installation information, can be sent to Xamarin to " +
"help improve {0}. Do you wish to send this information?", BrandingService.ApplicationName);
var result = MessageService.ShowException (ex, message, title, doNotSend, sendOnce, alwaysSend);
if (result == sendOnce) {
return null;
} else if (result == alwaysSend) {
return true;
} else {
return false;
}
};
}
示例7: GenerateMakefiles
internal static void GenerateMakefiles (SolutionItem entry, Solution solution)
{
if (solution == null) {
AlertButton generateMakefilesButton = new AlertButton (GettextCatalog.GetString ("_Generate Makefiles"));
if (MessageService.AskQuestion (GettextCatalog.GetString ("Generating Makefiles is not supported for single projects. Do you want to generate them for the full solution - '{0}' ?", entry.ParentSolution.Name),
AlertButton.Cancel,
generateMakefilesButton) == generateMakefilesButton)
solution = ((SolutionItem)entry).ParentSolution;
else
return;
}
DeployContext ctx = null;
IProgressMonitor monitor = null;
GenerateMakefilesDialog dialog = new GenerateMakefilesDialog (solution);
try {
if (MessageService.RunCustomDialog (dialog) != (int) Gtk.ResponseType.Ok)
return;
SolutionDeployer deployer = new SolutionDeployer (dialog.GenerateAutotools);
if ( deployer.HasGeneratedFiles ( solution ) )
{
string msg = GettextCatalog.GetString ( "{0} already exist for this solution. Would you like to overwrite them?", dialog.GenerateAutotools ? "Autotools files" : "Makefiles" );
if (MonoDevelop.Ide.MessageService.AskQuestion (msg, AlertButton.Cancel, AlertButton.OverwriteFile) != AlertButton.OverwriteFile)
return;
}
ctx = new DeployContext (new TarballDeployTarget (dialog.GenerateAutotools), "Linux", null);
monitor = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (true);
deployer.GenerateFiles (ctx, solution, dialog.DefaultConfiguration, monitor);
} finally {
dialog.Destroy ();
dialog.Dispose ();
if (ctx != null)
ctx.Dispose ();
if (monitor != null)
monitor.Dispose ();
}
}
示例8: CheckGtkVersion
//Mac GTK+ is unstable, even between micro releases
static void CheckGtkVersion (uint major, uint minor, uint micro)
{
string url = "http://www.go-mono.com/mono-downloads/download.html";
// to require exact version, also check : || Gtk.Global.CheckVersion (major, minor, micro + 1) == null
if (Gtk.Global.CheckVersion (major, minor, micro) != null) {
MonoDevelop.Core.LoggingService.LogFatalError ("GTK+ version is incompatible with required version {0}.{1}.{2}.", major, minor, micro);
AlertButton downloadButton = new AlertButton ("Download...", null);
if (downloadButton == MessageService.GenericAlert (
Stock.Error,
"Incompatible Mono Framework Version",
"MonoDevelop requires a newer version of the Mono Framework.",
new AlertButton ("Cancel", null), downloadButton))
{
OpenUrl (url);
}
Environment.Exit (1);
}
}
示例9: Run
protected override void Run ()
{
// Attach a handler for when exceptions need to be processed
LoggingService.UnhandledErrorOccured = (enabled, ex, willShutdown) => {
var doNotSend = new AlertButton (GettextCatalog.GetString ("Do _Not Send"));
var sendOnce = new AlertButton (GettextCatalog.GetString ("_Send This Time"));
var alwaysSend = new AlertButton (GettextCatalog.GetString ("_Always Send"));
string message = null;
string title = willShutdown
? GettextCatalog.GetString ("A fatal error has occurred")
: GettextCatalog.GetString ("An error has occurred");
if (!ShouldPromptToOptIn && enabled.GetValueOrDefault ()) {
if (willShutdown) {
message = GettextCatalog.GetString (
"Details of this error have been automatically sent to Xamarin for analysis.");
message += GettextCatalog.GetString (" {0} will now close.", BrandingService.ApplicationName);
MessageService.ShowError (null, title, message, ex, false, AlertButton.Ok);
}
return enabled;
}
message = GettextCatalog.GetString (
"Details of errors, along with anonymous installation information, can be sent to Xamarin to " +
"help improve {0}. Do you wish to send this information?", BrandingService.ApplicationName);
var result = MessageService.ShowError (null, title, message, ex, false, doNotSend, sendOnce, alwaysSend);
if (result == sendOnce) {
return null;
} else if (result == alwaysSend) {
return true;
} else {
return false;
}
};
}
示例10: Confirm
public static bool Confirm (string primaryText, AlertButton button, bool confirmIsDefault)
{
return Confirm (primaryText, null, button, confirmIsDefault);
}
示例11: CheckBeforeDebugging
internal static CheckResult CheckBeforeDebugging (IBuildTarget target)
{
if (IdeApp.Preferences.BuildBeforeExecuting)
return CheckResult.BuildBeforeRun;
if (!target.NeedsBuilding (IdeApp.Workspace.ActiveConfiguration))
return CheckResult.Run;
AlertButton bBuild = new AlertButton (GettextCatalog.GetString ("Build"));
AlertButton bRun = new AlertButton (Gtk.Stock.Execute, true);
AlertButton res = MessageService.AskQuestion (
GettextCatalog.GetString ("Outdated Debug Information"),
GettextCatalog.GetString ("The project you are executing has changes done after the last time it was compiled. The debug information may be outdated. Do you want to continue?"),
2,
AlertButton.Cancel,
bBuild,
bRun);
// This call is a workaround for bug #6907. Without it, the main monodevelop window is left it a weird
// drawing state after the message dialog is shown. This may be a gtk/mac issue. Still under research.
DispatchService.RunPendingEvents ();
if (res == AlertButton.Cancel)
return CheckResult.Cancel;
if (res == bRun)
return CheckResult.Run;
return CheckResult.BuildBeforeRun;
}
示例12: OnDropView
protected void OnDropView ()
{
ViewNode node = (ViewNode)CurrentNode.DataItem;
AlertButton dropButton = new AlertButton (AddinCatalog.GetString ("Drop"), Gtk.Stock.Delete);
if (MessageService.Confirm (
AddinCatalog.GetString ("Are you sure you want to drop view '{0}'", node.View.Name),
dropButton
)) {
ThreadPool.QueueUserWorkItem (new WaitCallback (OnDropViewThreaded), CurrentNode.DataItem);
}
}
示例13: AddFilesToSolutionFolder
public bool AddFilesToSolutionFolder (SolutionFolder folder, string[] files)
{
QuestionMessage msg = new QuestionMessage ();
AlertButton keepButton = new AlertButton (GettextCatalog.GetString ("Keep file path"));
msg.Buttons.Add (keepButton);
msg.Buttons.Add (AlertButton.Copy);
msg.Buttons.Add (AlertButton.Move);
msg.Buttons.Add (AlertButton.Cancel);
msg.AllowApplyToAll = true;
bool someAdded = false;
foreach (string file in files) {
FilePath fp = file;
FilePath dest = folder.BaseDirectory.Combine (fp.FileName);
if (folder.IsRoot) {
// Don't allow adding files to the root folder. VS doesn't allow it
// If there is no existing folder, create one
var itemsFolder = (SolutionFolder) folder.Items.Where (item => item.Name == "Solution Items").FirstOrDefault ();
if (itemsFolder == null) {
itemsFolder = new SolutionFolder ();
itemsFolder.Name = "Solution Items";
folder.AddItem (itemsFolder);
}
folder = itemsFolder;
}
if (!fp.IsChildPathOf (folder.BaseDirectory)) {
msg.Text = GettextCatalog.GetString ("The file {0} is outside the folder directory. What do you want to do?", fp.FileName);
AlertButton res = MessageService.AskQuestion (msg);
if (res == AlertButton.Cancel)
return someAdded;
if (res == AlertButton.Copy) {
FileService.CopyFile (file, dest);
fp = dest;
} else if (res == AlertButton.Move) {
FileService.MoveFile (file, dest);
fp = dest;
}
}
folder.Files.Add (fp);
someAdded = true;
}
return someAdded;
}
示例14: ConfirmationMessage
public ConfirmationMessage (string primaryText, AlertButton button): this (button)
{
Text = primaryText;
}
示例15: ImportFile
internal static string ImportFile (Project prj, string file)
{
ProjectFile pfile = prj.Files.GetFile (file);
if (pfile == null) {
var files = IdeApp.ProjectOperations.AddFilesToProject (prj, new string[] { file }, prj.BaseDirectory);
if (files.Count == 0 || files[0] == null)
return null;
pfile = files [0];
}
if (pfile.BuildAction == BuildAction.EmbeddedResource) {
AlertButton embedButton = new AlertButton (GettextCatalog.GetString ("_Use as Source"));
if (MessageService.AskQuestion (GettextCatalog.GetString ("You are requesting the file '{0}' to be used as source for an image. However, this file is already added to the project as a resource. Are you sure you want to continue (the file will have to be removed from the resource list)?"), AlertButton.Cancel, embedButton) == embedButton)
return null;
}
pfile.BuildAction = BuildAction.Content;
DeployProperties props = DeployService.GetDeployProperties (pfile);
props.UseProjectRelativePath = true;
return pfile.FilePath;
}