private void PostItem(string i_Title, string i_Path) { FacebookPost.ePostType ePostType = (FacebookPost.ePostType)tabControlPostItems.SelectedIndex; FacebookPost itemToPost = FacebookPostFactory.CreateFacebookPost(ePostType, i_Title, i_Path, m_DataManager); try { itemToPost.Post(); MessageBox.Show(ePostType.ToString() + " Posted successfully!"); } catch { MessageBox.Show("Something went wrong... Can't post the " + ePostType.ToString() + " :("); } }
public static FacebookPost CreateFacebookPost(FacebookPost.ePostType i_PostType, string i_Title, string i_Path, FacebookAppDataManager i_DataManager) { FacebookPost facebookPostToReturn = null; switch (i_PostType) { case FacebookPost.ePostType.Status: facebookPostToReturn = new FacebookStatus(i_Title, i_DataManager); break; case FacebookPost.ePostType.Photo: facebookPostToReturn = new FacebookPhoto(i_Title, i_Path, i_DataManager); break; case FacebookPost.ePostType.Link: facebookPostToReturn = new FacebookLink(i_Title, i_Path, i_DataManager); break; } return(facebookPostToReturn); }