Exemple #1
0
        void BindResults(IAsyncResult ar)
        {
            CalcResult result = null;
            string     opcode = (string)ar.AsyncState;

            // Harvest the results
            switch (opcode)
            {
            case "+":
                result = client.EndAdd(ar);
                break;

            case "-":
                result = client.EndSubtract(ar);
                break;

            case "*":
                result = client.EndMultiply(ar);
                break;

            case "/":
                result = client.EndDivide(ar);
                break;
            }

            // Put the results into the data context, causing the
            // bound data to be updated in the TextBlock controls
            this.DataContext = result;
        }
Exemple #2
0
        void ShowResults(IAsyncResult ar)
        {
            CalcResult result = null;
            string     opcode = (string)ar.AsyncState;

            // Harvest the results
            switch (opcode)
            {
            case "+":
                result = client.EndAdd(ar);
                break;

            case "-":
                result = client.EndSubtract(ar);
                break;

            case "*":
                result = client.EndMultiply(ar);
                break;

            case "/":
                result = client.EndDivide(ar);
                break;
            }

            // Show the results
            _numberTextBlock.Text = result.Number.ToString();
            _wordsTextBlock.Text  = result.Words;
        }