Beispiel #1
0
        private void OnStateChanged(SocketConnectionState prev)
        {
            ConnectionInfoChangedEventArgs e = new ConnectionInfoChangedEventArgs()
            {
                PrevState = prev, NewState = State
            };

            if (Exchange != null)
            {
                Exchange.OnSocketInfoStateChanged(this, e);
            }
            if (StateChanged != null)
            {
                StateChanged(this, e);
            }
            if (State == SocketConnectionState.Error)
            {
                History.Add(new SocketInfoHistoryItem()
                {
                    Time = DateTime.Now, State = State, Message = LastError
                });
            }
            else
            {
                History.Add(new SocketInfoHistoryItem()
                {
                    Time = DateTime.Now, State = State, Message = "State Changed"
                });
            }
        }
Beispiel #2
0
        private GridFormatRule CreateRule(GridColumn column, SocketConnectionState state, Color color)
        {
            GridFormatRule           rule = new GridFormatRule();
            FormatConditionRuleValue cond = new FormatConditionRuleValue();

            cond.Appearance.FontStyleDelta = FontStyle.Bold;
            cond.Appearance.ForeColor      = color;
            cond.Appearance.Font           = this.gvConnections.Appearance.Row.Font;
            cond.Condition = FormatCondition.Equal;
            cond.Value1    = state;

            rule.Tag           = new object();
            rule.Name          = "fmt" + state.ToString();
            rule.Column        = column;
            rule.ColumnApplyTo = column;
            rule.Rule          = cond;
            return(rule);
        }