Ejemplo n.º 1
0
        public DDConnectionManager(IFop2Client client)
        {
            _client = client;

            _registeredobjects = new List <IDDConnectionStateChangeNotifyable>();

            _client.AuthenticationResultReceived += (s, e) => { this.StateChanged(s, new DDConnectionStateChangedEventArgs(e.Result == AuthenticationStatus.Success ? DDConnectionState.AuthenticationSucceeded : DDConnectionState.AuthenticationFailed)); };
            _client.ConnectionError        += (s, e) => { this.StateChanged(s, new DDConnectionStateChangedEventArgs(e.Exception.GetType().Equals(typeof(TimeoutException)) ? DDConnectionState.ConnectionTimedOut : DDConnectionState.ConnectionLost, e.Exception.Message)); };
            _client.ConnectionStateChanged += (s, e) => { this.StateChanged(s, new DDConnectionStateChangedEventArgs(e.ConnectionState == ConnectionState.Connected ? DDConnectionState.Connected : DDConnectionState.ConnectionLost)); };
        }
Ejemplo n.º 2
0
        public DDNotifyIcon(IFop2Client client)
        {
            _notifyicon = new NotifyIcon();

            _notifyicon.BalloonTipClosed  += (s, e) => { _currentballoon = null; };
            _notifyicon.BalloonTipClicked += (s, e) =>
            {
                if ((_currentballoon != null) && (BalloonClicked != null))
                {
                    BalloonClicked(this, new DDBalloonClickedEventArgs(_currentballoon));
                }
            };

            _client = client;

            _client.MessageReceived += MessageReceived;
            _client.MessageSent     += MessageSent;
        }