Interaction logic for TransitionCommentView.xaml
Exemple #1
0
        /// <summary>
        /// Fired when the Transition button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTransitionButtonClick(object sender, RoutedEventArgs e)
        {
            var b = sender as Button;
            var t = b.DataContext as Transition;

            try
            {
                // First poll for required input


                // POST the transition
                if (t != null && !t.RequireComment)
                {
                    t.Update(_thisCard.Number);
                    Rebind();
                    return;
                }

                var collectComment =
                    new GeneralCommentView(VisualStudio.Resources.TransitionAdmonitionLabel,
                                           VisualStudio.Resources.TransitionCommentRequired,
                                           VisualStudio.Resources.TransitionWindowTitle);

                if (string.IsNullOrEmpty(collectComment.Comment))
                {
                    return;
                }

                // POST the transition
                t.Update(_thisCard.Number);

                // POST the Comment
                string cardComment = string.Format(CultureInfo.InvariantCulture, "comment[content]={0}",
                                                   collectComment.Comment);
                _thisCard.Model.Mingle.Post(MingleSettings.Project, "/cards/" + _thisCard.Number + ".xml",
                                            new Collection <string> {
                    cardComment
                });

                // Murmur the comment?
                string murmur = string.Format(CultureInfo.InvariantCulture, "murmur[body]={0}", collectComment.Comment);
                _thisCard.Model.Mingle.Post(MingleSettings.Project, "/cards/" + _thisCard.Number + ".xml",
                                            new Collection <string> {
                    murmur
                });
            }
            catch (Exception ex)
            {
                TraceLog.Exception(new StackFrame().GetMethod().Name, ex);
                MessageBox.Show(string.Format(CultureInfo.CurrentCulture, "{0}\n\r\n\r{1} {2}\n\r\n\r{3}",
                                              VisualStudio.Resources.TransitionCannotBeApplied,
                                              VisualStudio.Resources.TransitionEquals, t.Name, ex.Message));
            }
        }
        /// <summary>
        /// Fired when the Transition button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTransitionButtonClick(object sender, RoutedEventArgs e)
        {
            var b = sender as Button;
            var t = b.DataContext as Transition;
            try
            {
                // First poll for required input

                // POST the transition
                if (t != null && !t.RequireComment)
                {
                    t.Update(_thisCard.Number);
                    Rebind();
                    return;
                }

                var collectComment =
                    new GeneralCommentView(VisualStudio.Resources.TransitionAdmonitionLabel,
                                           VisualStudio.Resources.TransitionCommentRequired,
                                           VisualStudio.Resources.TransitionWindowTitle);

                if (string.IsNullOrEmpty(collectComment.Comment))
                {
                    return;
                }

                // POST the transition
                t.Update(_thisCard.Number);

                // POST the Comment
                string cardComment = string.Format(CultureInfo.InvariantCulture, "comment[content]={0}",
                                                   collectComment.Comment);
                _thisCard.Model.Mingle.Post(MingleSettings.Project, "/cards/" + _thisCard.Number + ".xml",
                                            new Collection<string> {cardComment});

                // Murmur the comment?
                string murmur = string.Format(CultureInfo.InvariantCulture, "murmur[body]={0}", collectComment.Comment);
                _thisCard.Model.Mingle.Post(MingleSettings.Project, "/cards/" + _thisCard.Number + ".xml",
                                            new Collection<string> {murmur});
            }
            catch (Exception ex)
            {
                TraceLog.Exception(new StackFrame().GetMethod().Name, ex);
                MessageBox.Show(string.Format(CultureInfo.CurrentCulture, "{0}\n\r\n\r{1} {2}\n\r\n\r{3}",
                                              VisualStudio.Resources.TransitionCannotBeApplied,
                                              VisualStudio.Resources.TransitionEquals, t.Name, ex.Message));
            }
        }