/// <summary> /// Executes the add Post command /// </summary> private void AddPostExecute() { try { AddPostWindow addPostWindow = new AddPostWindow(); addPostWindow.ShowDialog(); // Notification if ((addPostWindow.DataContext as AddPostViewModel).IsUpdatePost == true) { InfoLabel = $"Created a new post"; InfoLabelBG = "#FF8BC34A"; if (userWindow == null) { SnackUserInfo(); } else { SnackInfo(); } } PostList = postData.GetAllPosts(); UserPostList = postData.GetAllUserPosts(LoggedInUser.CurrentUser).ToList(); } catch (Exception ex) { Xceed.Wpf.Toolkit.MessageBox.Show("Cannot create a post right now." + ex); } }
private void AddNewPost(object sender, RoutedEventArgs e) { AddPostWindow window = new AddPostWindow() { WindowStartupLocation = WindowStartupLocation.CenterScreen }; window.ShowDialog(); }
/// <summary> /// Add Post window /// </summary> /// <param name="addPostWindowOpen">Opens the window</param> public AddPostViewModel(AddPostWindow addPostWindowOpen) { post = new tblPost(); addPostWindow = addPostWindowOpen; }