コード例 #1
0
        private async void sliderMy_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs <double> e)
        {
            if (e.OldValue != 0.0)
            {
                myTypeText.Text = App.BloodViewModel.GetBloodByNumber(Convert.ToInt32(e.NewValue), true);

                await System.Threading.Tasks.Task.Delay(300);

                resultText.Text       = myTypeText.Text;
                shareButton.IsEnabled = true;
                PlayType.Begin();
            }
        }
コード例 #2
0
        private void BuildApplicationBar()
        {
            ApplicationBar               = new ApplicationBar();
            ApplicationBar.Opacity       = 0.2;
            ApplicationBar.Mode          = ApplicationBarMode.Default;
            ApplicationBar.IsMenuEnabled = false;

            ApplicationBarIconButton findButton = new ApplicationBarIconButton();

            findButton.IconUri = new Uri("/Assets/feature.search.png", UriKind.Relative);
            findButton.Text    = "find";
            ApplicationBar.Buttons.Add(findButton);

            ApplicationBarIconButton shareButton = new ApplicationBarIconButton();

            shareButton.IconUri = new Uri("/Assets/share.png", UriKind.Relative);
            shareButton.Text    = "share";
            ApplicationBar.Buttons.Add(shareButton);
            shareButton.IsEnabled = false;

            ApplicationBarIconButton refreshButton = new ApplicationBarIconButton();

            refreshButton.IconUri = new Uri("/Assets/refresh.png", UriKind.Relative);
            refreshButton.Text    = "refresh";
            ApplicationBar.Buttons.Add(refreshButton);
            refreshButton.IsEnabled = false;

            findButton.Click += (s, e) =>
            {
                if (CheckParentsType())
                {
                    (DataContext as BloodType.ViewModels.BloodTypeViewModel).LetsRock(Convert.ToInt32(sliderMother.Value), Convert.ToInt32(sliderFather.Value));

                    PlayType.Begin();
                    shareButton.IsEnabled   = true;
                    refreshButton.IsEnabled = true;
                }
            };

            shareButton.Click += (s, e) =>
            {
                if (CheckParentsType())
                {
                    bodyMessage = "I have just founded my blood type using BLOODTYPE App for Windows Phone 8!";
                    if (resultText.Text.Split(',').Length > 1)
                    {
                        bodyMessage += "There is a great chance of blood type is one of these: " + resultText.Text;
                    }
                    else
                    {
                        bodyMessage += "Maybe my blood type is: " + resultText.Text;
                    }

                    DataTransferManager.ShowShareUI();
                }
            };

            refreshButton.Click += (s1, e1) =>
            {
                (DataContext as BloodType.ViewModels.BloodTypeViewModel).ResfreshData();
                sliderMother.Value = 0;
                sliderFather.Value = 0;
                motherText.Text    = string.Empty;
                fatherText.Text    = string.Empty;

                PlayTypeRev.Begin();
                shareButton.IsEnabled   = false;
                refreshButton.IsEnabled = false;
            };
        }