コード例 #1
0
        private void SlideshowPage_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == Windows.System.VirtualKey.GamepadRightShoulder)
            {
                Next();
                e.Handled = true;
            }
            else if (e.Key == Windows.System.VirtualKey.GamepadLeftShoulder)
            {
                Previous();
                e.Handled = true;
            }
            else if (!_navVisible)
            {
                _navVisible = true;
                e.Handled   = true;
                if (App.IsXbox())
                {
                    NextButton.Focus(FocusState.Keyboard);
                }

                ControlsContainer.IsHitTestVisible = true;
                ControlsContainer.Fade(1, 200).Start();
            }

            _timer.Start();
        }
コード例 #2
0
        // Add the 'information' type question
        private void AddInformation(XmlNode question)
        {
            // Clear the controls from previous question
            responsePanel.Controls.Clear();

            // Display the text
            questionLabel.Text = question.SelectSingleNode("text").InnerText;

            // Set the focus on the 'Next' button
            NextButton.Focus();
        }
コード例 #3
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
                coreTitleBar.ExtendViewIntoTitleBar = true;

                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                if (titleBar != null)
                {
                    titleBar.ButtonBackgroundColor         = Colors.Transparent;
                    titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

                    titleBar.ButtonForegroundColor         = Colors.White;
                    titleBar.ButtonInactiveForegroundColor = Colors.LightGray;

                    titleBar.BackgroundColor         = Colors.Transparent;
                    titleBar.InactiveBackgroundColor = Colors.Transparent;
                }
            }

            ConnectedService.Instance.ReceivedMessageFromClient += Instance_ReceivedMessageFromClient;
            ConnectedService.Instance.StartHosting();

            var id = e.Parameter;

            _adventure = await DataProvider.Instance.GetAdventure(id as string);

            PhotoTimeline.ItemsSource = _adventure.Photos;

            UpdateSize();

            if (App.IsXbox())
            {
                PhotoTimeline.IsHitTestVisible = false;
                NextButton.Focus(FocusState.Keyboard);
            }

            SlideTextBlock.Text             = $"Slide {PhotoTimeline.CurrentItemIndex + 1} of {_adventure.Photos.Count}";
            PhotoTimeline.ItemIndexChanged += TimelinePanel_ItemIndexChanged;

            _timer          = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromSeconds(3);
            _timer.Tick    += _timer_Tick;
            _timer.Start();

            PointerMoved += SlideshowPage_PointerMoved;
            KeyDown      += SlideshowPage_KeyDown;

            base.OnNavigatedTo(e);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: modulexcite/FieldLog
 public void FocusNextButton()
 {
     NextButton.Focus();
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: modulexcite/FieldLog
 private void MainForm_Shown(object sender, EventArgs args)
 {
     NextButton.Focus();
     logSelectionView.TakeFocus();
 }
コード例 #6
0
        // Function to show the question on the main survey screen
        private void CreateQuestion(int questionNum, Boolean ShowPreviousResponse)
        {
            // Create an XML node containing all the information about the question
            XmlNode question = xmlSurvey.GetElementsByTagName("question").Item(currentQuestion);


            // Call the appropriate function based on te question type
            switch (question.Attributes["type"].Value)
            {
            case "radio":
                AddRadioButtons(question);
                break;

            case "checkbox":
                AddCheckBoxes(question);
                break;

            case "text":
                AddTextBox(question);
                break;

            case "automatic":
                AddAutomatic();
                break;

            case "information":
                AddInformation(question);
                break;
            }



            if (question.Attributes["type"].Value != "automatic")
            {
                // Default all special buttons to not visible,
                // in case they were visible from the previous question
                notApplicableButton.Visible  = false;
                refuseToAnswerButton.Visible = false;
                dontKnowButton.Visible       = false;

                notApplicableButton.BackColor  = Color.LightGray;
                refuseToAnswerButton.BackColor = Color.LightGray;
                dontKnowButton.BackColor       = Color.LightGray;


                // Check if Not Applicable Button needs to be shown
                // and if it needs to be selected
                if (question.SelectSingleNode("na") != null)
                {
                    notApplicableButton.Visible = true;
                    if (ShowPreviousResponse == true && QuestionInfoList[currentQuestion].value == naValue)
                    {
                        notApplicableButton.BackColor = selectedColour;
                        EnableNextButton();
                        NextButton.Focus();
                    }
                }

                // Check if Refuse Button needs to be shown
                // and if it needs to be selected
                if (question.SelectSingleNode("refuse") != null)
                {
                    refuseToAnswerButton.Visible = true;
                    if (ShowPreviousResponse == true && QuestionInfoList[currentQuestion].value == refuseValue)
                    {
                        refuseToAnswerButton.BackColor = selectedColour;
                        EnableNextButton();
                        NextButton.Focus();
                    }
                }


                // Check if Not Applicable Button needs to be shown
                // and if it needs to be selected
                if (question.SelectSingleNode("dont_know") != null)
                {
                    dontKnowButton.Visible = true;
                    if (ShowPreviousResponse == true && QuestionInfoList[currentQuestion].value == dontKnowValue)
                    {
                        dontKnowButton.BackColor = selectedColour;
                        EnableNextButton();
                        NextButton.Focus();
                    }
                }
            }

            // If we are supposed to show the previous response or if it the last question
            if (ShowPreviousResponse == true || questionNum == numQuestions - 1)
            {
                EnableNextButton();
                NextButton.Focus();
            }
            else
            {
                DisableNextButton();
            }

            // Disable the "Previous" button if we are at the beginning of the survey
            if (QuestionInfoList[currentQuestion].prevQues == -1)
            {
                DisablePrevButton();
            }
            else
            {
                EnablePrevButton();
            }
        }