probléme avec les surcharges de méthodes
Bonjour à toutes et à tous ,
Voila je débute avec le C# et j'ai un projet qui contient plusieurs fiches avec une seule et meme barre d'outils j'ai remarqué que certaines actions se répéter comme le parcours suivant précédant dans toutes mes fiches donc j'ai commencé à faire une classe générique dont mes fiches héritent voici son code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
public class FicheGenerique : UserControl
{
#region Declarations
public TidjaraDS DS = new TidjaraDS();
public int position = 0;
public string opperation = "";
public List<Object> liste;
public List<Control> champsNumeriques;
public Liste.P_Fenetre_Liste fenetreListe;
public bool focus = false;
public UserControl ficheFille;
public Grid layout;
#endregion
public FicheGenerique()
{
}
public void Ajout_Evenements_Toolbar()
{
global.btn_nouveau.Click += new RoutedEventHandler(btn_plus_Click);
global.btn_suivant.Click += new RoutedEventHandler(btn_suivant_Click);
global.btn_precedent.Click += new RoutedEventHandler(btn_precedent_Click);
global.btn_fin.Click += new RoutedEventHandler(btn_fin_Click);
global.btn_debut.Click += new RoutedEventHandler(btn_debut_Click);
global.btn_editer.Click += new RoutedEventHandler(btn_editer_Click);
global.btn_liste.Click += new RoutedEventHandler(btn_liste_Click);
global.btn_valider.Click += new RoutedEventHandler(btn_valider_Click);
global.btn_supprrimer.Click += new RoutedEventHandler(btn_supprrimer_Click);
global.btn_abondoner.Click += new RoutedEventHandler(btn_abondoner_Click);
global.btn_rafrichir.Click += new RoutedEventHandler(btn_raffrichir_Click);
}
#region Actions Toolbar
#region Navigation
public void NaviguerVers(GoTo Position, List<Object> list, Grid layoutRoot)
{
this.liste = list;
this.layout = layoutRoot;
switch (Position)
{
case GoTo.First:
position = 0;
layout.DataContext = liste[0];
break;
case GoTo.Prev:
if (position >= 1)
{
position--;
layout.DataContext = liste[position];
}
break;
case GoTo.Next:
if (position < liste.Count - 1)
{
position++;
layout.DataContext = liste[position];
}
break;
case GoTo.Last:
position = liste.Count - 1;
layout.DataContext = liste[position];
break;
}
}
public void btn_debut_Click(object sender, RoutedEventArgs e)
{
Naviguer(GoTo.First);
}
public void btn_fin_Click(object sender, RoutedEventArgs e)
{
Naviguer(GoTo.Last);
}
public void btn_precedent_Click(object sender, RoutedEventArgs e)
{
Naviguer(GoTo.Prev);
}
public void btn_suivant_Click(object sender, RoutedEventArgs e)
{
Naviguer(GoTo.Next);
}
#endregion
public virtual void btn_supprrimer_Click(object sender, RoutedEventArgs e)
{
}
public virtual void raffraichir_Header_Onglet()
{
}
public virtual void UserControl_ReadOnly(bool type)
{
}
public void btn_editer_Click(object sender, RoutedEventArgs e)
{
opperation = RessourceAppli.OperationModification;
UserControl_ReadOnly(false);
Utils.InitBtnModifierArticle();
raffraichir_Header_Onglet();
}
public virtual void btn_valider_Click(object sender, RoutedEventArgs e)
{
}
public virtual void btn_plus_Click(object sender, RoutedEventArgs e)
{
}
public void btn_abondoner_Click(object sender, RoutedEventArgs e)
{
RadWindow.Confirm("Etes-vous sur de vouloir abandonner l'opération ?", new EventHandler<WindowClosedEventArgs>(Abandonner));
}
public virtual void Abandonner(object sender, WindowClosedEventArgs e)
{
}
public virtual void btn_liste_Click(object sender, RoutedEventArgs e)
{
}
public virtual void btn_raffrichir_Click(object sender, RoutedEventArgs e)
{
}
} |
dans chaque classe fiche j'ai overrrider la méthode naviguer comme ceci :
Code:
1 2 3 4 5 6 7 8
|
public override void Naviguer(GoTo Position)
{
NaviguerVers(Position, LISTEFAMILLESARTICLES, LayoutRoot);
FamilleArticleGridView.Items.MoveCurrentToPosition(position);
raffraichir_Header_Onglet();
raffraichir_boutons_navigation();
} |
sauf que mon soucis est que si j'ai deux fiches différentes ouvertes et que je fais suivant il execute les deux surcharges qui existent dans les deux fiches
est ce que je me suis mal prise ?
merci de vos réponse