当前位置: 首页>>代码示例>>C#>>正文


C# CommunicationHelper类代码示例

本文整理汇总了C#中CommunicationHelper的典型用法代码示例。如果您正苦于以下问题:C# CommunicationHelper类的具体用法?C# CommunicationHelper怎么用?C# CommunicationHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommunicationHelper类属于命名空间,在下文中一共展示了CommunicationHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Delete

 /// <summary>
 /// Deletes an existing printmark
 /// </summary>
 /// <returns></returns>
 public bool Delete()
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], PrintmarkID [required], Callback, Pretty, Strict
     var resp = ch.ExecuteMethod<SmugMugResponse>("smugmug.printmarks.delete", basic, "PrintmarkID", id);
     if (resp.stat == "ok")
         return true;
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:17,代码来源:Printmark.cs

示例2: Login

 /// <summary>
 /// Authenticates a user based on the specified user id and password hash.
 /// </summary>
 /// <param name="UserId">The id for a specific user</param>
 /// <param name="PasswordHash">The password hash for the user</param>
 /// <param name="Extras">A comma separated string of additional attributes to return in the response</param>
 /// <returns>Login (AccountStatus, AccountType, FileSizeLimit, SessionID, SmugVault, User (id, DisplayName, NickName, URL))</returns>
 public MyUser Login(int UserId, string PasswordHash, string Extras)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // APIKey [required], Callback, Extras, PasswordHash [required], Pretty, Sandboxed, Strict, UserID [required]
     string su;
     var resp = ch.ExecuteMethod<LoginResponse>("smugmug.login.withHash", null, out su, "UserID", UserId, "PasswordHash", PasswordHash, "Extras", Extras);
     if (resp.stat == "ok")
     {
         MyUser u = new MyUser();
         resp.Login.PopulateUser(u);
         u.basic._su = su;
         return u;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:26,代码来源:Site.cs

示例3: StylesGetTemplatesAsync

 /// <summary>
 /// Retrieves a list of style templates
 /// </summary>
 /// <param name="Associative">Returns an associative array. Default: false </param>
 /// <returns>List of Templates (id and Name)</returns>
 public async Task<List<Template>> StylesGetTemplatesAsync(bool Associative)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // Associative, Callback, Pretty, Strict
     var resp = await ch.ExecuteMethod<TemplateResponse>("smugmug.styles.getTemplates", null, "Associative", Associative);
     if (resp.stat == "ok")
     {
         var temp = new List<Template>();
         temp.AddRange(resp.Templates);
         return temp;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:22,代码来源:Site.cs

示例4: PingAsync

 /// <summary>
 /// Pings SmugMug
 /// </summary>
 /// <returns>Returns an empty successful response, if it completes without error.</returns>
 public async Task<bool> PingAsync()
 {
     // APIKey [required], Callback, Pretty
     CommunicationHelper ch = new CommunicationHelper();
     var resp = await ch.ExecuteMethod<SmugMugResponse>("smugmug.service.ping", null);
     if (resp.stat == "ok")
         return true;
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:17,代码来源:Site.cs

示例5: Modify

 /// <summary>
 /// Updates specific settings (Dissolve, ImageID, Location, Name) for the current printmark. If any of the parameters are missing or are empty strings "", they're ignored and the current settings are preserved. Otherwise, they're updated with the new settings.
 /// </summary>
 /// <param name="Name">The name for the printmark</param>
 /// <param name="Location">The location of the printmark on the target image. Values: TopLeft, TopRight, BottomLeft, BottomRight, Top, Bottom</param>
 /// <param name="Dissolve">The opacity of the printmark on the target image. Min: 0. Max: 100</param>
 /// <param name="ImageID">The id for a specific image</param>
 /// <param name="Extras">A comma separated string of additional attributes to return in the response.</param>
 /// <returns>Returns an empty successful response, if it completes without error</returns>
 public bool Modify(string Dissolve, string ImageID, string Location, string Name, string Extras)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], PrintmarkID [required], Callback, Dissolve, Extras, ImageID, Location, Name, Pretty, Strict
     var resp = ch.ExecuteMethod<SmugMugResponse>("smugmug.printmarks.modify", basic, "PrintmarkID", this.id, "Dissolve", Dissolve, "Extras", Extras, "ImageID", ImageID, "Location", Location, "Name", Name);
     if (resp.stat == "ok")
         return true;
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:22,代码来源:Printmark.cs

示例6: GetInfo

 /// <summary>
 /// Retrieves the details for a specified album (id, Key, Backprinting, CanRank, CategoryID and Name, Clean, ColorCorrection, Comments, CommunityID and Name, Description, EXIF, External, FamilyEdit, FriendEdit, Geography, Header, HideOwner, HighlightID and Key, ImageCount, Larges, LastUpdated, NiceName, Originals, Password, PasswordHint, Position, Printable, ProofDays, Protected, Public, Share, SmumugSearchable, SortDirection, SortMethod, SquareThumbs, SubCategoryID and Name, TemplateID, ThemeID and Name and Type, Title, Unique, UnsharpAmount, UnsharpRadius, UnsharpSigma, UnsharpThreshold, WatermarkID and Name, Watermarking, WorldSearchable, X2Larges, X3Larges, XLarges)
 /// </summary>
 /// <param name="SitePassword">The site password for a specific user</param>
 /// <returns></returns>
 public Album GetInfo(string SitePassword)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], AlbumID [required], AlbumKey [required], Callback, Password, Pretty, Sandboxed, SitePassword, Strict
     AlbumResponse resp = new AlbumResponse();
     if (!String.IsNullOrEmpty(this.Password))
         resp = ch.ExecuteMethod<AlbumResponse>("smugmug.albums.getInfo", basic, "AlbumID", id, "AlbumKey", Key, "SitePassword", SitePassword, "Password", Password);
     else
         resp = ch.ExecuteMethod<AlbumResponse>("smugmug.albums.getInfo", basic, "AlbumID", id, "AlbumKey", Key, "SitePassword", SitePassword);
     if (resp.stat == "ok")
     {
         var myAlbum= resp.Album;
         myAlbum.basic = basic;
         //Hack: The class has 2 properties with the same name - Comments. I've separated them in 2 different properties (HasComments and CommentsList)
         if (myAlbum.Comments != null)
             myAlbum.HasComments = (bool)myAlbum.Comments;
         return myAlbum;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:29,代码来源:Album.cs

示例7: GetComments

 /// <summary>
 /// Retrieves a list of comments for an album
 /// </summary>
 /// <param name="Associative">Returns an associative array</param>
 /// <param name="LastUpdated">Return results where LastUpdated is after the epoch time provided</param>
 /// <param name="SitePassword">The site password for a specific user</param>
 public void GetComments(bool Associative, int LastUpdated, string SitePassword)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], AlbumID [required], Key [required], Password, Associative, Callback, LastUpdated, Pretty, SitePassword, Strict
     AlbumResponse resp = new AlbumResponse();
     if ((this != null) && !(string.IsNullOrEmpty(this.Password)))
         resp = ch.ExecuteMethod<AlbumResponse>("smugmug.albums.comments.get", basic, "AlbumID", id, "AlbumKey", Key, "SitePassword", SitePassword, "Password", Password, "LastUpdated", LastUpdated, "Associative", Associative);
     else
         resp = ch.ExecuteMethod<AlbumResponse>("smugmug.albums.comments.get", basic, "AlbumID", id, "AlbumKey", Key, "SitePassword", SitePassword, "LastUpdated", LastUpdated, "Associative", Associative);
     if (resp.stat == "ok")
     {
         //Hack: The class has 2 properties with the same name - Comments. I've separated them in 2 different properties (HasComments and CommentsList)
         if (this.CommentsList == null)
             this.CommentsList = new List<Comment>();
         this.CommentsList = (List<Comment>)resp.Album.Comments;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:28,代码来源:Album.cs

示例8: RemoveAlbumAsync

 /// <summary>
 /// Removes an album from a specified sharegroup 
 /// </summary>
 /// <param name="AlbumToRemove">Album to be removed from the sharegroup</param>
 /// <returns></returns>
 public async Task<bool> RemoveAlbumAsync(Album AlbumToRemove)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ShareGroupID [required], AlbumID [required], Callback, Pretty, Strict 
     var resp = await ch.ExecuteMethod<SmugMugResponse>("smugmug.sharegroups.albums.remove", basic, "ShareGroupID", id, "AlbumID", AlbumToRemove.id);
     if (resp.stat == "ok")
     {
         if (this.Albums != null)
         {
             // Remove the album from this sharegroup
             this.Albums.Remove(AlbumToRemove);
             // Decrease the no of albums this sharegroup has
             this.AlbumCount--;
         }
         return true;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:27,代码来源:ShareGroup.cs

示例9: AddAlbumAsync

 /// <summary>
 /// Adds an album to a specified sharegroup 
 /// </summary>
 /// <param name="AlbumToAdd">Album to be added to the sharegroup.</param>
 /// <returns></returns>
 public async Task<bool> AddAlbumAsync(Album AlbumToAdd)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ShareGroupID [required], AlbumID [required], Callback, Pretty, Strict 
     var resp = await ch.ExecuteMethod<SmugMugResponse>("smugmug.sharegroups.albums.add", basic, "ShareGroupID", this.id, "AlbumID", AlbumToAdd.id);
     if (resp.stat == "ok")
     {
         if (this.Albums == null)
             this.Albums = new List<Album>();
         // Add the album to the current object
         this.Albums.Add(AlbumToAdd);
         // Increase the no of albums this sharegroup has
         this.AlbumCount++;
         return true;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:26,代码来源:ShareGroup.cs

示例10: ModifyAsync

 /// <summary>
 /// Updates specific settings (Dissolve, ImageID, Location, Name) for a the current sharegroup. If any of the parameters are missing or are empty strings "", they're ignored and the current settings are preserved. Otherwise, they're updated with the new settings.
 /// </summary>
 /// <param name="AccessPassworded">Allow access to password protected albums from the sharegroup without the password. Default: false.</param>
 /// <param name="Description">The description for the sharegroup</param>
 /// <param name="Name">The name for the sharegroup</param>
 /// <param name="Password">The password for the sharegroup</param>
 /// <param name="PasswordHint">The password hint for the sharegroup</param>
 /// <param name="Extras">A comma separated string of additional attributes to return in the response</param>
 /// <returns>Returns an empty successful response, if it completes without error</returns>
 public async Task<bool> ModifyAsync(bool AccessPassworded, string Description, string Name, string Password, string PasswordHint, string Extras)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ShareGroupID [required], AccessPassworded, Callback, Description, Extras, Name, Password, PasswordHint, Pretty, Strict
     var resp = await ch.ExecuteMethod<SmugMugResponse>("smugmug.sharegroups.modify", basic, "AccessPassworded", AccessPassworded, "Description", Description, "Extras", Extras, "Name", Name, "Password", Password, "PasswordHint", PasswordHint);
     if (resp.stat == "ok")
         return true;
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:23,代码来源:ShareGroup.cs

示例11: PopulateShareGroupWithInfoFromSiteAsync

 /// <summary>
 /// Populate the current sharegroup with info from the site  (id, Tag, AccessPassworded, AlbumCount, Albums array - id, key, Title; Description, Name, Password, PasswordHint, Passworded, URL)
 /// </summary>        
 /// <param name="Password">The password for the sharegroup</param>
 /// <param name="ShareGroupTag">The tag (public id) for the sharegroup</param>
 /// <param name="Extras">A comma separated string of additional attributes to return in the response</param>
 public async Task PopulateShareGroupWithInfoFromSiteAsync(string Password, string Extras)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ShareGroupID [required], Callback, Extras, Password, Pretty, SharegroupTag, Strict
     var resp = await ch.ExecuteMethod<ShareGroupResponse>("smugmug.sharegroups.getInfo", basic, "ShareGroupID", id, "Password", Password, "ShareGroupTag", this.Tag, "Extras", Extras);
     if (resp.stat == "ok")
         PopulateWithResponse(resp.ShareGroup, this);
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:19,代码来源:ShareGroup.cs

示例12: DeleteAsync

 /// <summary>
 /// Deletes  a specified sharegroup
 /// </summary>
 /// <returns>Returns an empty successful response, if it completes without error</returns>
 public async Task<bool> DeleteAsync()
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ShareGroupID [required], Callback, Pretty, Strict
     var resp = await ch.ExecuteMethod<SmugMugResponse>("smugmug.sharegroups.delete", basic, "ShareGroupID", id);
     if (resp.stat == "ok")
         return true;
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:17,代码来源:ShareGroup.cs

示例13: GetPrintmarks

 /// <summary>
 /// Retrieve the user's list of printmarks.
 /// </summary>
 /// <param name="Heavy">Returns a heavy response for this method. Default: false.</param>
 /// <param name="Extras">A comma separated string of additional attributes to return in the response.</param>
 /// <returns>List of printmarks</returns>
 public List<Printmark> GetPrintmarks(bool Heavy, string Extras)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], Associative, Callback, Extras, Heavy, Pretty, Strict
     var resp = ch.ExecuteMethod<PrintmarkResponse>("smugmug.printmarks.get", basic, "Heavy", Heavy, "Extras", Extras);
     if (resp.stat == "ok")
     {
         List<Printmark> printmarkList = new List<Printmark>();
         printmarkList.AddRange(resp.Printmarks);
         if (printmarkList != null)
         {
             foreach (var myPrintmark in printmarkList)
             {
                 myPrintmark.basic = basic;
             }
         }
         return printmarkList;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:30,代码来源:MyUser.cs

示例14: ApplyWatermark

 /// <summary>
 /// Applies a watermark to the images of an album
 /// </summary>
 /// <param name="w">The id for a specific watermark</param>
 /// <returns></returns>
 public bool ApplyWatermark(Watermark w)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], AlbumID [required], WatermarkID [required], Callback, Pretty, Strict
     var resp = ch.ExecuteMethod<SmugMugResponse>("smugmug.albums.applyWatermark", basic, "AlbumID", id, "WatermarkID", w.id);
     if (resp.stat == "ok")
         return true;
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:18,代码来源:Album.cs

示例15: ChangeSettings

        /// <summary>
        /// Change the settings of an existing album - AlbumTemplateID, Backprinting (pro), BoutiquePackaging (pro), CanRank, CategoryID, Clean, ColorCorrection, Comments, CommunityID, DefaultColor  (pro), Description, EXIF, External, FamilyEdit, FriendEdit, Geography, Header (power, pro), HideOwner, HighlightID, Keywords, Larges, NiceName, Originals, PackagingBranding (pro), Password, PasswordHint, Position, Printable, PrintmarkID (pro), ProofDays, Protected (power, pro), Public, Share, SmumugSearchable, SortDirection, SortMethod, SquareThumbs, SubCategoryID, TemplateID, ThemeID, UnsharpAmount (power, pro), UnsharpRadius (power, pro), UnsharpSigma (power, pro), UnsharpThreshold (power, pro), WatermarkID (pro), Watermarking (pro), WorldSearchable, X2Larges, X3Larges, XLarges (pro)
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public bool ChangeSettings()
        {
            CommunicationHelper ch = new CommunicationHelper();
            // SessionID [required], AlbumID [required], Callback, Pretty, Strict, AlbumTemplateID, Backprinting (pro), BoutiquePackaging, CanRank,
            // CategoryID, Clean, ColorCorrection, Comments, CommunityID, DefaultColor  (pro), Description, EXIF, External, FamilyEdit,
            // FriendEdit, Geography, Header (power&pro), HideOwner, HighlightID, Keywords, Larges, NiceName, Originals, PackagingBranding, Password,
            // PasswordHint, Position, Printable, PrintmarkID, ProofDays, Protected (power&pro), Public, Share, SmumugSearchable, SortDirection,
            // SortMethod, SquareThumbs, SubCategoryID, TemplateID, ThemeID, UnsharpAmount (power&pro), UnsharpRadius (power&pro), UnsharpSigma (power&pro),
            // UnsharpThreshold (power&pro), WatermarkID (pro), Watermarking (pro), WorldSearchable, X2Larges, X3Larges, XLarges (pro)
            // Hack: The class has 2 properties with the same name - Comments. I've separated them in 2 different properties (HasComments and CommentsList)
            var ls = BuildPropertiesValueList(this, "HasComments", "CommentsList", "Comments","Watermark");
            ls.Add("Comments"); ls.Add(this.HasComments.ToString());
            ls.Add("AlbumID"); ls.Add(this.id.ToString());

            //if there is a watermark, use the id
            if (this.Watermark != null)
            {
                ls.Add("WatermarkID"); ls.Add(this.Watermark.id.ToString());
            }

            if (this.AlbumTemplate != null)
            {
                ls.Add("AlbumTemplateID"); ls.Add(this.AlbumTemplate.id.ToString());
            }

            var resp = ch.ExecuteMethod<AlbumResponse>("smugmug.albums.changeSettings", basic, ls.ToArray());
            if (resp.stat == "ok")
                return true;
            else
            {
                Console.WriteLine(resp.message);
                throw new SmugMugException(resp.code, resp.message, resp.method);
            }
        }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:39,代码来源:Album.cs


注:本文中的CommunicationHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。