コード例 #1
0
        // public
        public MainWindow()
        {
            InitializeComponent();

            Debug.init();
            LatencyCounter.init();

            Load += onLoad;
            FormClosing += onFormClosing;
            channelsList.SelectedIndexChanged += onSelectedChannelChanged;
            intervalEdit.ValueChanged += onIntervalValueChanged;
            clientsList.SelectedIndexChanged += onSelectedClientChanged;
            addClientButton.Click += onAddClient;
            removeClientButton.Click += onRemoveClient;
            subscribeButton.Click += onSubscribeChannel;
            unsubscribeButton.Click += onUnsubscribeAllChannels;

            mDataSource = new TestDataSource(Constants.kChannelsCount);
            mDataSource.addDataReceiver(this);

            for (int i = 0; i < Constants.kChannelsCount; ++i)
            {
                channelsList.Items.Add((i + 1).ToString());
            }

            mDataReceiver = new DataReceiver(mDataSource);
            mSubscribers = new Dictionary<string, Subscriber>();
            mRandom = new Random((int)DateTime.Now.Ticks);

            for (int i = 0; i < Constants.kInitialSubscribersCount; ++i)
            {
                addClient();
            }

            channelsCountLabel.Text = String.Concat("Channels (", channelsList.Items.Count.ToString(), "):");

            mLatencyTimer = new System.Timers.Timer(1000);
            mLatencyTimer.AutoReset = true;
            mLatencyTimer.Elapsed += onLatencyTimer;
        }
コード例 #2
0
 // public
 public Subscriber(DataReceiver dataReceiver)
 {
     mDataReceiver = dataReceiver;
     mId = Guid.NewGuid().ToString();
 }