示例#1
0
 private void OnPowerModeChange(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Suspend)
     {
         HTTPWebComm comm = new HTTPWebComm();
         string      url  = "http://210.94.194.82:52131/log.asp?id=2014112089&cmd=write&action=wakeup";
         comm.SetURL(url);
         comm.setMessage("");
         comm.Reqeust();
         comm.Response();
     }
 }
示例#2
0
        /* 서버로부터 각 Action에 대한 Log를 읽어오는 메소드로, 해당 Action 및 UnixTime을
         * 읽어오게 되므로, 받아온 값을 Parsing 하여 UnixTime만 분리하여 DateTime으로 변환하여
         * Return 하게 된다. */

        private DateTime ReadActionLog(string action)
        {
            string url = "http://210.94.194.82:52131/log.asp?id=2014112089&cmd=read&action=";

            url += action;
            char   split = ':';
            double time;

            comm.SetURL(url);
            comm.setMessage("");
            comm.Reqeust();
            string result = comm.Response();

            time = double.Parse(result.Substring(result.IndexOf(split) + 1, 10));
            return(UnixTimeToDateTime(time));
        }
示例#3
0
        /* 설정 버튼과 이미지를 제외한 나머지 버튼에 대한 Event Handler로,
        * nircmd를 이용하여 클릭된 버튼에 따라 해당 기능을 수행하도록 하였다.*/

        private void Button_Handler(object sender, EventArgs e)
        {
            string operation = "";
            string url       = "http://210.94.194.82:52131/log.asp?id=2014112089&cmd=write&action=";
            Button button    = sender as Button;

            switch (button.Name)
            {
            case "shutdownButton":
                url      += "shutdown";
                operation = "exitwin poweroff";
                break;

            case "sleepButton":
                url      += "sleep";
                operation = "monitor off";
                break;

            case "suspendButton":
                url      += "suspend";
                operation = "standby force";
                break;

            case "hibernateButton":
                url      += "hibernate";
                operation = "hibernate force";
                break;
            }
            HTTPWebComm comm = new HTTPWebComm();

            comm.SetURL(url);
            comm.setMessage("");
            comm.Reqeust();
            comm.Response();
            Process.Start(path, operation);
        }