Exemple #1
0
        private void LoadMethods(int userID, int projectID, int methodFilter)
        {
            bool success;

            switch (methodFilter)
            {
            case 0:      // My Methods only (Current User's Methods only)
                success = wgDB.GetAllMethodsForUser(userID);
                if (success)
                {
                    if (VM.MethodList != null)
                    {
                        VM.MethodList.Clear();
                    }
                    else
                    {
                        VM.MethodList = new ObservableCollection <MethodContainer>();
                    }

                    foreach (MethodContainer method in wgDB.m_methodList)
                    {
                        VM.MethodList.Add(method);
                    }
                }
                break;

            case 1:      // Public Methods only
                success = wgDB.GetAllPublicMethods();
                if (success)
                {
                    if (VM.MethodList != null)
                    {
                        VM.MethodList.Clear();
                    }
                    else
                    {
                        VM.MethodList = new ObservableCollection <MethodContainer>();
                    }

                    foreach (MethodContainer method in wgDB.m_methodList)
                    {
                        if (method.OwnerID != userID)
                        {
                            VM.MethodList.Add(method);
                        }
                    }
                }
                break;

            case 2:      // Current Project's Public Methods only
                success = wgDB.GetAllMethodsForProject(projectID);
                if (success)
                {
                    if (VM.MethodList != null)
                    {
                        VM.MethodList.Clear();
                    }
                    else
                    {
                        VM.MethodList = new ObservableCollection <MethodContainer>();
                    }

                    foreach (MethodContainer method in wgDB.m_methodList)
                    {
                        VM.MethodList.Add(method);
                    }
                }
                break;
            }
        }