Esempio n. 1
0
        private void AddFeedbacks()
        {
            var resource = ResourceLoader.GetForCurrentView();

            if (VersionHelper.IsProfessionalVersion)
            {
                FeedbackSource.Add(new Feedback
                {
                    Name   = resource.GetString("Developer/CheerUp/Content"),
                    Tapped = async(sender, args) =>
                    {
                        ContentDialog dlg = new ContentDialog();

                        Frame rootFrame = Window.Current.Content as Frame;
                        if (rootFrame != null)
                        {
                            Page page = rootFrame.Content as Page;
                            if (page != null)
                            {
                                dlg.RequestedTheme = page.RequestedTheme;
                            }
                        }

                        StackPanel panel = new StackPanel()
                        {
                            Margin = new Thickness(0, 6, 0, 6), VerticalAlignment = VerticalAlignment.Center
                        };
                        panel.Children.Add(new TextBlock()
                        {
                            Text         = resource.GetString("Developer/Donation/Text"),
                            TextWrapping = TextWrapping.Wrap,
                            Margin       = new Thickness(0, 3, 0, 3)
                        });

                        MessengerInstance.Send <Message <ListingInformation> >(new Message <ListingInformation>((listInfo) =>
                        {
                            List <ProductListing> pList = new List <ProductListing>();
                            var pls    = listInfo.ProductListings;
                            var values = pls.Values.GetEnumerator();

                            while (values.MoveNext())
                            {
                                var product = values.Current;

                                if (product.ProductType == ProductType.Consumable)
                                {
                                    pList.Add(product);
                                }
                            }

                            if (pList.Count > 0)
                            {
                                foreach (var product in pList.OrderBy(p => p.ProductId))
                                {
                                    Grid item = new Grid()
                                    {
                                        Margin = new Thickness(0, 6, 0, 6), VerticalAlignment = VerticalAlignment.Center
                                    };
                                    item.Children.Add(new TextBlock()
                                    {
                                        Text                = product.Name,
                                        TextWrapping        = TextWrapping.Wrap,
                                        Margin              = new Thickness(0, 3, 0, 3),
                                        VerticalAlignment   = VerticalAlignment.Center,
                                        HorizontalAlignment = HorizontalAlignment.Left
                                    });

                                    item.Children.Add(new Button()
                                    {
                                        Content             = product.FormattedPrice,
                                        HorizontalAlignment = HorizontalAlignment.Right,
                                        Command             = new RelayCommand(() =>
                                        {
                                            dlg.Hide();
                                            MessengerInstance.Send <string>(product.ProductId, "Donation");
                                        })
                                    });

                                    panel.Children.Add(item);
                                }
                            }
                        }),
                                                                               "RetriveIAPsListingInformation");

                        dlg.Title   = resource.GetString("Developer/CheerUp/Content");
                        dlg.Content = panel;
                        dlg.IsPrimaryButtonEnabled = true;
                        dlg.PrimaryButtonText      = resource.GetString("Button/Close/Content");

                        await dlg.ShowAsync();
                    }
                });
            }

            FeedbackSource.Add(new Feedback
            {
                Name   = resource.GetString("Feedback/ReviewRate/Content"),
                Tapped = async(sender, args) =>
                {
                    Uri uri = UriHelper.GetRateAndReviewUri();
                    //Uri uri = new Uri(string.Format("ms-windows-store:reviewapp?appid=1765dc04-edc1-4c07-a850-da8b055a6362"));
                    await Windows.System.Launcher.LaunchUriAsync(uri);
                }
            });
            FeedbackSource.Add(new Feedback
            {
                Name   = resource.GetString("Feedback/Facebook/Content"),
                Tapped = async(sender, args) =>
                {
                    string prefix = App.IsMobile ? "m" : "www";
                    await Windows.System.Launcher.LaunchUriAsync(new Uri($"https://{prefix}.facebook.com/CCPlayer-484115588360126"));
                }
            });
            FeedbackSource.Add(new Feedback
            {
                Name   = resource.GetString("Feedback/BugReport/Content"),
                Tapped = (sender, args) =>
                {
                    VersionHelper.CheckBetaOS(
                        async(buildNumber) =>
                    {
                        var warn = DialogHelper.GetSimpleContentDialog(
                            $"Current operating system is the beta OS. ({buildNumber})",
                            "You have the responsibility for using the beta OS.\nCCPlayer couldn't work correctly, also doesn't support anything for beta OS.\n",    //(Tip : In current beta OS, recommend disable \"Settings > Playback > Use L:me component\")",
                            resource.GetString("Button/Close/Content"),
                            resource.GetString("Feedback/BugReport/Content"));
                        if (await warn.ShowAsync() == ContentDialogResult.Secondary)
                        {
                            Send($"Bug reporting! - {Current.DisplayName} {BuildNumber}");
                        }
                        App.ContentDlgOp = null;
                    },
                        () => Send($"Bug reporting! - {Current.DisplayName} {BuildNumber}"));
                }
            });
            FeedbackSource.Add(new Feedback
            {
                Name   = resource.GetString("Feedback/Suggest/Content"),
                Tapped = (sender, args) =>
                {
                    Send($"Suggestion - {Current.DisplayName} {BuildNumber}");
                }
            });
        }