Exemplo n.º 1
0
    public void ShowQuestInfo(Quest quest)
    {
        this.selectedQuest = quest;

        if (QuestLog.MyInstance.HasQuest(quest) && quest.IsComplete)
        {
            AcptBtn.SetActive(false);
            CompleteBtn.SetActive(true);
        }
        else if (!QuestLog.MyInstance.HasQuest(quest))
        {
            AcptBtn.SetActive(true);
        }

        BackBtn.SetActive(true);
        questDescription.SetActive(true);
        questArea.gameObject.SetActive(false);

        string objectives = string.Empty;

        foreach (Objective obj in quest.MyCollectObjectives)
        {
            objectives += obj.MyType + ": " + obj.MyCurrentAmount + "/" + obj.MyAmount + "\n";
        }

        questDescription.GetComponent <Text>().text = string.Format("{0} \n <size=16> {1}</size>", quest.MyTitle, quest.MyDescription);
    }
Exemplo n.º 2
0
 public void Back()
 {
     BackBtn.SetActive(false);
     AcptBtn.SetActive(false);
     ShowQuests(questGiver);
     CompleteBtn.SetActive(false);
 }
Exemplo n.º 3
0
    void Start()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        StartCoroutine(LoadDropdown());

        if (sceneName == "SelectGameMode")
        {
            Button Nbtn = NormalBtn.GetComponent <Button>();
            Nbtn.onClick.AddListener(LoadNormalMode);

            Button Tbtn = TimeBtn.GetComponent <Button>();
            Tbtn.onClick.AddListener(LoadTimeAttackMode);

            Button Ibtn = InverseBtn.GetComponent <Button>();
            Ibtn.onClick.AddListener(LoadInverseMode);

            Button Abtn = AssignmentBtn.GetComponent <Button>();
            Abtn.onClick.AddListener(LoadAssignmentMode);

            Button Cbtn = CommunityBtn.GetComponent <Button>();
            Cbtn.onClick.AddListener(LoadCommunityMode);

            Button Bbtn = BackBtn.GetComponent <Button>();
            Bbtn.onClick.AddListener(LoadCharSelect);
        }
    }
Exemplo n.º 4
0
 private void dateSliderKeyUpEvent(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         BackBtn.Focus();
         SaveBtn_Click(SaveBtn, new RoutedEventArgs());
     }
 }
Exemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;


        if (sceneName == "Assignment")
        {
            Button Abtn = AccessBtn.GetComponent <Button>();
            Abtn.onClick.AddListener(LoadAccessGame);

            Button bBtn = BackBtn.GetComponent <Button>();
            bBtn.onClick.AddListener(LoadGameMode);
        }
    }
Exemplo n.º 6
0
 public void OpenChildForm(Form childForm)
 {
     if (activeForm != null)
     {
         activeForm.Close();
     }
     activeForm                = childForm;
     childForm.TopLevel        = false;
     childForm.FormBorderStyle = FormBorderStyle.None;
     childForm.WindowState     = FormWindowState.Maximized;
     childForm.Dock            = DockStyle.Fill;
     MainPanel.Controls.Add(childForm);
     MainPanel.Tag = childForm;
     childForm.Show();
     NuevoBtn.BringToFront();
     BackBtn.BringToFront();
 }
Exemplo n.º 7
0
        // Keyboard Keys Events.
        private void Calculator_KeyDown(object sender, KeyEventArgs e)
        {
            // Using Switch To Perform Various Key Events.
            switch (e.KeyCode)
            {
            case Keys.NumPad1: { Btn1.PerformClick(); break; }

            case Keys.NumPad2: { Btn2.PerformClick(); break; }

            case Keys.NumPad3: { Btn3.PerformClick(); break; }

            case Keys.NumPad4: { Btn4.PerformClick(); break; }

            case Keys.NumPad5: { Btn5.PerformClick(); break; }

            case Keys.NumPad6: { Btn6.PerformClick(); break; }

            case Keys.NumPad7: { Btn7.PerformClick(); break; }

            case Keys.NumPad8: { Btn8.PerformClick(); break; }

            case Keys.NumPad9: { Btn9.PerformClick(); break; }

            case Keys.NumPad0: { Btn0.PerformClick(); break; }

            case Keys.Back: { BackBtn.PerformClick(); break; }

            case Keys.Add: { BtnPlus.PerformClick(); break; }

            case Keys.Subtract: { BtnMinus.PerformClick(); break; }

            case Keys.Divide: { BtnDivision.PerformClick(); break; }

            case Keys.Multiply: { BtnMultiple.PerformClick(); break; }

            case Keys.Decimal: { BtnPoint.PerformClick(); break; }

            case Keys.Oemplus: { BtnEquals.PerformClick(); break; }

            case Keys.H: { vh.Show(); break; }

            default: break;
            }
        }
Exemplo n.º 8
0
        void ReleaseDesignerOutlets()
        {
            if (TitleImgView != null)
            {
                TitleImgView.Dispose();
                TitleImgView = null;
            }

            if (SubtitleImageView != null)
            {
                SubtitleImageView.Dispose();
                SubtitleImageView = null;
            }

            if (BackBtn != null)
            {
                BackBtn.Dispose();
                BackBtn = null;
            }

            if (HomeBtn != null)
            {
                HomeBtn.Dispose();
                HomeBtn = null;
            }

            if (SubtitleTxt != null)
            {
                SubtitleTxt.Dispose();
                SubtitleTxt = null;
            }

            if (MainText != null)
            {
                MainText.Dispose();
                MainText = null;
            }
        }
Exemplo n.º 9
0
        private void MaxBtn_Click(object sender, EventArgs e)
        {
            if (WindowState == FormWindowState.Normal)
            {
                WindowState = FormWindowState.Maximized;
                if (activeForm != null)
                {
                    activeForm.WindowState = FormWindowState.Normal;
                }
                NuevoBtn.BringToFront();
                BackBtn.BringToFront();
            }
            else if (WindowState == FormWindowState.Maximized)
            {
                WindowState = FormWindowState.Normal;
                if (activeForm != null)
                {
                    activeForm.WindowState = FormWindowState.Normal;
                }

                NuevoBtn.BringToFront();
                BackBtn.BringToFront();
            }
        }
Exemplo n.º 10
0
        void ReleaseDesignerOutlets()
        {
            if (WebToolBarRefreshBtn != null)
            {
                WebToolBarRefreshBtn.Dispose();
                WebToolBarRefreshBtn = null;
            }

            if (WebLoadingSpinner != null)
            {
                WebLoadingSpinner.Dispose();
                WebLoadingSpinner = null;
            }

            if (WebNavCloseBtn != null)
            {
                WebNavCloseBtn.Dispose();
                WebNavCloseBtn = null;
            }

            if (WebNavActionBtn != null)
            {
                WebNavActionBtn.Dispose();
                WebNavActionBtn = null;
            }

            if (WebShowSocialNetworksBtn != null)
            {
                WebShowSocialNetworksBtn.Dispose();
                WebShowSocialNetworksBtn = null;
            }

            if (WebToolBar != null)
            {
                WebToolBar.Dispose();
                WebToolBar = null;
            }

            if (WebTitle != null)
            {
                WebTitle.Dispose();
                WebTitle = null;
            }

            if (NavBackBtn != null)
            {
                NavBackBtn.Dispose();
                NavBackBtn = null;
            }

            if (WebBackBtn != null)
            {
                WebBackBtn.Dispose();
                WebBackBtn = null;
            }

            if (WebForwardBtn != null)
            {
                WebForwardBtn.Dispose();
                WebForwardBtn = null;
            }

            if (WebRefreshBtn != null)
            {
                WebRefreshBtn.Dispose();
                WebRefreshBtn = null;
            }

            if (WebTweetBtn != null)
            {
                WebTweetBtn.Dispose();
                WebTweetBtn = null;
            }

            if (WebPostBtn != null)
            {
                WebPostBtn.Dispose();
                WebPostBtn = null;
            }

            if (NavBackButton != null)
            {
                NavBackButton.Dispose();
                NavBackButton = null;
            }

            if (WebView != null)
            {
                WebView.Dispose();
                WebView = null;
            }

            if (TweetBtn != null)
            {
                TweetBtn.Dispose();
                TweetBtn = null;
            }

            if (PostBtn != null)
            {
                PostBtn.Dispose();
                PostBtn = null;
            }

            if (BackBtn != null)
            {
                BackBtn.Dispose();
                BackBtn = null;
            }

            if (ForwardBtn != null)
            {
                ForwardBtn.Dispose();
                ForwardBtn = null;
            }

            if (RefreshBtn != null)
            {
                RefreshBtn.Dispose();
                RefreshBtn = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (About_header != null)
            {
                About_header.Dispose();
                About_header = null;
            }

            if (About_section1 != null)
            {
                About_section1.Dispose();
                About_section1 = null;
            }

            if (About_section2 != null)
            {
                About_section2.Dispose();
                About_section2 = null;
            }

            if (AcceptSwitch != null)
            {
                AcceptSwitch.Dispose();
                AcceptSwitch = null;
            }

            if (AcceptSwitchBtn != null)
            {
                AcceptSwitchBtn.Dispose();
                AcceptSwitchBtn = null;
            }

            if (AcceptTextLbl != null)
            {
                AcceptTextLbl.Dispose();
                AcceptTextLbl = null;
            }

            if (ActivityIndicator != null)
            {
                ActivityIndicator.Dispose();
                ActivityIndicator = null;
            }

            if (BackBtn != null)
            {
                BackBtn.Dispose();
                BackBtn = null;
            }

            if (ContactInformation_section != null)
            {
                ContactInformation_section.Dispose();
                ContactInformation_section = null;
            }

            if (Header1Lbl != null)
            {
                Header1Lbl.Dispose();
                Header1Lbl = null;
            }

            if (Header2Lbl != null)
            {
                Header2Lbl.Dispose();
                Header2Lbl = null;
            }

            if (Header3Lbl != null)
            {
                Header3Lbl.Dispose();
                Header3Lbl = null;
            }

            if (Header4Lbl != null)
            {
                Header4Lbl.Dispose();
                Header4Lbl = null;
            }

            if (Header5Lbl != null)
            {
                Header5Lbl.Dispose();
                Header5Lbl = null;
            }

            if (Header6Lbl != null)
            {
                Header6Lbl.Dispose();
                Header6Lbl = null;
            }

            if (Header7Lbl != null)
            {
                Header7Lbl.Dispose();
                Header7Lbl = null;
            }

            if (Header8Lbl != null)
            {
                Header8Lbl.Dispose();
                Header8Lbl = null;
            }

            if (Header9Lbl != null)
            {
                Header9Lbl.Dispose();
                Header9Lbl = null;
            }

            if (HowItWorks_header != null)
            {
                HowItWorks_header.Dispose();
                HowItWorks_header = null;
            }

            if (HowItWorks_section1 != null)
            {
                HowItWorks_section1.Dispose();
                HowItWorks_section1 = null;
            }

            if (HowItWorks_section2 != null)
            {
                HowItWorks_section2.Dispose();
                HowItWorks_section2 = null;
            }

            if (HowItWorks_section3 != null)
            {
                HowItWorks_section3.Dispose();
                HowItWorks_section3 = null;
            }

            if (MoreInformation_section != null)
            {
                MoreInformation_section.Dispose();
                MoreInformation_section = null;
            }

            if (MoreInformation_section2 != null)
            {
                MoreInformation_section2.Dispose();
                MoreInformation_section2 = null;
            }

            if (MoreInformation_section3 != null)
            {
                MoreInformation_section3.Dispose();
                MoreInformation_section3 = null;
            }

            if (NextBtn != null)
            {
                NextBtn.Dispose();
                NextBtn = null;
            }

            if (Paragraph1Lbl != null)
            {
                Paragraph1Lbl.Dispose();
                Paragraph1Lbl = null;
            }

            if (Paragraph2Lbl != null)
            {
                Paragraph2Lbl.Dispose();
                Paragraph2Lbl = null;
            }

            if (Paragraph3Lbl != null)
            {
                Paragraph3Lbl.Dispose();
                Paragraph3Lbl = null;
            }

            if (Paragraph4Lbl != null)
            {
                Paragraph4Lbl.Dispose();
                Paragraph4Lbl = null;
            }

            if (Paragraph5Lbl != null)
            {
                Paragraph5Lbl.Dispose();
                Paragraph5Lbl = null;
            }

            if (Paragraph6Lbl != null)
            {
                Paragraph6Lbl.Dispose();
                Paragraph6Lbl = null;
            }

            if (Paragraph7Lbl != null)
            {
                Paragraph7Lbl.Dispose();
                Paragraph7Lbl = null;
            }

            if (Paragraph8Lbl != null)
            {
                Paragraph8Lbl.Dispose();
                Paragraph8Lbl = null;
            }

            if (Paragraph9Lbl != null)
            {
                Paragraph9Lbl.Dispose();
                Paragraph9Lbl = null;
            }

            if (PrivacyPolicy != null)
            {
                PrivacyPolicy.Dispose();
                PrivacyPolicy = null;
            }

            if (Samtykke_section1 != null)
            {
                Samtykke_section1.Dispose();
                Samtykke_section1 = null;
            }

            if (Samtykke_section2 != null)
            {
                Samtykke_section2.Dispose();
                Samtykke_section2 = null;
            }

            if (SamtykkeBottom_header != null)
            {
                SamtykkeBottom_header.Dispose();
                SamtykkeBottom_header = null;
            }

            if (SamtykkeBottom_section != null)
            {
                SamtykkeBottom_section.Dispose();
                SamtykkeBottom_section = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (WarningLbl != null)
            {
                WarningLbl.Dispose();
                WarningLbl = null;
            }

            if (WarningView != null)
            {
                WarningView.Dispose();
                WarningView = null;
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or a page to load,
        /// depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public void ClickAndWait(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.CBDLearnerPage.BackBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == BackBtn.GetAttribute("outerHTML"))
                {
                    BackBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(180), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectBtn.GetAttribute("outerHTML"))
                {
                    // NOTE: This sometimes does not work in Firefox whenever the tooltip for one of the tabs appears. Firefox
                    // fails to click when a tooltip is covering the button. I changed this to a Javascript and it worked so far.
                    // Monitor going forwards and if the javascript click also fails, we will have to implement a workaround
                    // in the SwitchTabs method
                    // buttonOrLinkElem.Click();
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormContinueBtn);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormContinueBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(360), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormBrowseBtn, ElementCriteria.IsVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithReflectionsTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObservationBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObservationBtn.GetAttribute("outerHTML"))
                {
                    RequestObservationBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.RequestObsFormObsNameTxt);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormObsNameTxt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormSearchBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    // Need to revisit the above 2 lines. For some reason, this needs a tiny static wait to work sometimes
                    Thread.Sleep(0400);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormSearchBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormSearchBtn.GetAttribute("outerHTML"))
                {
                    // 11/30/17: It failed today. Said "Failed to find any elements By.XPath: //tbody[@aria-label='Select Observer']". I looked on the
                    // screenshot and the radio button never got returned, even though the label beneath it said "Showing 1-1 of 1". This tells me that
                    // this is an application bug. Hopefully this fixes itself when DEV works on performance improvements. If not, and I see this again,
                    // I might have to add some more logic below to keep clicking or something else
                    // 11/05/17: For some reason, Selenium sometimes fails to click this button. So I am adding a Catch and using javascript based click
                    // event if this fails
                    // 1/25/18: Failed. The failure said that the Ok button (The button that is lcoated on the screen after clicking the Request button)
                    // could not be found. Looked at screenshot, and it showed that the Search button did not get clicked (at least that is what I think,
                    // because ALL observers showed inside the table), the Template (Part A) radio button DID get clicked, the Observer radio button
                    // did NOT get clicked, so as a result, the Request button was disabled and could not be clicked. A video would really be helpful
                    // to debug this, because I dont know why the observer table showed ALL observers (Did the search not get clicked even with the Try
                    // Catch below? Did it actually get clicked, but the application failed to filter the observers (This would be an application bug)?)
                    // Aside form those questions, the observer still showed in the table, but failed to get selected. I am adding a longer sleep here,
                    // 5 milliseconds up from 3 milliseconds. Monitor going forward

                    try
                    {
                        RequestObsFormSearchBtn.Click();
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.RequestObsFormRdoBtnTbodyVisible,
                                          Criteria.CBDLearnerPage.RequestObsFormFirstRdoVisible);
                        this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        Thread.Sleep(0500);
                    }
                    catch
                    {
                        ((IJavaScriptExecutor)Browser).ExecuteScript("arguments[0].click()", RequestObsFormSearchBtn);
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.RequestObsFormRdoBtnTbodyVisible,
                                          Criteria.CBDLearnerPage.RequestObsFormFirstRdoVisible);
                        this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        Thread.Sleep(0500);
                    }
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormRequestBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormRequestBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormRequestBtn.Click();
                    this.WaitForElement(Bys.CBDLearnerPage.RequestObsFormOkBtn, ElementCriteria.IsVisible);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormOkBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormOkBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormOkBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ViewMoreRptsLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ViewMoreRptsLnk.GetAttribute("outerHTML"))
                {
                    ViewMoreRptsLnk.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.ReportsFormShowBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormShowBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormShowBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormShowBtn.Click();
                    Browser.WaitForElement(Bys.CBDLearnerPage.ReportsFormEPAObservCntChrt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled, ElementCriteria.HasText);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormCloseBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormCloseBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormCloseBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    return;
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or " +
                                    "if the button is already added, then the page you were on did not contain the button.");
            }
        }
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or a page to load,
        /// depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The button element</param>
        public void ClickAndWait(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.CBDLearnerPage.BackBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == BackBtn.GetAttribute("outerHTML"))
                {
                    BackBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(180), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectBtn.GetAttribute("outerHTML"))
                {
                    // NOTE: This sometimes does not work in Firefox whenever the tooltip for one of the tabs appears. Firefox
                    // fails to click when a tooltip is covering the button. However, this started working today. If it stops
                    // working again, we will have to implement a workaround in the SwitchTabs method
                    AddReflectBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormContinueBtn);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormContinueBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(360), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormBrowseBtn, ElementCriteria.IsVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithReflectionsTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObservationBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObservationBtn.GetAttribute("outerHTML"))
                {
                    RequestObservationBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.RequestObsFormObsNameTxt);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormObsNameTxt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormSearchBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    // Need to revisit the above 2 lines. For some reason, this needs a tiny static wait to work sometimes
                    //Thread.Sleep(0600);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormSearchBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormSearchBtn.GetAttribute("outerHTML"))
                {
                    // 11/30/17: It failed today. Said "Failed to find any elements By.XPath: //tbody[@aria-label='Select Observer']"
                    // I looked on the screenshot and the radio button never got returned, even though the label beneath it said
                    // "Showing 1-1 of 1". This tells me that this is an application bug. Hopefully this fixes itself when DEV works
                    // on performance improvements. If not, and I see this again, I might have to add some more logic below to keep
                    // clicking or something else
                    // 11/05/17: For some reason, selenium sometimes fails to click this button. So I am adding a Catch and using javascript based click event if this fails
                    try
                    {
                        RequestObsFormSearchBtn.Click();
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.RequestObsFormRdoBtnTbodyVisible,
                                          Criteria.CBDLearnerPage.RequestObsFormFirstRdoVisible);
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        // Adding a Sleep here for now until I have time to come back and add some dynamic wait criteria
                        Thread.Sleep(0300);
                    }
                    catch
                    {
                        ((IJavaScriptExecutor)Browser).ExecuteScript("arguments[0].click()", RequestObsFormSearchBtn);
                        this.WaitForElement(Bys.CBDLearnerPage.RequestObsFormRdoBtnTbody, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible);
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        // Adding a Sleep here for now until I have time to come back and add some dynamic wait criteria
                        Thread.Sleep(0300);
                    }
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormRequestBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormRequestBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormRequestBtn.Click();
                    this.WaitForElement(Bys.CBDLearnerPage.RequestObsFormOkBtn, ElementCriteria.IsVisible);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormOkBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormOkBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormOkBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, LogoutLnk);
                    LogoutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("login"));
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ViewMoreRptsLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ViewMoreRptsLnk.GetAttribute("outerHTML"))
                {
                    ViewMoreRptsLnk.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.ReportsFormShowBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormShowBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormShowBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormShowBtn.Click();
                    Browser.WaitForElement(Bys.CBDLearnerPage.ReportsFormEPAObservCntChrt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled, ElementCriteria.HasText);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormCloseBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormCloseBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormCloseBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    return;
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or " +
                                    "if the button is already added, then the page you were on did not contain the button.");
            }
        }
Exemplo n.º 14
0
 private void BackBtn_Click(object sender, RoutedEventArgs e)
 {
     _navigationService.GoBack();
     ForwardBtn.GetBindingExpression(Button.IsEnabledProperty).UpdateTarget();
     BackBtn.GetBindingExpression(Button.IsEnabledProperty).UpdateTarget();
 }
Exemplo n.º 15
0
 private void Settings_Click(object sender, RoutedEventArgs e)
 {
     _navigationService.Navigate(_pages[AppPages.SettingsPage]);
     ForwardBtn.GetBindingExpression(Button.IsEnabledProperty).UpdateTarget();
     BackBtn.GetBindingExpression(Button.IsEnabledProperty).UpdateTarget();
 }
Exemplo n.º 16
0
        private void engine_Recognized(object sender, SpeechRecognizedEventArgs e)
        {
            string speech = e.Result.Text;

            switch (speech)
            {
            case "start reading":
                CopyScreenBtn.PerformClick();
                StartBtn.PerformClick();
                break;

            case "read the result":
            case "read the resuls":
            case "whats the result":
            case "whats the results":
                GetResult();
                break;

            case "search":
                SearchBtn.PerformClick();
                break;

            case "pause":
                PauseBtn.PerformClick();
                break;

            case "resume":
                PauseBtn.PerformClick();
                break;

            case "back":
                BackBtn.PerformClick();
                break;

            case "next":
                ForwardBtn.PerformClick();
                break;

            case "stop":
                StopBtn.PerformClick();
                break;

            case "close website search":
                Decca.Speak("Closing Website Reader");
                CloseBtn.PerformClick();
                break;

            case "hide website reader":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Minimized;
                TopMost         = false;
                break;

            case "show website reader":
            case "show website reader again":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Normal;
                TopMost         = true;
                break;

            default:
                break;
            }
            if (speech == "find")
            {
                string Speech = e.Result.Text;
                Qevent = Speech;
                Speech = string.Empty;
                Decca.SpeakAsync("what do you want to search");
                speech = string.Empty;

                Process_OutputDataReceived();
            }
        }
Exemplo n.º 17
0
    // 타이틀명 설정
    public void SetTitle(object param)
    {
        TitleLbl.text = (string)param;

        BackBtn.SetActive(!(UIMgr.Instance.GetCurBasePanel is MainPanel));
    }