public ClientPhoto(Data.Photo source) { this.ImageUrl = ComicUrlHelper.GetPhotoUrl(source); this.PhotoId = source.PhotoId; this.Height = source.Height; this.Width = source.Width; }
public ClientProfileTask(ProfileTask source) { this.TaskId = source.TaskId; this.Status = source.Status; this.OwnerUid = source.OwnerUid; this.Effect = source.Effect; this.RenderUrl = ComicUrlHelper.GetProfileRenderUrl(source.StorageKey); this.Intensity = source.Intensity; }
protected List <ClientEffect> GetEffects() { List <ClientEffect> effects = new List <ClientEffect>(); effects.Add(new ClientEffect("Comic", ComicUrlHelper.GetImageUrl("Effect/comic.png"), ComicEffectType.Comic)); effects.Add(new ClientEffect("Color Sketch", ComicUrlHelper.GetImageUrl("Effect/color-sketch.png"), ComicEffectType.ColorSketch)); effects.Add(new ClientEffect("Pencil Sketch", ComicUrlHelper.GetImageUrl("Effect/pencil-sketch.png"), ComicEffectType.PencilSketch)); return(effects); }
public ClientUser(User source) { this.Uid = source.Uid; this.Name = source.Name; this.Nickname = source.Nickname; this.FbLink = source.FbLink; this.AuthorUrl = ComicUrlHelper.GetAuthorUrl(source); this.ThumbUrl = String.Format("http://graph.facebook.com/{0}/picture", source.Uid); }
public ClientTextBubbleDirection(TextBubbleDirection direction) { this.TextBubbleDirectionId = direction.TextBubbleDirectionId; this.Title = direction.TextBubble.Title; this.BaseScaleX = direction.TextBubble.BaseScaleX; this.BaseScaleY = direction.TextBubble.BaseScaleY; this.TextScaleX = direction.TextBubble.TextScaleX; this.TextScaleY = direction.TextBubble.TextScaleY; this.Direction = direction.Direction; this.ImageUrl = ComicUrlHelper.GetStaticUrl("Image/TextBubble/{0}-{1}.png", direction.TextBubble.Title, direction.Direction); }
public ClientTemplate(Template source) { this.TemplateId = source.TemplateId; this.Width = source.Width; this.Height = source.Height; this.Ordinal = source.Ordinal; this.Size = source.Size; this.IsDeleted = source.IsDeleted; this.ThumbUrl = ComicUrlHelper.GetImageUrl(source.Thumb); this.FrameCount = source.TemplateItems.Count; this.TemplateItems = source.TemplateItems .ToList() .Select(i => new ClientTemplateItem(i)) .OrderBy(i => i.Ordinal) .ToList(); }
public void Start() { Log.Info("Starting"); this.UpdateTimer = new System.Threading.Timer(delegate(object state) { try { FacebookOAuthClient authClient = new FacebookOAuthClient(FacebookApplication.Current); string token = authClient.GetApplicationAccessToken() as string; FacebookClient facebook = new FacebookClient(token); IFacebookApplication app = ConfigurationManager.GetSection("facebookSettings") as IFacebookApplication; Dictionary <string, object> authParameters = new Dictionary <string, object>(); authParameters.Add("client_id", app.AppId); authParameters.Add("client_secret", app.AppSecret); authParameters.Add("grant_type", "client_credentials"); facebook.Get("/oauth/access_token", authParameters); ConnectionStringSettings connectionString = ConfigurationManager.ConnectionStrings["ComicModelContext"]; using (ComicModelContext context = new ComicModelContext(connectionString.ConnectionString)) { foreach (User user in context.ListUnsubscriberUsers()) { Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("object", "user"); parameters.Add("fields", "name,link,email,locale"); parameters.Add("callback_url", ComicUrlHelper.GetWebUrl("/User/Subscription")); parameters.Add("verify_token", "erock"); //this.Facebook.Post(String.Format("/{0}/subscriptions", ComicConfigSectionGroup.Facebook.AppId), parameters); //this.ActiveUser.IsSubscribed = true; } } } catch (Exception x) { Log.Error(x); } }, null, new TimeSpan(0, 0, 0), new TimeSpan(1, 0, 0)); }
protected virtual void SubscribeActiveUser() { try { FacebookOAuthClient authClient = new FacebookOAuthClient(FacebookApplication.Current); dynamic auth = authClient.GetApplicationAccessToken(); Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("object", "user"); parameters.Add("fields", "name,link,email,locale"); parameters.Add("callback_url", ComicUrlHelper.GetWebUrl("/User/Subscription")); parameters.Add("verify_token", VERIFY_TOKEN); FacebookClient subscriptionClient = new FacebookClient(auth.access_token); subscriptionClient.Post(String.Format("/{0}/subscriptions", ComicConfigSectionGroup.Facebook.AppId), parameters); } catch (Exception x) { this.Log.Error("Unable to subscribe.", x); } }
public RedirectResult Random() { RedirectResult result; try { this.EntityContext.TryAttach(this.ActiveUser); Data.Comic comic = this.EntityContext.TryGetRandomComic(this.ActiveUser, this.Friends); if (comic == null || (comic.IsPrivate && !this.IsFriendOrSelf(comic.Author))) { throw new Exception("Unable to find the requested comic."); } result = this.Redirect(ComicUrlHelper.GetReadUrl(comic)); } finally { this.EntityContext.TryDetach(this.ActiveUser); } return(result); }
protected void Init(Data.Comic source, ComicStat.ComicStatPeriod statsPeriod) { this.ComicId = source.ComicId; this.Uid = source.Uid; this.TemplateId = source.TemplateId; this.CreateTime = source.CreateTime; this.UpdateTime = source.UpdateTime; this.PublishTime = source.PublishTime; this.FeatureTime = source.FeatureTime; this.IsPublished = source.IsPublished; this.Title = source.Title; this.Description = source.Description; this.ShareText = source.ShareText; this.IsPrivate = source.IsPrivate; this.ReadUrl = ComicUrlHelper.GetReadUrl(source); this.ComicUrl = ComicUrlHelper.GetRenderUrl(source, RenderMode.Comic); this.ThumbUrl = ComicUrlHelper.GetRenderUrl(source, RenderMode.Thumb); this.FrameUrl = ComicUrlHelper.GetRenderUrl(source, RenderMode.Frame); this.FrameThumbUrl = ComicUrlHelper.GetRenderUrl(source, RenderMode.FrameThumb); this.RemixUrl = ComicUrlHelper.GetRemixUrl(source); this.Author = new ClientUser(source.Author); this.Stats = new ClientComicStat(source.PeriodStats(statsPeriod)); this.Template = new ClientTemplate(source.Template); if (source.ComicTextBubbles.IsLoaded) { this.Bubbles = source.ComicTextBubbles.ToList().Select(b => new ClientComicTextBubble(b)).ToList(); } if (source.ComicPhotos.IsLoaded) { this.Photos = source.ComicPhotos .OrderBy(p => p.TemplateItem.Ordinal) .ToList() .Select(p => new ClientPhoto(p.Photo)) .ToList(); } }