Example #1
0
        public ITerminalConnection WaitConnection(IInterruptable intr, int timeout)
        {
            //ちょっと苦しい判定
            if (!(intr is InterruptableConnector) && !(intr is LocalShellUtil.Connector))
            {
                throw new ArgumentException("IInterruptable object is not correct");
            }

            if (!_event.WaitOne(timeout, true))
            {
                _timeout      = true; //TODO 接続を中止すべきか
                _errorMessage = PEnv.Strings.GetString("Message.ConnectionTimedOut");
            }
            _event.Close();

            if (_result == null)
            {
                if (_form != null)
                {
                    _form.Warning(_errorMessage);
                }
                return(null);
            }
            else
            {
                return(_result);
            }
        }
Example #2
0
 //接続先のSocketを準備して返す。失敗すればparentを親にしてエラーを表示し、nullを返す。
 internal static ITerminalConnection PrepareSocket(IPoderosaForm parent, ICygwinParameter param) {
     try {
         return new Connector(param).Connect();
     }
     catch (Exception ex) {
         //string key = IsCygwin(param)? "Message.CygwinUtil.FailedToConnect" : "Message.SFUUtil.FailedToConnect";
         string key = "Message.CygwinUtil.FailedToConnect";
         parent.Warning(PEnv.Strings.GetString(key) + ex.Message);
         return null;
     }
 }
Example #3
0
 private void Warning(IPoderosaForm pf, Form wf, string msg)
 {
     if (pf != null)
     {
         pf.Warning(msg);
     }
     else
     {
         GUtil.Warning(wf, msg);
     }
 }
 //接続先のSocketを準備して返す。失敗すればparentを親にしてエラーを表示し、nullを返す。
 internal static ITerminalConnection PrepareSocket(IPoderosaForm parent, ICygwinParameter param)
 {
     try {
         return(new Connector(param).Connect());
     }
     catch (Exception ex) {
         //string key = IsCygwin(param)? "Message.CygwinUtil.FailedToConnect" : "Message.SFUUtil.FailedToConnect";
         string key = "Message.CygwinUtil.FailedToConnect";
         parent.Warning(PEnv.Strings.GetString(key) + ex.Message);
         return(null);
     }
 }
Example #5
0
 private void Warning(IPoderosaForm pf, Form wf, string msg) {
     if (pf != null)
         pf.Warning(msg);
     else
         GUtil.Warning(wf, msg);
 }