Esempio n. 1
0
 private void InitSearchClient()
 {
     searchServiceClient = ServiceManager.GetSearchServiceClient();
     searchServiceClient.SearchCompleted += (sender, ea) =>
     {
         ItemCount = ea.Result.TotalCount;
         TotalItemCount = ea.Result.TotalCount;
         foundTracks = ea.Result.FoundTracks;
         NotBusy();
         OnCollectionChanged();
     };
 }
Esempio n. 2
0
        public static SearchServiceClient GetSearchServiceClient()
        {
            if (_searchServiceClient != null && _searchServiceClient.State == CommunicationState.Faulted)
            {
                RecreateAllChannels();
            }

            if (_searchServiceClient == null)
                _searchServiceClient = new SearchServiceClient(_defaultBinding, new EndpointAddress(Host + "Search"));

            return _searchServiceClient;
        }
Esempio n. 3
0
        /// <summary>
        /// Убивает все коммуникационные объекты и создает новые.
        /// </summary>
        public static void RecreateAllChannels()
        {
            KillChannel(_searchServiceClient);
            KillChannel(_playlistServiceClient);
            KillChannel(_playerServiceClient);
            KillChannel(_userServiceClient);

            _searchServiceClient = null;
            _playlistServiceClient = null;
            _playerServiceClient = null;
            _userServiceClient = null;

            if (ChannelsWereChanged != null)
                ChannelsWereChanged(null, null);
        }