Esempio n. 1
0
 public SICategory(PackageCategory category, SIStorageServiceClient siService, string restriction)
 {
     _category    = category;
     _restriction = restriction;
     _siService   = siService;
 }
Esempio n. 2
0
 public void Open()
 {
     _siService = new SIStorageServiceClient();
     IsLoading  = true;
     LoadPublishersAsync();
 }
Esempio n. 3
0
 public StorageContextViewModel(SIStorageServiceClient siStorageService)
 {
     _siStorageService = siStorageService;
 }
Esempio n. 4
0
        private async Task Enter_Executed(object arg)
        {
            lock (_loginLock)
            {
                if (IsProgress)
                {
                    return;
                }

                IsProgress = true;
            }

            Error               = "";
            FullError           = null;
            Enter.CanBeExecuted = false;

            try
            {
                NewServerInfo[] uris;
                try
                {
                    var siService = new SIStorageServiceClient();
                    uris = await siService.GetGameServersUrisAsync(_cancellationTokenSource.Token);
                }
                catch
                {
                    uris = null;
                }

                var uri = uris?.FirstOrDefault() ?? new NewServerInfo {
                    Uri = GameServerClientNew.GameServerPredefinedUri, ProtocolVersion = ClientProtocolVersion
                };

                if (uri == null)
                {
                    Error = Resources.CannotGetServerAddress;
                    return;
                }

                if (uri.ProtocolVersion > ClientProtocolVersion)
                {
                    IsProgress          = false;
                    Enter.CanBeExecuted = true;
                    Error = Resources.ObsoleClient;
                    return;
                }

                IGameServerClient client = new GameServerClientNew(uri.Uri);

                await client.OpenAsync(_login, _cancellationTokenSource.Token);

                Entered?.Invoke(_login, client);
            }
            catch (HttpRequestException exc)
            {
                var message = new StringBuilder();

                var innerExc = exc.InnerException ?? exc;
                while (innerExc != null)
                {
                    if (message.Length > 0)
                    {
                        message.AppendLine();
                    }

                    message.Append(innerExc.Message);
                    innerExc = innerExc.InnerException;
                }

                Error = message.ToString();
            }
            catch (Exception exc)
            {
                Error     = exc.Message;
                FullError = exc.ToString();
            }
            finally
            {
                lock (_loginLock)
                {
                    IsProgress = false;
                }

                Enter.CanBeExecuted = true;
            }
        }
Esempio n. 5
0
 public void Open()
 {
     _siService = new SIStorageServiceClient();
 }