public void SetServerStates(SourceValuePointerList states)
 {
     _serverStates = states;
 }
        public IList <ISourceValuePointer> GetServerVariables(ClassPointer root)
        {
            Dictionary <UInt32, IAction> actions = root.GetActions();
            SourceValuePointerList       svs     = new SourceValuePointerList();

            foreach (TaskID tid in Sect0)             //check client action return values
            {
                HandlerMethodID hmid = tid as HandlerMethodID;
                if (hmid != null)
                {
                    WebClientEventHandlerMethod wceh = hmid.HandlerMethod as WebClientEventHandlerMethod;
                    if (wceh != null)
                    {
                        hmid.HandlerMethod.SetActions(actions);
                        List <IAction> acts = hmid.HandlerMethod.GetActions();
                        foreach (IAction act in acts)
                        {
                            if (act.ReturnReceiver != null)
                            {
                                ISourceValuePointer sv = act.ReturnReceiver as ISourceValuePointer;
                                if (sv != null && sv.IsWebServerValue() && !sv.IsWebClientValue())
                                {
                                    svs.AddUnique(sv);
                                }
                            }
                        }
                    }
                }
                else
                {
                    IAction a = tid.GetPublicAction(root);
                    if (a != null)
                    {
                        if (a.ReturnReceiver != null)
                        {
                            ISourceValuePointer sv = a.ReturnReceiver as ISourceValuePointer;
                            if (sv != null && sv.IsWebServerValue() && !sv.IsWebClientValue())
                            {
                                svs.AddUnique(sv);
                            }
                        }
                    }
                }
            }
            foreach (TaskID tid in Sect1)             //check server action parameters
            {
                HandlerMethodID hmid = tid as HandlerMethodID;
                if (hmid != null)
                {
                    WebClientEventHandlerMethod wceh = hmid.HandlerMethod as WebClientEventHandlerMethod;
                    if (wceh != null)
                    {
                        hmid.HandlerMethod.SetActions(actions);
                        hmid.HandlerMethod.CollectSourceValues(tid.TaskId);
                        //
                        svs.AddUnique(hmid.HandlerMethod.DownloadProperties);
                        //
                        List <MethodClass> ml = new List <MethodClass>();
                        hmid.HandlerMethod.GetCustomMethods(ml);
                        foreach (MethodClass m in ml)
                        {
                            m.CollectSourceValues(tid.TaskId);
                            svs.AddUnique(m.DownloadProperties);
                        }
                    }
                }
                else
                {
                    IAction a = tid.GetPublicAction(root);
                    if (a != null && a.ActionMethod != null && a.ActionMethod.Owner != null)
                    {
                        IFormSubmitter fs = a.ActionMethod.Owner.ObjectInstance as IFormSubmitter;
                        if (fs != null && fs.IsSubmissionMethod(a.ActionMethod.MethodName))
                        {
                            continue;
                        }
                        svs.AddUnique(a.GetServerProperties(tid.TaskId));
                        ISourceValuePointer p = a.ReturnReceiver as ISourceValuePointer;
                        if (p != null)
                        {
                            if (p.IsWebServerValue())
                            {
                                svs.AddUnique(p);
                            }
                        }
                    }
                }
            }
            //collect download (server) variables from client actions
            foreach (TaskID tid in Sect2)
            {
                HandlerMethodID hmid = tid as HandlerMethodID;
                if (hmid != null)
                {
                    WebClientEventHandlerMethod wceh = hmid.HandlerMethod as WebClientEventHandlerMethod;
                    if (wceh != null)
                    {
                        hmid.HandlerMethod.SetActions(actions);
                        hmid.HandlerMethod.CollectSourceValues(tid.TaskId);
                        //
                        svs.AddUnique(hmid.HandlerMethod.DownloadProperties);
                        //
                        List <MethodClass> ml = new List <MethodClass>();
                        hmid.HandlerMethod.GetCustomMethods(ml);
                        foreach (MethodClass m in ml)
                        {
                            m.CollectSourceValues(tid.TaskId);
                            svs.AddUnique(m.DownloadProperties);
                        }
                    }
                }
                else
                {
                    IAction a = tid.GetPublicAction(root);
                    if (a != null)
                    {
                        svs.AddUnique(a.GetServerProperties(tid.TaskId));
                    }
                }
            }
            return(svs);
        }