Click here to Skip to main content
15,558,976 members
Home / Discussions / C#
   

C#

 
GeneralRe: Car tracker Pin
lolinga218-Jul-15 10:42
lolinga218-Jul-15 10:42 
GeneralRe: Car tracker Pin
Mycroft Holmes18-Jul-15 15:35
professionalMycroft Holmes18-Jul-15 15:35 
QuestionError Converting String to Int Pin
Broodje Games18-Jul-15 3:26
Broodje Games18-Jul-15 3:26 
AnswerRe: Error Converting String to Int Pin
OriginalGriff18-Jul-15 3:31
mveOriginalGriff18-Jul-15 3:31 
AnswerRe: Error Converting String to Int Pin
miki-bgd18-Jul-15 6:12
miki-bgd18-Jul-15 6:12 
QuestionHide a Panel on MDI Container Pin
Jassim Rahma17-Jul-15 12:13
Jassim Rahma17-Jul-15 12:13 
AnswerRe: Hide a Panel on MDI Container Pin
Eddy Vluggen17-Jul-15 12:59
professionalEddy Vluggen17-Jul-15 12:59 
QuestionComplexity Pin
Gilbert Consellado16-Jul-15 23:37
professionalGilbert Consellado16-Jul-15 23: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 1:07
professionalGodhaniketan17-Jul-15 1:07 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 3:15
professionalGilbert Consellado17-Jul-15 3:15 
AnswerRe: Complexity Pin
Pete O'Hanlon17-Jul-15 2:07
mvaPete O'Hanlon17-Jul-15 2:07 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 3:17
professionalGilbert Consellado17-Jul-15 3:17 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 6:18
professionalGilbert Consellado17-Jul-15 6:18 
AnswerRe: Complexity Pin
Alan N17-Jul-15 5:37
Alan N17-Jul-15 5:37 
GeneralRe: Complexity Pin
Gilbert Consellado17-Jul-15 6:22
professionalGilbert Consellado17-Jul-15 6:22 
QuestionPass Anonymous Type To Worker Pin
Kevin Marois16-Jul-15 13:58
professionalKevin Marois16-Jul-15 13:58 
AnswerRe: Pass Anonymous Type To Worker Pin
Dave Kreskowiak16-Jul-15 15:49
mveDave Kreskowiak16-Jul-15 15:49 
GeneralRe: Pass Anonymous Type To Worker Pin
Kevin Marois16-Jul-15 15:52
professionalKevin Marois16-Jul-15 15:52 
AnswerRe: Pass Anonymous Type To Worker Pin
F-ES Sitecore16-Jul-15 22:45
professionalF-ES Sitecore16-Jul-15 22:45 
Questionform 1 and form 2 Pin
jamesmc153516-Jul-15 5:08
jamesmc153516-Jul-15 5:08 
AnswerRe: form 1 and form 2 Pin
Wes Aday16-Jul-15 5:26
professionalWes Aday16-Jul-15 5:26 
Questioni get a error invalid expresion Pin
jamesmc153516-Jul-15 3:57
jamesmc153516-Jul-15 3:57 
AnswerRe: i get a error invalid expresion Pin
Richard MacCutchan16-Jul-15 4:02
mveRichard MacCutchan16-Jul-15 4:02 
GeneralRe: i get a error invalid expresion Pin
jamesmc153516-Jul-15 4:09
jamesmc153516-Jul-15 4:09 
GeneralRe: i get a error invalid expresion Pin
Richard MacCutchan16-Jul-15 5:54
mveRichard MacCutchan16-Jul-15 5: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.