Beispiel #1
0
 public PrincipalPage()
 {
     InitializeComponent();
     Profilepanel = new ProfilePanel();
     Panel2Containt.Controls.Add(Profilepanel);
     listenerThread = new Thread(LookMsgs);
     listenerThread.Start();
 }
Beispiel #2
0
        //Controla el click en cada uno de los elementos del menu
        private void Menu_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Session.GettingData)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    switch (((Control)sender).Tag.ToString())
                    {
                    case "Profile":
                        lblTitle.Text = "Perfil";
                        Profilepanel  = new ProfilePanel();
                        Panel2Containt.Controls.Clear();
                        Panel2Containt.Controls.Add(Profilepanel);
                        break;

                    case "Users":
                        lblTitle.Text = "Usuarios";
                        UserPanel     = new UsersPanel();
                        Panel2Containt.Controls.Clear();
                        Panel2Containt.Controls.Add(UserPanel);
                        break;

                    case "Medic":
                        lblTitle.Text = "Medicamentos";
                        Medpanel      = new MedPanel();
                        Panel2Containt.Controls.Clear();
                        Panel2Containt.Controls.Add(Medpanel);
                        break;

                    case "Recepies":
                        lblTitle.Text = "Recetas";
                        RecPanel      = new PrescriptionPanel();
                        Panel2Containt.Controls.Clear();
                        Panel2Containt.Controls.Add(RecPanel);
                        break;

                    case "Messages":
                        lblTitle.Text = "Mensajes";
                        MessagePanel  = new MessPanel();
                        Panel2Containt.Controls.Clear();
                        Panel2Containt.Controls.Add(MessagePanel);
                        txtNumMsgs.Visible = false;
                        break;

                    case "Logout":
                        //Mostrar mensaje y cerrar app si acepta
                        if (DialogResult.Yes == MessageBox.Show("¿Seguro que desea desconectar?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        {
                            try
                            {
                                listenerThread.Abort();
                            }
                            catch (Exception ex) { }
                            ExitPressed();
                        }
                        break;
                    }
                    Cursor.Current = Cursors.Default;
                }
            }
            catch (Exception ex)
            {
                Session.GettingData = false;
                MessageBox.Show(ex.Message);
            }
        }