Ejemplo n.º 1
0
        static void Main()
        {
            // Senyal per notificar al notifcation worker que arriba nou update des del receiver.
            ReceiverArgs.notificationSignal = new AutoResetEvent(false);

            // thread del notification worker
            Thread ThreadNotificationWorker;

            //Thread ThreadMusicPlayer;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // instanciem classes
            NotificationWorker notificationWorker = new NotificationWorker();
            ServerHandler      serverHandler      = new ServerHandler();
            //MusicPlayer musicPlayer = new MusicPlayer();

            // iniciem el thread de notificacions
            ThreadStart threadStart = delegate { notificationWorker.Start(); };

            ThreadNotificationWorker = new Thread(threadStart);
            ThreadNotificationWorker.Start();

            //threadStart = delegate { }

            // instanciem la UI
            LoginMenu loginMenu = new LoginMenu(serverHandler, notificationWorker);

            Application.Run(loginMenu);

            // Parem el notification worker
            ThreadNotificationWorker.Abort();
        }
Ejemplo n.º 2
0
        // A aquest form li passem el Serve Handler i el Notification Worker ja inicalitzats
        public LoginMenu(ServerHandler serverHandler, NotificationWorker notificationWorker)
        {
            this.serverHandler      = serverHandler;
            this.notificationWorker = notificationWorker;
            InitializeComponent();

            LoginButton.Image      = Image.FromFile("../../../Pictures/Layouts/LogIn.png");
            SignupButton.Image     = Image.FromFile("../../../Pictures/Layouts/SignUp.png");
            DeleteUserButton.Image = Image.FromFile("../../../Pictures/Layouts/SignOut.png");
        }