Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:09:48+00:00 2026-06-12T03:09:48+00:00

I’m making a WP7-app for my programming class and I want to implement a

  • 0

I’m making a WP7-app for my programming class and I want to implement a callback function for checking the state of an integer and not calling the function for checking it explicitly. The integer iterates at the push of a button and when it reaches it’s max input I would like to have a callback function checking this, but I’m not completely sure how to implement it.

private void Right_Button_Click(object sender, RoutedEventArgs e)
    {
        if (current_input <= MAX_INPUT)
        {
            user_input[current_input] = 3;
            current_input++;
            display_result();
        }

    }

    #endregion

    void display_result()
    {
        //will move alot of this to the a result page
        DateTime time_end = DateTime.Now;
        TimeSpan difference = time_end.Subtract(timer);
        time_stamp = difference.ToString();
        bool combination_error = true;
        if (current_input == 4)
        {
            for (int i = 0; i < MAX_INPUT; i++)
            {
                if (user_input[i] != combination[i])
                {
                    combination_error = false;
                    break;
                }
            }

            if (combination_error)
            {
                MessageBox.Show("Correct combination The timer is " + time_stamp);
            }
            else
            {
                MessageBox.Show("Wrong combination");
            }
        }
    }

It’s after I increment current_input that I now explicitly call display result something I wish not to do and instead create a callback function for it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:09:49+00:00Added an answer on June 12, 2026 at 3:09 am

    You can’t really put a callback function on an integer, however, you could expose your integer as a property and call a function from the property setter. Look at this example:

    private int _myInteger = 0;
    
    private int MyInteger {
        get
        {
             return _myInteger;
        } 
        set 
        {
            _myInteger = value;
            if (_myInteger <= MAX_INPUT)
                MyCallBackFunction();
        }
    }
    
    private void Right_Button_Click(object sender, RoutedEventArgs e)
    {
        MyInteger = MyInteger + 1;
        // Do your other stuff here
    }
    
    private void MyCallBackFunction()
    {
        // This function executes when your integer is <= MAX_VALUE
        // Do Whatever here
        display_result();
    }
    

    What this is doing is exposing your integer through a private property. As long as you set the property through the setter (e.g. use the MyInteger = MyInteger + 1; syntax), you can have your setter check the condition and execute your call back function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.