private void OnStateServiceChangedGroups(object sender, ChangedGroupsSignalArgs e) => ChargePossibleConverstionItems(e.Data);
Пример #2
0
        protected override void OnStartListeningToHub()
        {
            _hubConnection.On <object>(_CHANGED_PROFILE_ACTION_KEY, (args) => {
                Console.WriteLine("===> {0}", _CHANGED_PROFILE_ACTION_KEY);

                try {
                    ChangedProfileSignalArgs changedProfileSignalArgs = new ChangedProfileSignalArgs()
                    {
                        Profile = JsonConvert.DeserializeObject <ProfileDTO>(args.ToString())
                    };
                    ChangedProfile.Invoke(this, changedProfileSignalArgs);
                }
                catch (Exception exc) {
                    Debugger.Break();

                    throw new InvalidOperationException(CHANGED_PROFILE_HANDLING_ERROR, exc);
                }
            });

            _hubConnection.On <object>(_CHANGED_FRIENDSHIP_ACTION_KEY, (args) => {
                Console.WriteLine("===> {0}", _CHANGED_FRIENDSHIP_ACTION_KEY);

                try {
                    ChangedFriendshipSignalArgs changedFriendshipSignalArgs = JsonConvert.DeserializeObject <ChangedFriendshipSignalArgs>(args.ToString());
                    ChangedFriendship.Invoke(this, changedFriendshipSignalArgs);
                }
                catch (Exception exc) {
                    Debugger.Break();

                    throw new InvalidOperationException(CHANGED_FRIENDSHIP_HANDLING_ERROR, exc);
                }
            });

            _hubConnection.On <object>(_CHANGED_TEAMS_ACTION_KEY, (args) => {
                Console.WriteLine("===> {0}", _CHANGED_TEAMS_ACTION_KEY);

                try {
                    ChangedTeamsSignalArgs changedTeamsSignalArgs = JsonConvert.DeserializeObject <ChangedTeamsSignalArgs>(args.ToString());
                    ChangedTeams.Invoke(this, changedTeamsSignalArgs);
                }
                catch (Exception exc) {
                    Debugger.Break();

                    throw new InvalidOperationException(CHANGED_TEAMS_HANDLING_ERROR, exc);
                }
            });

            _hubConnection.On <object>(_CHANGED_GROUPS_ACTION_KEY, (args) => {
                Console.WriteLine("===> {0}", _CHANGED_GROUPS_ACTION_KEY);

                try {
                    ChangedGroupsSignalArgs changedGroupsSignalArgs = JsonConvert.DeserializeObject <ChangedGroupsSignalArgs>(args.ToString());
                    ChangedGroups.Invoke(this, changedGroupsSignalArgs);
                }
                catch (Exception exc) {
                    Debugger.Break();

                    throw new InvalidOperationException(CHANGED_GROUPS_HANDLING_ERROR, exc);
                }
            });

            _hubConnection.On <object>(_CHANGED_INVITES_ACTION_KEY, (args) => {
                Console.WriteLine("===> {0}", _CHANGED_INVITES_ACTION_KEY);

                try {
                    ChangedInvitesSignalArgs changedInvitesSignalArgs = JsonConvert.DeserializeObject <ChangedInvitesSignalArgs>(args.ToString());
                    InvitesChanged.Invoke(this, changedInvitesSignalArgs);
                }
                catch (Exception exc) {
                    Debugger.Break();

                    throw new InvalidOperationException(CHANGED_INVITES_HANDLING_ERROR, exc);
                }
            });
        }