示例#1
0
        public Task AddTag(AsanaTag proj, Asana host)
        {
            Dictionary <string, object> Tag = new Dictionary <string, object>();

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

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

                Tags[Tags.Length - 1] = proj;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.AddTagToTask), Tag));
        }
示例#2
0
 public Task RemoveTag(AsanaTag 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(RemoveTag(proj, Host));
 }
示例#3
0
        public Task Get <AsanaT>(AsanaTag arg1, AsanaCollectionResponseEventHandler callback) where AsanaT : AsanaObject
        {
            AsanaRequest request = default(AsanaRequest);

            if (typeof(AsanaT) == typeof(AsanaTask))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksByTag), arg1);
                return(request.Go((o, h) => PackAndSendResponseCollection <AsanaTask>(o, callback), ErrorCallback));
            }


            throw new TypeAccessException("Unknown type for this request: " + typeof(AsanaT).Name);
        }
示例#4
0
        public Task RemoveTag(AsanaTag proj, Asana host)
        {
            Dictionary <string, object> Tag = new Dictionary <string, object>();

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

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

                Tags    = lTags;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.RemoveTagFromTask), Tag));
        }
示例#5
0
 public Task GetTasksByTag(AsanaTag arg1, AsanaCollectionResponseEventHandler callback)
 {
     var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksByTag), arg1);
         return request.Go((o, h) => PackAndSendResponseCollection<AsanaTask>(o, callback), ErrorCallback);
 }
示例#6
0
        public Task <IAsanaObjectCollection <AsanaTask> > GetTasksByTagAsync(AsanaTag asanaTag)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksByTag), asanaTag);

            return(request.GoCollectionAsync <AsanaTask>());
        }
示例#7
0
        public Task GetTasksByTag(AsanaTag asanaTag, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksByTag), asanaTag);

            return(request.Go((o, h) => PackAndSendResponseCollection <AsanaTask>(o, callback), ErrorCallback));
        }
示例#8
0
 public Task RemoveTag(AsanaTag 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 RemoveTag(proj, Host);
 }
示例#9
0
        public Task RemoveTag(AsanaTag proj, Asana host)
        {
            Dictionary<string, object> Tag = new Dictionary<string, object>();
            Tag.Add("tag", proj.ID);
            AsanaResponseEventHandler savedCallback = null;
            savedCallback = (s) =>
            {
                // add it manually
                int index = Array.IndexOf(Tags, proj);
                AsanaTag[] lTags = new AsanaTag[Tags.Length - 1];
                if (index != 0)
                    Array.Copy(Tags, lTags, index);
                Array.Copy(Tags, index + 1, lTags, index, lTags.Length - index);

                Tags = lTags;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return host.Save(this, AsanaFunction.GetFunction(Function.RemoveTagFromTask), Tag);
        }
示例#10
0
        public Task AddTag(AsanaTag proj, Asana host)
        {
            Dictionary<string, object> Tag = new Dictionary<string, object>();
            Tag.Add("tag", proj.ID);
            AsanaResponseEventHandler savedCallback = null;
            savedCallback = (s) =>
            {
                // add it manually
                if (Tags == null)
                    Tags = new AsanaTag[1];
                else
                {
                    AsanaTag[] lTags = Tags;
                    Array.Resize(ref lTags, Tags.Length + 1);
                    Tags = lTags;
                }

                Tags[Tags.Length - 1] = proj;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return host.Save(this, AsanaFunction.GetFunction(Function.AddTagToTask), Tag);
        }