private void _createView() { IsLoading = true; ThreadPool.QueueUserWorkItem((o) => { while (true) { _client = new RemoteClient(Address); if (_client.IsConnected) { _client.Binder = new ClientTypeNameBinder(); Engine engine = _client.GetInitalObject <Engine>(); if (engine != null) { _client.Disconnected += _clientDisconected; Application.Current?.Dispatcher.BeginInvoke((Action) delegate() { Channel = new ChannelViewmodel(engine, ShowEngine, ShowMedia, AllowControl); TabName = Channel.ChannelName; IsLoading = false; }); return; } } Thread.Sleep(1000); } }); }
private void _createView() { IsLoading = true; Task.Run(() => { while (true) { _client = new RemoteClient(_configurationChannel.Address); if (_client.IsConnected) { _client.Binder = new ClientTypeNameBinder(); Engine engine = _client.GetInitalObject <Engine>(); if (engine != null) { _client.Disconnected += _clientDisconected; Application.Current?.Dispatcher.BeginInvoke((Action) delegate { Channel = new ChannelViewmodel(engine, _configurationChannel.ShowEngine, _configurationChannel.ShowMedia); TabName = Channel.DisplayName; IsLoading = false; }); return; } } Thread.Sleep(1000); } }); }