private void buttonSendMessageAll_Click(object sender, EventArgs e) { _timer.Start(); try { var post = new CustomPost { Submitter = _userName, TimeSubmitted = DateTime.Now, Comment = richTextBoxMessageAll.Text, ChatRoomId = _chatRoomId, IsActive = true }; _client.SubmitPost(post); richTextBoxMessageAll.Clear(); UpdateTexts(); } catch (FaultException exception) { MessageBox.Show(exception.Message); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public PostWindow(CustomPost openedPost) { InitializeComponent(); // m_model = the data model (A big catch-all for all of the data) m_model = new PostDataModel(openedPost); // Model = Data Model, Just a model for your contained data. Use this Data Model DataContext = m_model; m_model.Initialize(); BrowserActions(); }
private void redditNakedUpArrow_Click(object sender, RoutedEventArgs e) { if (sender is Button) { Button myButton = (Button)sender; object maybeAPost = myButton.DataContext; if (maybeAPost is CustomPost) { CustomPost myPost = (CustomPost)maybeAPost; myPost.ChangeVote(VotableThing.VoteType.Upvote); } } }
private void buttonSendMessageAll_Click(object sender, EventArgs e) { ChatServiceClient client = new ChatServiceClient("All"); CustomPost post = new CustomPost { Submitter = _userName, TimeSubmitted = DateTime.Now, Comment = richTextBoxMessageAll.Text, ChatRoomId = 3 }; client.SubmitPost(post); richTextBoxMessageAll.Clear(); UpdateTexts(); }
// If the left mouse button is clicked, do this stuff private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { // Checks to see if the sending thing is a lable if (sender is Label) { // Ceates a Label object myLabel Label myLabel = (Label)sender; // Gets us the post object we just clicked on object selectedPost = myLabel.DataContext; // If the mabyeAPost is a post, create a new Custom Post, get the URL from it, convert to a string and launch the default browser if (selectedPost is CustomPost) { CustomPost myPost = (CustomPost)selectedPost; PostWindow win = new PostWindow(myPost); win.Show(); this.Hide(); // Closes MainWindow so PostWindow can close the program when exited //this.Close(); } } }