Exemple #1
0
        public Task AddProject(AsanaProject proj, Asana host)
        {
            Dictionary <string, object> project = new Dictionary <string, object>();

            project.Add("project", proj.ID);
            AsanaResponseEventHandler savedCallback = null;

            savedCallback = (s) =>
            {
                // add it manually
                if (Projects == null)
                {
                    Projects = new AsanaProject[1];
                }
                else
                {
                    AsanaProject[] lProjects = Projects;
                    Array.Resize(ref lProjects, Projects.Length + 1);
                    Projects = lProjects;
                }

                Projects[Projects.Length - 1] = proj;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.AddProjectToTask), project));
        }
Exemple #2
0
 public Task RemoveProject(AsanaProject proj)
 {
     if (Host == null)
     {
         throw new NullReferenceException("This AsanaObject does not have a host associated with it so you must specify one when saving.");
     }
     return(RemoveProject(proj, Host));
 }
Exemple #3
0
        public Task Get <AsanaT>(AsanaProject arg1, String arg2, AsanaResponseEventHandler callback) where AsanaT : AsanaObject
        {
            AsanaRequest request = default(AsanaRequest);

            if (typeof(AsanaT) == typeof(AsanaEvent))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetEventsInAProject), arg1, arg2);
                return(request.Go((o, h) => PackAndSendResponse <AsanaEvent>(o, callback), ErrorCallback));
            }


            throw new TypeAccessException("Unknown type for this request: " + typeof(AsanaT).Name);
        }
Exemple #4
0
        public Task RemoveProject(AsanaProject proj, Asana host)
        {
            Dictionary <string, object> project = new Dictionary <string, object>();

            project.Add("project", proj.ID);
            AsanaResponseEventHandler savedCallback = null;

            savedCallback = (s) =>
            {
                // add it manually
                int            index     = Array.IndexOf(Projects, proj);
                AsanaProject[] lProjects = new AsanaProject[Projects.Length - 1];
                if (index != 0)
                {
                    Array.Copy(Projects, lProjects, index);
                }
                Array.Copy(Projects, index + 1, lProjects, index, lProjects.Length - index);

                Projects = lProjects;
                Saving  -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.RemoveProjectFromTask), project));
        }
Exemple #5
0
 public Task GetTasksInAProject(AsanaProject arg1, AsanaCollectionResponseEventHandler callback)
 {
     var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksInAProject), arg1);
         return request.Go((o, h) => PackAndSendResponseCollection<AsanaTask>(o, callback), ErrorCallback);
 }
Exemple #6
0
        public void GetTasksInAProject(AsanaProject arg1, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksInAProject), arg1);

            request.Go((o, h) => PackAndSendResponseCollection <AsanaTask>(o, callback), ErrorCallback);
        }
Exemple #7
0
        public Task <AsanaEvent> GetEventsInAProjectAsync(AsanaProject asanaProject, String string1)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetEventsInAProject), asanaProject, string1);

            return(request.GoAsync <AsanaEvent>(true));
        }
Exemple #8
0
        public Task GetEventsInAProject(AsanaProject asanaProject, String string1, AsanaResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetEventsInAProject), asanaProject, string1);

            return(request.Go((o, h) => PackAndSendResponse <AsanaEvent>(o, callback), ErrorCallback));
        }
Exemple #9
0
        public Task <IAsanaObjectCollection <AsanaTask> > GetTasksInAProjectAsync(AsanaProject asanaProject)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksInAProject), asanaProject);

            return(request.GoCollectionAsync <AsanaTask>());
        }
Exemple #10
0
 public void RemoveProject(AsanaProject proj)
 {
     if (Host == null)
         throw new NullReferenceException("This AsanaObject does not have a host associated with it so you must specify one when saving.");
     RemoveProject(proj, Host);
 }
Exemple #11
0
        public void RemoveProject(AsanaProject proj, Asana host)
        {
            Dictionary<string, object> project = new Dictionary<string, object>();
            project.Add("project", proj.ID);
            AsanaResponseEventHandler savedCallback = null;
            savedCallback = (s) =>
            {
                // add it manually
                int index = Array.IndexOf(Projects, proj);
                AsanaProject[] lProjects = new AsanaProject[Projects.Length - 1];
                if(index != 0)
                    Array.Copy(Projects, lProjects, index);
                Array.Copy(Projects, index+1, lProjects, index, lProjects.Length - index);

                Projects = lProjects;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            host.Save(this, AsanaFunction.GetFunction(Function.RemoveProjectFromTask), project);
        }
Exemple #12
0
        public void AddProject(AsanaProject proj, Asana host)
        {
            Dictionary<string, object> project = new Dictionary<string, object>();
            project.Add("project", proj.ID);
            AsanaResponseEventHandler savedCallback = null;
            savedCallback = (s) =>
            {
                // add it manually
                if (Projects == null)
                    Projects = new AsanaProject[1];
                else
                {
                    AsanaProject[] lProjects = Projects;
                    Array.Resize(ref lProjects, Projects.Length + 1);
                    Projects = lProjects;
                }

                Projects[Projects.Length - 1] = proj;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            host.Save(this, AsanaFunction.GetFunction(Function.AddProjectToTask), project);
        }