Click here to Skip to main content
15,885,141 members
Home / Discussions / C#
   

C#

 
GeneralRe: Car tracker Pin
lolinga218-Jul-15 9:42
lolinga218-Jul-15 9:42 
GeneralRe: Car tracker Pin
Mycroft Holmes18-Jul-15 14:35
professionalMycroft Holmes18-Jul-15 14:35 
QuestionError Converting String to Int Pin
Broodje Games18-Jul-15 2:26
Broodje Games18-Jul-15 2:26 
AnswerRe: Error Converting String to Int Pin
OriginalGriff18-Jul-15 2:31
mveOriginalGriff18-Jul-15 2:31 
AnswerRe: Error Converting String to Int Pin
miki-bgd18-Jul-15 5:12
miki-bgd18-Jul-15 5:12 
QuestionHide a Panel on MDI Container Pin
Jassim Rahma17-Jul-15 11:13
Jassim Rahma17-Jul-15 11:13 
AnswerRe: Hide a Panel on MDI Container Pin
Eddy Vluggen17-Jul-15 11:59
professionalEddy Vluggen17-Jul-15 11:59 
QuestionComplexity Pin
Gilbert Consellado16-Jul-15 22:37
professionalGilbert Consellado16-Jul-15 22:37 
Ive create a method that will handle keydown event

it has a lot of "if" statment and it say i has a high complexity and its scores 33

is there way to decrease its complexity
actually the method is not finish

here is the code

C#
private static void FlyouCommandEvent(object sender, KeyEventArgs e)
{
    var fd = (FlyoutDialog)sender;
    if ((e.KeyCode == Keys.A || (e.Alt && e.KeyCode == Keys.A)) && fd.CanExecuteCommand(Helpers.FlyoutCommandAbort))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandAbort);
    }
    else if (e.KeyCode == Keys.Escape && fd.CanExecuteCommand(Helpers.FlyoutCommandCancel))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandCancel);
    }
    else if ((e.KeyCode == Keys.I || (e.Alt && e.KeyCode == Keys.I)) && fd.CanExecuteCommand(Helpers.FlyoutCommandIgnore))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandIgnore);
    }
    else if ((e.KeyCode == Keys.N || (e.Alt && e.KeyCode == Keys.N)) && fd.CanExecuteCommand(Helpers.FlyoutCommandNo))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandNo);
    }
    else if ((e.KeyCode == Keys.N || (e.Alt && e.KeyCode == Keys.N)) && fd.CanExecuteCommand(Helpers.FlyoutCommandNone))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandNone);
    }
    else if (e.KeyCode == Keys.Enter && fd.CanExecuteCommand(Helpers.FlyoutCommandOK))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandOK);
    }
    else if ((e.KeyCode == Keys.R || (e.Alt && e.KeyCode == Keys.R)) && fd.CanExecuteCommand(Helpers.FlyoutCommandRetry))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandRetry);
    }
    else if ((e.KeyCode == Keys.Y || (e.Alt && e.KeyCode == Keys.Y)) && fd.CanExecuteCommand(Helpers.FlyoutCommandYes))
    {
        fd.ExecuteCommand(Helpers.FlyoutCommandYes);
    }
}


any suggestion is highly appreciated
thank you

modified 17-Jul-15 4:47am.

AnswerRe: Complexity Pin
Godhaniketan17-Jul-15 0:07
professionalGodhaniketan17-Jul-15 0:07 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 2:15
professionalGilbert Consellado17-Jul-15 2:15 
AnswerRe: Complexity PinPopular
Pete O'Hanlon17-Jul-15 1:07
mvePete O'Hanlon17-Jul-15 1:07 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 2:17
professionalGilbert Consellado17-Jul-15 2:17 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 5:18
professionalGilbert Consellado17-Jul-15 5:18 
AnswerRe: Complexity PinPopular
Alan N17-Jul-15 4:37
Alan N17-Jul-15 4:37 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 5:22
professionalGilbert Consellado17-Jul-15 5:22 
QuestionPass Anonymous Type To Worker Pin
Kevin Marois16-Jul-15 12:58
professionalKevin Marois16-Jul-15 12:58 
AnswerRe: Pass Anonymous Type To Worker Pin
Dave Kreskowiak16-Jul-15 14:49
mveDave Kreskowiak16-Jul-15 14:49 
GeneralRe: Pass Anonymous Type To Worker Pin
Kevin Marois16-Jul-15 14:52
professionalKevin Marois16-Jul-15 14:52 
AnswerRe: Pass Anonymous Type To Worker Pin
F-ES Sitecore16-Jul-15 21:45
professionalF-ES Sitecore16-Jul-15 21:45 
Questionform 1 and form 2 Pin
jamesmc153516-Jul-15 4:08
jamesmc153516-Jul-15 4:08 
AnswerRe: form 1 and form 2 Pin
Wes Aday16-Jul-15 4:26
professionalWes Aday16-Jul-15 4:26 
Questioni get a error invalid expresion Pin
jamesmc153516-Jul-15 2:57
jamesmc153516-Jul-15 2:57 
AnswerRe: i get a error invalid expresion Pin
Richard MacCutchan16-Jul-15 3:02
mveRichard MacCutchan16-Jul-15 3:02 
GeneralRe: i get a error invalid expresion Pin
jamesmc153516-Jul-15 3:09
jamesmc153516-Jul-15 3:09 
GeneralRe: i get a error invalid expresion Pin
Richard MacCutchan16-Jul-15 4:54
mveRichard MacCutchan16-Jul-15 4:54 

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.