I m use to ASP.NET with masterpage and session. i put the menu in masterpage. After sucsessfuly login i save the variable in session.
Now i m working with Winform.
the Session i replace with variable
and the master page i replace with Form
so after succsseuly login i save in the variable insted of Session and use the menu strip to switch off and on the panel.
public partial class Principale : Form
static string _ClientId;
public static string ClientId
{
get { return _ClientId; }
set { _ClientId = value; }
}
LeOrdre_BL oOrdre_BL = new LeOrdre_BL();
LeOrdreStatut_Entite_BL oOrdreStat_BL = new LeOrdreStatut_Entite_BL();
public Principale()
{
InitializeComponent();
ClientId = LoginData.Trim().Substring(0, LoginData.Trim().Length - 1);
panelControl_Ordre.Hide();
panelControl_Mag.Hide();
}
private void ordreToolStripMenuItem_Click(object sender, EventArgs e)
{
panelControl_Ordre.Show();
panelControl_Mag.Hide();
GetDataOrdre();
}
private void magasinierToolStripMenuItem_Click(object sender, EventArgs e)
{
panelControl_Ordre.Hide();
panelControl_Mag.Show();
}
public void GetDataOrdre()
{
try
{
bindingSource_OdreStatus.DataSource = oOrdreStat_BL.Get_All_OrdreStatut();
STATUT_ORDRE.DataSource = bindingSource_OdreStatus;
STATUT_ORDRE.DisplayMember = "LIBELLE";
STATUT_ORDRE.ValueMember = "NO";
bindingSource_Ordre.DataSource = oOrdre_BL.Get_Ordre_BL();
dataGridView_ordre.DataSource = bindingSource_Ordre;
dataGridView_ordre.DataMember = "OrdreTable";
}
catch (Exception excThrown)
{
lbl_Princ_Err.Text = excThrown.Message;
}
}
Am i in the right way to do this or Do you have another idea to replace ASP.NET Masterpage in Winform ?
Thanx in advance
Have you tried using an MdiContainer. The user state could be stored as a variable in the form that is the mdi container?