private void loadTweets(CreatorDto creator) { // Console.WriteLine(creator.Twitter != null); // Console.WriteLine(creator.Twitter?.Tweets[0] != null); // Console.WriteLine(creator.Twitter.Tweets[1].Text); // newest_tweet.Text = creator.Twitter.Tweets.First().Text; }
public Popup(CreatorDto creator = null) { CreatingNew = creator == null; Creator = creator ?? new CreatorDto(); InitializeComponent(); button_create_creator.Enabled = false; button_create_creator.Text = CreatingNew ? "Create" : "Update"; delete_button.Visible = !CreatingNew; // if else ish // creator_name_write.Text = Creator.Name; //yt handle //twitter handle var na = ""; creator_name_write.Text = Creator.Name != null ? Creator.Name : na; yt_name_write.Text = Creator.Youtube?.RemoteId != null ? Creator.Youtube.RemoteId : na; twitter_name_write.Text = Creator.Twitter?.Handle != null ? Creator.Twitter.Handle : na; twitch_write_name.Text = Creator.Twitch?.Handle != null ? Creator.Twitch.Handle : na; // SetButton(); }
public static Creator FromDto(this CreatorDto creatorDto) { return(new Creator { Name = creatorDto.name, Version = float.Parse(creatorDto.version, CultureInfo.InvariantCulture.NumberFormat), Comment = creatorDto.comment }); }
public void Insert(CreatorDto dto) { if (dto == null) { return; } _logger.LogInformation("Inserting 'Creator' record {@dto}", dto); DataSource.Creators.Add(dto); }
public void Update(CreatorDto dto) { if (dto == null) { return; } _logger.LogInformation("Updating 'Creator' record {@dto}", dto); var creatorToUpdate = DataSource.Creators.FirstOrDefault(c => c.Id == dto.Id); if (creatorToUpdate != null) { DataSource.Creators.Remove(creatorToUpdate); DataSource.Creators.Add(dto); } }
private async void button_create_creator_Click(object sender, EventArgs e) { CreatorDto resultDTO = null; if (CreatingNew) { CreateCreatorDto dto = new CreateCreatorDto(); dto.Name = creator_name_write.Text; if (yt_name_write.Text.Length > 0) { dto.YoutubeHandle = yt_name_write.Text; } if (twitter_name_write.Text.Length > 0) { dto.TwitterHandle = twitter_name_write.Text; } if (twitch_write_name.Text.Length > 0) { dto.TwitchHandle = twitch_write_name.Text; } resultDTO = await new CreatorWebService().CreateCreator(dto); } else if (!CreatingNew) { UpdateCreatorDto dto = new UpdateCreatorDto(); dto.Name = creator_name_write.Text; if (yt_name_write.Text.Length > 0) { dto.YoutubeHandle = yt_name_write.Text; } if (twitter_name_write.Text.Length > 0) { dto.TwitterHandle = twitter_name_write.Text; } if (twitch_write_name.Text.Length > 0) { dto.TwitchHandle = twitch_write_name.Text; } resultDTO = await new CreatorWebService().UpdateCreator(Creator.Id, dto); } if (resultDTO != null) { DialogResult = DialogResult.OK; } }
public static Creator From(CreatorDto dto) { if (dto == null) { return(null); } return(new Creator() { Id = dto.Id, ParentId = dto.ParentId, FirstName = dto.FirstName, LastName = dto.LastName, ParentType = (CreatorParentType)dto.ParentTypeId, Type = (CreativeType)dto.TypeId }); }
public Seed() { var defaultSongbook = new SongbookDto() { Id = new Guid("21924d66-dac6-43a5-beee-206de4d35216"), Title = "Psalms, Hymns, and Spiritual Songs", ISBN10 = "1584273526", ISBN13 = "9781584273523", Publisher = "Sumphonia Productions LLD (2012)" }; var defaultSongbookCreators = new List <CreatorDto>() { new CreatorDto() { Id = new Guid("fdfba83c-08aa-42a4-b1c1-46b8e154f297"), ParentId = defaultSongbook.Id, FirstName = "David", LastName = "Maravilla", ParentTypeId = (int)CreativeType.Editor, TypeId = (int)CreatorParentType.Songbook }, new CreatorDto() { Id = new Guid("e2495b99-9fd0-4be6-b2db-893ce69a6f38"), ParentId = defaultSongbook.Id, FirstName = "Matt", LastName = "Bassford", ParentTypeId = (int)CreativeType.TechnicalEditor, TypeId = (int)CreatorParentType.Songbook } }; var defaultSong = new SongDto() { Id = new Guid("6767f7f5-0dc9-4b78-a0f0-e450e4b60889"), SongbookId = defaultSongbook.Id, Title = "Nearer, My God, to Thee", SongNumber = 328, Key = "G", SolfaTypeId = (int)SolfaType.Mi, TimeSignature = "4/4", Tune = "Bethany" }; var defaultSongCreator = new CreatorDto() { Id = new Guid("d3788116-90f7-40d4-9a82-a3cef6e769df"), ParentId = defaultSong.Id, FirstName = "Sarah Flower", LastName = "Adams", ParentTypeId = (int)CreativeType.Writer, TypeId = (int)CreatorParentType.Song }; Songbooks.Add(defaultSongbook); Songs.Add(defaultSong); Creators.AddRange(defaultSongbookCreators); Creators.Add(defaultSongCreator); }
private async void loadActiveasd(CreatorDto creator, bool forceProfileView) { var creatorIndex = _creatorsFromService.FindIndex(c => c.Id == creator.Id); _creatorsFromService[creatorIndex] = await new CreatorWebService().GetCreator(creator.Id); creator = _creatorsFromService[creatorIndex]; var path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; allCreatorStatistics_Panel.Visible = !forceProfileView; label_main_creator_name.Text = creator.Name; if (creator.Twitter?.ImageUrl != null) { picturebox_main_creator_image.Load(creator.Twitter?.ImageUrl); picturebox_creator_twitter_image_1.Load(creator.Twitter?.ImageUrl); System.Drawing.Drawing2D.GraphicsPath gp1 = new System.Drawing.Drawing2D.GraphicsPath(); gp1.AddEllipse(0, 0, picturebox_creator_twitter_image_1.Width - 3, picturebox_creator_twitter_image_1.Height - 3); Region r1 = new Region(gp1); picturebox_creator_twitter_image_1.Region = r1; picturebox_creator_twitter_image_1.SizeMode = PictureBoxSizeMode.StretchImage; picturebox_creator_twitter_image_2.Load(creator.Twitter?.ImageUrl); System.Drawing.Drawing2D.GraphicsPath gp2 = new System.Drawing.Drawing2D.GraphicsPath(); gp2.AddEllipse(0, 0, picturebox_creator_twitter_image_2.Width - 3, picturebox_creator_twitter_image_2.Height - 3); Region r2 = new Region(gp2); picturebox_creator_twitter_image_2.Region = r2; picturebox_creator_twitter_image_2.SizeMode = PictureBoxSizeMode.StretchImage; picturebox_creator_twitter_image_3.Load(creator.Twitter?.ImageUrl); System.Drawing.Drawing2D.GraphicsPath gp3 = new System.Drawing.Drawing2D.GraphicsPath(); gp3.AddEllipse(0, 0, picturebox_creator_twitter_image_3.Width - 3, picturebox_creator_twitter_image_3.Height - 3); Region r3 = new Region(gp3); picturebox_creator_twitter_image_3.Region = r3; picturebox_creator_twitter_image_3.SizeMode = PictureBoxSizeMode.StretchImage; newest_tweet.Text = creator.Twitter.Tweets[0].Text; first_quote_creator_amount.Text = creator.Twitter.Tweets[0].Quotes.ToString(); first_tweet_retweet_amount.Text = creator.Twitter.Tweets[0].Retweets.ToString(); first_tweet_likes_amount.Text = creator.Twitter.Tweets[0].Likes.ToString(); second_newest_tweet.Text = creator.Twitter.Tweets[1].Text; second_tweet_quote_amount.Text = creator.Twitter.Tweets[1].Quotes.ToString(); creator_two_retweet_amount.Text = creator.Twitter.Tweets[1].Retweets.ToString(); second_tweet_likes_amount.Text = creator.Twitter.Tweets[1].Likes.ToString(); third_newest_tweet.Text = creator.Twitter.Tweets[2].Text; third_tweet_quote_amount.Text = creator.Twitter.Tweets[2].Quotes.ToString(); third_tweet_retweet_amount.Text = creator.Twitter.Tweets[2].Retweets.ToString(); third_tweet_likes_amount.Text = creator.Twitter.Tweets[2].Likes.ToString(); } else if (creator.Twitch?.ProfileImageUrl != null) { picturebox_main_creator_image.Load(creator.Twitch?.ProfileImageUrl); // System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath(); // gp.AddEllipse(0, 0, picturebox_main_creator_image.Width - 3, picturebox_main_creator_image.Height - 3); // Region r = new Region(gp); // picturebox_main_creator_image.Region = r; // picturebox_main_creator_image.SizeMode = PictureBoxSizeMode.StretchImage; // } // picturebox_creator_twitter_image_1.Image = Image.FromFile($@"{path}\Images\unknown_image.png"); System.Drawing.Drawing2D.GraphicsPath gp1 = new System.Drawing.Drawing2D.GraphicsPath(); gp1.AddEllipse(0, 0, picturebox_creator_twitter_image_1.Width - 3, picturebox_creator_twitter_image_1.Height - 3); Region r1 = new Region(gp1); picturebox_creator_twitter_image_1.Region = r1; picturebox_creator_twitter_image_1.SizeMode = PictureBoxSizeMode.StretchImage; picturebox_creator_twitter_image_2.Image = Image.FromFile($@"{path}\Images\unknown_image.png"); System.Drawing.Drawing2D.GraphicsPath gp2 = new System.Drawing.Drawing2D.GraphicsPath(); gp2.AddEllipse(0, 0, picturebox_creator_twitter_image_2.Width - 3, picturebox_creator_twitter_image_2.Height - 3); Region r2 = new Region(gp2); picturebox_creator_twitter_image_2.Region = r2; picturebox_creator_twitter_image_2.SizeMode = PictureBoxSizeMode.StretchImage; picturebox_creator_twitter_image_3.Image = Image.FromFile($@"{path}\Images\unknown_image.png"); System.Drawing.Drawing2D.GraphicsPath gp3 = new System.Drawing.Drawing2D.GraphicsPath(); gp3.AddEllipse(0, 0, picturebox_creator_twitter_image_3.Width - 3, picturebox_creator_twitter_image_3.Height - 3); Region r3 = new Region(gp3); picturebox_creator_twitter_image_3.Region = r3; picturebox_creator_twitter_image_3.SizeMode = PictureBoxSizeMode.StretchImage; first_quote_creator_amount.Text = "0"; second_tweet_quote_amount.Text = "0"; third_tweet_quote_amount.Text = "0"; newest_tweet.Text = "No Tweet available"; second_newest_tweet.Text = "No Tweet available"; third_newest_tweet.Text = "No Tweet available"; first_tweet_retweet_amount.Text = "0"; creator_two_retweet_amount.Text = "0"; third_tweet_retweet_amount.Text = "0"; first_tweet_likes_amount.Text = "0"; second_tweet_likes_amount.Text = "0"; third_tweet_likes_amount.Text = "0"; } else { picturebox_main_creator_image.Image = Image.FromFile($@"{path}\Images\unknown_image.png"); picturebox_creator_twitter_image_1.Image = Image.FromFile($@"{path}\Images\unknown_image.png"); System.Drawing.Drawing2D.GraphicsPath gp1 = new System.Drawing.Drawing2D.GraphicsPath(); gp1.AddEllipse(0, 0, picturebox_creator_twitter_image_1.Width - 3, picturebox_creator_twitter_image_1.Height - 3); Region r1 = new Region(gp1); picturebox_creator_twitter_image_1.Region = r1; picturebox_creator_twitter_image_1.SizeMode = PictureBoxSizeMode.StretchImage; picturebox_creator_twitter_image_2.Image = Image.FromFile($@"{path}\Images\unknown_image.png"); System.Drawing.Drawing2D.GraphicsPath gp2 = new System.Drawing.Drawing2D.GraphicsPath(); gp2.AddEllipse(0, 0, picturebox_creator_twitter_image_2.Width - 3, picturebox_creator_twitter_image_2.Height - 3); Region r2 = new Region(gp2); picturebox_creator_twitter_image_2.Region = r2; picturebox_creator_twitter_image_2.SizeMode = PictureBoxSizeMode.StretchImage; picturebox_creator_twitter_image_3.Image = Image.FromFile($@"{path}\Images\unknown_image.png"); System.Drawing.Drawing2D.GraphicsPath gp3 = new System.Drawing.Drawing2D.GraphicsPath(); gp3.AddEllipse(0, 0, picturebox_creator_twitter_image_3.Width - 3, picturebox_creator_twitter_image_3.Height - 3); Region r3 = new Region(gp3); picturebox_creator_twitter_image_3.Region = r3; picturebox_creator_twitter_image_3.SizeMode = PictureBoxSizeMode.StretchImage; first_quote_creator_amount.Text = "0"; second_tweet_quote_amount.Text = "0"; third_tweet_quote_amount.Text = "0"; newest_tweet.Text = "No Tweet available"; second_newest_tweet.Text = "No Tweet available"; third_newest_tweet.Text = "No Tweet available"; first_tweet_retweet_amount.Text = "0"; creator_two_retweet_amount.Text = "0"; third_tweet_retweet_amount.Text = "0"; first_tweet_likes_amount.Text = "0"; second_tweet_likes_amount.Text = "0"; third_tweet_likes_amount.Text = "0"; } var na = "Not available"; // Hvorfor der skal/kan være ? efter eks. Youtube; // https://stackoverflow.com/questions/28352072/what-does-question-mark-and-dot-operator-mean-in-c-sharp-6-0 label_yt_follower_count.Text = creator.Youtube?.Subscribers != null ? creator.Youtube.Subscribers.ToString() : na; label_twitch_follower_count.Text = creator.Twitch?.Followers != null ? creator.Twitch.Followers.ToString() : na; label_twitter_follower_count.Text = creator.Twitter?.Followers != null ? creator.Twitter.Followers.ToString() : na; loadTweets(creator); _activeProfileDto = creator; }