예제 #1
0
        private void Base_offscreen_Load(object sender, EventArgs e)
        {
            //Moduler
            chat     = null;
            jukebox  = null;
            ad_image = null;

            createLayout();

            //New TCP server is created
            connection = new TCP_Server(chat, jukebox);

            //Base_screen
            base_screen = new Base_screen(modList, layout);

            //Show on second monitor
            var mainScreen   = Screen.FromControl(this);
            var secondScreen = Screen.AllScreens.FirstOrDefault(s => !s.Equals(mainScreen)) ?? mainScreen;

            base_screen.Left          = secondScreen.WorkingArea.Left;
            base_screen.Top           = secondScreen.WorkingArea.Top;
            base_screen.StartPosition = FormStartPosition.Manual;

            base_screen.Show();
        }
예제 #2
0
        private UserControl selectMods(Module item, int nr)
        {
            UserControl temp;

            //Determines module to start by mods selected in Start.cs
            //Onscreen is saved to item.userControl and passed to Base_screen.cs
            //Moduler
            if (item.name.Equals("Jukebox"))
            {
                jukebox          = new Jukebox();
                item.userControl = jukebox.jb_screen;
                temp             = jukebox.jb_offscreen;
            }
            else if (item.name.Equals("Chat"))
            {
                chat             = new Chat();
                item.userControl = chat.chat_screen;
                temp             = chat.chat_offscreen;
            }
            else
            {
                ad_image         = new Ad_Image();
                item.userControl = ad_image.ad_image_screen;
                temp             = ad_image.ad_image_offscreen;
            }
            modList[nr] = item;

            return(temp);
        }
예제 #3
0
        const int LIMIT = 50; //50 concurrent clients

        public TCP_Server(Chat chat, Jukebox jukebox)
        {
            //Moduler
            this.chat    = chat;
            this.jukebox = jukebox;

            listener = new TcpListener(IPAddress.Loopback, 2055);
            listener.Start();

            Console.WriteLine("Server mounted, listening to port 2055");

            for (int i = 0; i < LIMIT; i++)
            {
                Thread t = new Thread(new ThreadStart(Service));
                t.Start();
            }
        }