Ejemplo n.º 1
0
        private async void CreateNewPost(object sender, RoutedEventArgs eventArgs)
        {
            if (string.IsNullOrEmpty(PostDescriptionTextBox.Text))
            {
                MessageBox.Show("Please add a description to your post.", "Oops!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            var result = await NetworkManager.AddPost(NetworkManager.CurrentUser.Username, PostDescriptionTextBox.Text, ApplicationsManager.CurrentApplication.Name);

            var messageBoxResult = MessageBox.Show(result.Item2, "Result");

            if (messageBoxResult == MessageBoxResult.OK && result.Item1 != null)
            {
                File.Copy(ApplicationsManager.CurrentApplication.Path, $"{Defaults.CONFIGURATE}\\Server\\{result.Item1.ID}{ApplicationsManager.CurrentApplication.Extension}");
                UpdateSharePosts();

                TriggerLeftWindow("Share");
            }
        }