Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            MyArray       tab           = new MyArray();
            EventListener eventListener = new EventListener(tab);

            for (int i = 0; i < 100; i++)
            {
                ParameterizedThreadStart parameterizedThreadStart = new ParameterizedThreadStart(tab.Add);
                Thread myThread = new Thread(parameterizedThreadStart);
                myThread.Start(myThread.ManagedThreadId);
            }
            for (int i = 0; i < 100; i++)
            {
                ParameterizedThreadStart parameterizedThreadStart2 = new ParameterizedThreadStart(tab.AddNotBlocking);
                Thread myThread2 = new Thread(parameterizedThreadStart2);
                myThread2.Start(myThread2.ManagedThreadId);
            }
            tab.save();
        }
Esempio n. 2
0
 public EventListener(MyArray myArray)
 {
     this.myArray         = myArray;
     myArray.sizeChanged += new MyEventHandler(TableChanged);
 }
Esempio n. 3
0
 public void Detach()
 {
     myArray.sizeChanged -= new MyEventHandler(TableChanged);
     myArray              = null;
 }