예제 #1
0
        /// <summary>
        /// Open a new window for reviews and wait for it's events to continue saving the product
        /// </summary>
        /// <param name="product">The product on which it should add the review</param>
        public void AddReview(Product product)
        {
            this.Visibility = Visibility.Collapsed;
            var parent = Parent as Grid;

            if (AddReviewUserControl == null)
            {
                AddReviewUserControl        = new AddReviewUserControl(product, false);
                AddReviewUserControl.Margin = Margin;
                AddReviewUserControl.HorizontalAlignment = HorizontalAlignment;
                AddReviewUserControl.VerticalAlignment   = VerticalAlignment;
                Grid.SetColumn(AddReviewUserControl, 1);
                Grid.SetColumnSpan(AddReviewUserControl, 2);
                parent.Children.Insert(0, AddReviewUserControl);
            }
            AddReviewUserControl.Visibility = Visibility.Visible;

            AddReviewUserControl.GoBack += (object sender, EventArgs e) =>
            {
                AddReviewUserControl.Visibility = Visibility.Collapsed;
                Visibility = Visibility.Visible;
            };

            AddReviewUserControl.ReviewCreated += (object sender, EventArgs e) =>
            {
                AddReviewUserControl.Visibility = Visibility.Collapsed;
                Visibility = Visibility.Visible;
            };
        }
예제 #2
0
        /// <summary>
        /// Loading the UserControl of the add review to the main screen and logging its events
        /// </summary>
        internal void LoadAddReview(Product product)
        {
            MessageArea.IsOpen = false;
            AddReviewUserControl addReview = new AddReviewUserControl(product);

            addReview.GoBack += (sender, e) =>
            {
                GoBackEventArgs args = e as GoBackEventArgs;
                if (!args.IsWorkDone)
                {
                    MessageAreaText.Text = args.Message;
                    MessageArea.IsOpen   = true;
                }
                else
                {
                    LoadSearchResult(null);
                }
            };
            CurrnetUserConrol = addReview;
        }