Click here to Skip to main content
15,441,032 members
Home / Discussions / C#
   

C#

 
Questionis there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
joost.versteegen21-Jan-18 23:38
Memberjoost.versteegen21-Jan-18 23:38 
AnswerRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
Nathan Minier22-Jan-18 1:15
professionalNathan Minier22-Jan-18 1:15 
GeneralRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
joost.versteegen22-Jan-18 1:31
Memberjoost.versteegen22-Jan-18 1:31 
GeneralRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
Nathan Minier22-Jan-18 2:00
professionalNathan Minier22-Jan-18 2:00 
SuggestionRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
Richard Deeming22-Jan-18 8:11
mveRichard Deeming22-Jan-18 8:11 
GeneralRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
joost.versteegen22-Jan-18 21:17
Memberjoost.versteegen22-Jan-18 21:17 
QuestionWPF C# Messagebox Result Issue Pin
Derek Kennard21-Jan-18 19:30
professionalDerek Kennard21-Jan-18 19:30 
AnswerRe: WPF C# Messagebox Result Issue Pin
phil.o21-Jan-18 23:03
mvephil.o21-Jan-18 23:03 
First, I think you should call the base OnClosing method, not the OnClosed as you do. Second, you should call this base handler in both cases, as it will take care with proper action, whether or not event has been cancelled:
C#
var result =
   MessageBox.Show(
      Properties.Resources.MainWindowMsgBox3 + Environment.NewLine +
      Properties.Resources.MainWindowMsgBox4 + Environment.NewLine + Environment.NewLine +
      Properties.Resources.MainWindowMsgBox5,
      Properties.Resources.MainWindowMsgBox6, MessageBoxButton.YesNo, MessageBoxImage.Question,
      MessageBoxResult.No);
Log.Info("User engaged Application Closure Event");
switch (result)
{
   case MessageBoxResult.Yes:
      Log.Info("Main Window Closing");
      break;
   case MessageBoxResult.No:
      e.Cancel = true;
      break;
}
base.OnClosing(e);

The whole point of setting the Cancel property is to let the base handler know which action to take (close or cancel).
Hope this helps.
"I'm neither for nor against, on the contrary." John Middle

GeneralRe: WPF C# Messagebox Result Issue Pin
Derek Kennard22-Jan-18 6:37
professionalDerek Kennard22-Jan-18 6:37 
GeneralRe: WPF C# Messagebox Result Issue Pin
phil.o22-Jan-18 6:40
mvephil.o22-Jan-18 6:40 
GeneralRe: WPF C# Messagebox Result Issue Pin
Derek Kennard22-Jan-18 7:43
professionalDerek Kennard22-Jan-18 7:43 
GeneralRe: WPF C# Messagebox Result Issue Pin
Derek Kennard23-Jan-18 8:05
professionalDerek Kennard23-Jan-18 8:05 
GeneralRe: WPF C# Messagebox Result Issue Pin
phil.o23-Jan-18 11:53
mvephil.o23-Jan-18 11:53 
QuestionCoding Moveable Elements for Games or Whatever Pin
Member 1358827720-Jan-18 2:03
MemberMember 1358827720-Jan-18 2:03 
SuggestionRe: Coding Moveable Elements for Games or Whatever Pin
Richard MacCutchan20-Jan-18 3:01
mveRichard MacCutchan20-Jan-18 3:01 
AnswerRe: Coding Moveable Elements for Games or Whatever Pin
BillWoodruff20-Jan-18 5:17
mveBillWoodruff20-Jan-18 5:17 
AnswerRe: Coding Moveable Elements for Games or Whatever Pin
Eddy Vluggen21-Jan-18 3:10
professionalEddy Vluggen21-Jan-18 3:10 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Nathan Minier22-Jan-18 1:21
professionalNathan Minier22-Jan-18 1:21 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Member 1358827722-Jan-18 5:47
MemberMember 1358827722-Jan-18 5:47 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Nathan Minier22-Jan-18 5:58
professionalNathan Minier22-Jan-18 5:58 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Eddy Vluggen22-Jan-18 8:42
professionalEddy Vluggen22-Jan-18 8:42 
AnswerRe: Coding Moveable Elements for Games or Whatever Pin
Gerry Schmitz22-Jan-18 12:03
mveGerry Schmitz22-Jan-18 12:03 
QuestionRe: Coding Moveable Elements for Games or Whatever Pin
Eddy Vluggen22-Jan-18 13:54
professionalEddy Vluggen22-Jan-18 13:54 
AnswerRe: Coding Moveable Elements for Games or Whatever Pin
Gerry Schmitz22-Jan-18 14:23
mveGerry Schmitz22-Jan-18 14:23 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Eddy Vluggen22-Jan-18 14:37
professionalEddy Vluggen22-Jan-18 14:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.