예제 #1
0
        // Write to file.
        public void Write(object sender, EventArgsEx args)
        {
            string message = args.Message;

            if (!String.IsNullOrEmpty(message)) {
                writer.Write(message);
            }
        }
예제 #2
0
 // Switch watching target.
 public void Switch(object sender, EventArgsEx args)
 {
     watcher.Filter = args.Message;
 }
예제 #3
0
파일: Tray.cs 프로젝트: Richard1140/tianma
        // Display balloon message.
        public void Notify(object sender, EventArgsEx args)
        {
            string type = args.Type;
            string tipTitle;
            string tipText = args.Message;

            switch (type) {
            case "error":
                tipTitle = "Error";
                break;
            case "output": // Fall through.
            default:
                tipTitle = "Information";
                break;
            }

            if (tipText.Length > 196) {
                tipText = tipText.Substring(0, 196) + "...";
            }

            notifyIcon.Visible = true;
            notifyIcon.ShowBalloonTip(20, tipTitle, tipText, ToolTipIcon.None);
        }
예제 #4
0
파일: Node.cs 프로젝트: Richard1140/tianma
        // Restart process.
        public void Restart(object sender, EventArgsEx args)
        {
            if (args.Type == "switch") {
                startInfo.Arguments = "\"" + args.Message + "\"";
            }

            if (status == Status.Running) {
                // Stop current process and start a new process immediately.
                status = Status.Stopping;
                process.Exited += Start;
                process.Kill();
            } else if (status == Status.Idle) {
                EmitEvent("start");
            }
        }
예제 #5
0
파일: Tray.cs 프로젝트: Richard1140/tianma
        // Refresh UI.
        public void Refresh(object sender, EventArgsEx args)
        {
            bool running = args.Type == "started";

            menuStart.Enabled = !running;
            menuStop.Enabled = running;
            menuRestart.Enabled = running;

            notifyIcon.Icon = running ?
                runningIcon : stoppedIcon;
            notifyIcon.Text = running ?
                "Tianma HTTP Server (Running)" : "Tianma HTTP Server (Stopped)";
        }