Exemplo n.º 1
0
        public UserApiForwardViewModel(IHexApiService aHexApi, User aUser, ApiSite aApiSite)
        {
            mHexApi  = aHexApi;
            mUser    = aUser;
            mApiSite = aApiSite;

            mMessagesToForward = new ObservableCollection <EMessageType>(aApiSite.SupportedMessages);
            mMessagesToIgnore  = new ObservableCollection <EMessageType>();

            foreach (var theUserApiForward in aUser.Forwards)
            {
                if (theUserApiForward.Type == aApiSite.Type)
                {
                    mForwardToThis = theUserApiForward.ForwardToThis;
                    mApiKey        = theUserApiForward.ApiKey;

                    foreach (var theMessageType in aApiSite.SupportedMessages)
                    {
                        if (!theUserApiForward.Messages.Contains(theMessageType))
                        {
                            mMessagesToIgnore.Add(theMessageType);
                            mMessagesToForward.Remove(theMessageType);
                        }
                    }
                }
            }

            SendToRightCommand    = new RelayCommand <EMessageType>(SendToRight);
            SendToLeftCommand     = new RelayCommand <EMessageType>(SendToLeft);
            SendAllToRightCommand = new RelayCommand(SendAllToRight, () => MessagesToForward.Any());
            SendAllToLeftCommand  = new RelayCommand(SendAllToLeft, () => MessagesToIgnore.Any());
        }
Exemplo n.º 2
0
        SendAllToLeft()
        {
            foreach (var theType in MessagesToIgnore)
            {
                MessagesToForward.Add(theType);
            }
            MessagesToIgnore.Clear();

            UpdateUser();
        }
Exemplo n.º 3
0
        SendToLeft
        (
            EMessageType aType
        )
        {
            if (aType == EMessageType.Unknown)
            {
                return;
            }

            MessagesToForward.Add(aType);
            MessagesToIgnore.Remove(aType);

            UpdateUser();
        }