• 0

[C#][XMAL] Updating the app


Question

I am trying to build a Windows 8 metro style app using C# and XMAL is there a way to call a methord X times a second instead of when clicked , when touched est.

For example

when user hits a button X , a count down will appear on a screen , which will count down from 10 to 0.

Dont worry about getting the count down to appear just how to count down a int

int countDown;

Void UPDATE()

{

countDown --;

if (countDown == 600)

}

that type of thing.

Everything i have seen on MSDN was on button press , event stuff.

Link to comment
https://www.neowin.net/forum/topic/1131644-cxmal-updating-the-app/
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Thanks what about more advanced stuff instead of just a clock, What if i want to just say call a method from the very start and keep calling it forever?

Just like Update in XNA?

My situation im building a calculate i have a number of buttons , i want to show the current equsaion the user has imputed , just say 5 + 7 * 4 + 6.

I can call a method every time for every button , but why not something that gets called once every update. or can you do it once evey "button press".

  • 0

A couple of things:

- You'll likely want to databind the count down value to a property, and use the INotifyPropertyChanged interface to automatically reflect your back end changes to your front end view

- You'll want to maintain UI thread affinity. If you can guarantee you'll raise the initial method on the UI thread (which you can because its a button click) then it makes sense to await a Task because it captures the ambient SynchronizationContext and saves you the UI thread marshaling.

Id do something like

public async Task Countdown()
{
	   SomeCountDownProperty = 10;
	   while (SomeCountdownProperty != 0)
	   {
			  await Task.Delay(1000);
			  SomeCountDownProperty--;
	   }
}

Then on your button click event simply do:

await Countdown();

SomeCountdownProperty is a property which raises a PropertyChanged event when the value changes. It is always raised on the UI thread because the continuation is always run on the current synchronization context (which is CoreDispatcher because we are raised from a Click handler)

This topic is now closed to further replies.
  • Posts

    • Microsoft's fast coding model MAI-Code-1-Flash comes to Copilot Business and Enterprise by Karthik Mudaliar Microsoft’s recently announced MAI-Code-1-Flash model is now generally available to GitHub Copilot Business and Copilot Enterprise customers. With this support, organizations can have more centralized policy controls and billing while finally being able to use Microsoft’s lightweight, first-party coding model. According to GitHub’s announcement, Business and Enterprise plan administrators must enable the MAI-Code-1-Flash policy in Copilot settings before developers can access the model. Microsoft says that MAI-Code-1-Flash is for fast, iterative coding work rather than the most demanding architectural or debugging tasks. GitHub’s official model comparison page says that the model is great for "general-purpose coding and writing," while it excels at fast, accurate code completions and explanations Microsoft introduced MAI-Code-1-Flash on June 2 as part of a broader collection of internally developed MAI models. GitHub subsequently expanded support to Copilot CLI, the Copilot cloud agent, GitHub.com chat, GitHub Mobile, Visual Studio, JetBrains IDEs, Eclipse, and Xcode, but said support for managed Business and Enterprise customers was still on the way. In Microsoft’s own benchmark testing, MAI-Code-1-Flash scored 51.2% on SWE-Bench Pro, compared with 35.2% for Anthropic’s Claude Haiku 4.5. Microsoft also claimed that the model used up to 60% fewer tokens on SWE-Bench Verified. Do note that these are vendor-run results rather than independent measurements. The model is billed at provider list pricing under GitHub’s usage-based system. GitHub currently lists MAI-Code-1-Flash at $0.75 per million input tokens, $0.075 per million cached input tokens, and $4.50 per million output tokens. For organizations, the main incentive to use MAI-Code-1-Flash is likely to be efficiency rather than maximum capability. A smaller model that responds quickly and limits unnecessary output is quite useful for repetitive agent tasks at scale, especially after GitHub Copilot’s move toward usage-based billing. The "Flash" model is recommended for fast work and not necessarily for huge repositories with loads of context. It's better if teams compare their output with other larger models, especially if they're working on security-sensitive changes and complex, multi-file work.
    • yes AND no the "original" or plain/normal Optiplex 7010 won't be getting any more new firmware updates BUT the Optiplex SFF/SFF Plus {small form factor}, Micro/Micro Plus & Tower/Tower Plus 7010 editions DO get new updates such as this new one   and here are similar guides from the Dell web site for Dell systems: https://www.dell.com/support/kbdoc/en-us/000390990/secure-boot-transition-faq https://www.dell.com/support/kbdoc/en-us/000347876/microsoft-2011-secure-boot-certificate-expiration
    • AT&T has been spying on US citizens with the NSA for decades.. they just know how to keep it more under wraps.. the evil level is still there.
  • Recent Achievements

    • One Year In
      bernmeister earned a badge
      One Year In
    • Week One Done
      Scoobystu earned a badge
      Week One Done
    • Week One Done
      tuben earned a badge
      Week One Done
    • First Post
      OffsetAbs earned a badge
      First Post
    • Reacting Well
      OffsetAbs earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      462
    2. 2
      +Edouard
      213
    3. 3
      PsYcHoKiLLa
      157
    4. 4
      Steven P.
      72
    5. 5
      FloatingFatMan
      71
  • Tell a friend

    Love Neowin? Tell a friend!