Example #1
0
 private string AdminCheck()
 {
     if (ClassNetConfig.GetAppConfig("ADMIN_ID").Equals(txtLoginID.Text))
     {
         if (ClassNetConfig.GetAppConfig("ADMIN_PWD").Equals(txtLoginPW.Text))
         {
             return(txtLoginID.Text);
         }
     }
     return("");
 }
Example #2
0
        private void BtnSetServerIP_Click(object sender, EventArgs ea)
        {
            using (SetIPAddressForm setIPAddressForm = new SetIPAddressForm())
            {
                var dialogResult = setIPAddressForm.ShowDialog();

                if (dialogResult == DialogResult.OK)
                {
                    ClassNetConfig.SetAppConfig("SERVER_IP", setIPAddressForm.ServerIP);

                    MessageBox.Show("서버 IP가 수정되었습니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Example #3
0
        private void Client_Load(object sender, EventArgs e)
        {
            // DPI 설정 메소드 호출
            SetDpiAwareness();

            if (ClassNetConfig.GetAppConfig("SERVER_IP").Equals(""))
            {
                MessageBox.Show("서버 IP 설정이 필요합니다.", "서버 IP 미설정", MessageBoxButtons.OK, MessageBoxIcon.Information);
                using (SetIPAddressForm setIPAddressForm = new SetIPAddressForm())
                {
                    var dialogResult = setIPAddressForm.ShowDialog();
                    if (dialogResult == DialogResult.OK)
                    {
                        ClassNetConfig.SetAppConfig("SERVER_IP", setIPAddressForm.ServerIP);
                    }
                }
            }
            this.SERVER_IP = ClassNetConfig.GetAppConfig("SERVER_IP");

            isLogin = false;
            while (!isLogin)
            {
                loginForm = new LoginForm();
                loginForm.ShowDialog();      // ShowDialog 실행, 닫힐 때 까지 프로그램은 일시정지.
                stuInfo = loginForm.stuInfo; // 로그인 데이터를 변수에 담음.

                if (stuInfo.Length > 0)
                {
                    isLogin = true;
                }
            }

            if (stuInfo.Equals(ClassNetConfig.GetAppConfig("ADMIN_ID")))
            {
                ContextMenu ctx = new ContextMenu();
                ctx.MenuItems.Add(new MenuItem("설정", new EventHandler((s, ea) => BtnSetServerIP_Click(s, ea))));
                ctx.MenuItems.Add(new MenuItem("로그아웃", new EventHandler((s, ea) => BtnLogout_Click(s, ea))));

                this.notifyIcon.ContextMenu = ctx;
                this.notifyIcon.Visible     = true;

                this.Opacity = 0;

                this.ShowInTaskbar = false;
            }
            else
            {
                ContextMenu ctx = new ContextMenu();
                ctx.MenuItems.Add(new MenuItem("만든이", new EventHandler((s, ea) => BtnMade_Click(s, ea))));
                ctx.MenuItems.Add(new MenuItem("로그아웃", new EventHandler((s, ea) => BtnLogout_Click(s, ea))));

                this.notifyIcon.ContextMenu = ctx;
                this.notifyIcon.Visible     = true;

                // 폼 숨기기
                this.Opacity = 0;

                // 작업표시줄 상에서 프로그램이 표시되지 않도록 설정
                this.ShowInTaskbar = false;

                // 받은 이미지를 풀스크린으로 띄우는 설정
                this.FormBorderStyle = FormBorderStyle.None;
                this.WindowState     = FormWindowState.Maximized;

                this.Location = new Point(0, 0);
                this.Width    = Screen.PrimaryScreen.Bounds.Width;
                this.Height   = Screen.PrimaryScreen.Bounds.Height;

                screenImage.Width  = Screen.PrimaryScreen.Bounds.Width;
                screenImage.Height = Screen.PrimaryScreen.Bounds.Height;

                // 화면 폼을 가장 맨 위로
                TopMost = true;

                // JPEG 손실 압축 수준 설정
                codec          = GetEncoder(ImageFormat.Jpeg);
                param          = new EncoderParameters();
                param.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 30L);

                // 인터넷 차단, 입력 잠금, 작업관리자 잠금
                firewallPortBlocker  = new FirewallPortBlock();
                cmdProcessController = new CmdProcessController();
                taskMgrController    = new TaskMgrController();

                // 작업 관리자 잠금 실행
                taskMgrController.KillTaskMgr();

                // 소켓 연결 대기
                Task.Run(() => SocketConnection());
            }
        }