F
F
fryette2015-01-23 14:13:49
Windows phone
fryette, 2015-01-23 14:13:49

Multithreading in windows phone?

The task is to click on the button so that, say, an element like loading appears on the screen, and after the appearance of this element on the screen, some work is performed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-01-23
@fryette

There are a lot of options. Here is a simple example a la MVVM.

private bool _isBusy;

// свойство для индикации
public bool IsBusy
{
   get { return _isBusy; }
   set 
   {
      _isBusy = value;
      RaiseNotifyPropertyChanged("IsBusy");    // реализация интерфейса INotifyPropertyChanged
   }
}

public async Task ButtonClickFunc()
{
   IsBusy = true;   // запускаем индикацию
   await Task.Delay(TimeSpan.FromSeconds(5000));
   IsBusy = false;   // выключаем индикацию.
}

<!-- XAML code -->

<control:BusyIndicator IsIndeterminate="{Binding IsBusy"} />

If there are many places where you need to set IsBusy, then it's better to subscribe to some IObservable and already set it when the event occurs, instead of doing it manually in each function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question