2012-05-09 18 views

Odpowiedz

9

Poszukujesz NSAlert, który w większości jest odpowiednikiem MessageBox.

Możesz pokazać NSAlert przy użyciu NSAlert.RunModal() lub użyć NSAlert.BeginSheet(), jeśli chcesz, aby pojawiał się jako arkusz w określonym oknie.

np.

var alert = new NSAlert { 
    MessageText = "Hello, this is an alert!", 
    AlertStyle = NSAlertStyle.Informational 
}; 

alert.AddButton ("OK"); 
alert.AddButton ("Cancel"); 

var returnValue = alert.RunModal(); 
// returnValue will be 1000 for OK, 1001 for Cancel 

można przyjrzeć się, jak go używać nieco bardziej z perspektywy Monoman tutaj:

https://github.com/picoe/Eto/blob/master/Source/Eto.Platform.Mac/Forms/MessageBoxHandler.cs

Powiązane problemy