Exemple #1
0
    private void BackgroundWorker1_DoWork(
        object sender,
        System.ComponentModel.DoWorkEventArgs e)
    {
        AreaClass2 AreaObject2 = (AreaClass2)e.Argument;

        // Return the value through the Result property.
        e.Result = AreaObject2.CalcArea();
    }
Exemple #2
0
        private void BackgroundWorker1_DoWork(
            object sender,
            System.ComponentModel.DoWorkEventArgs e)
        {
            // Load the object that was passed as an argument
            AreaClass2 AreaObject2Internal = (AreaClass2)e.Argument;

            // Run the calculation and store the result through the result property
            e.Result = AreaObject2Internal.CalcArea();
        }
Exemple #3
0
    private void TestArea2()
    {
        InitializeBackgroundWorker();

        AreaClass2 AreaObject2 = new AreaClass2();

        AreaObject2.Base   = 30;
        AreaObject2.Height = 40;

        // Start the asynchronous operation.
        BackgroundWorker1.RunWorkerAsync(AreaObject2);
    }
Exemple #4
0
        private void TestArea2()
        {
            InitializeBackgroundWorker();

            // Create Areaobject and initialize parameters
            AreaClass2 AreaObject2 = new AreaClass2();

            AreaObject2.Base   = 30;
            AreaObject2.Height = 40;

            // Start the Asynchronous Operation
            // pass AreaObject to Backgroundworker as argument
            BackgroundWorker1.RunWorkerAsync(AreaObject2);
        }