示例#1
0
 static void HandleModalTrigger(DOMEventArgs evt)
 {
     HideAllModals();
     using (var target = evt.EventObject.Target.ConvertTo <HTMLElement>())
     {
         var modalId = $"{target.GetAttribute("data-modal")}-modal";
         Document.GetElementById(modalId).ClassList.Add("is-shown");
     }
 }
示例#2
0
        static void HandleSectionTrigger(DOMEventArgs evt)
        {
            HideAllSectionsAndDeselectButtons();

            using (var target = evt.EventObject.Target.ConvertTo <HTMLElement>())
            {
                // Highlight clicked button and show view
                target.ClassList.Add("is-selected");
                // Display the current section
                var sectionId = $"{target.GetAttribute("data-section")}-section";
                Document.GetElementById(sectionId)?.ClassList.Add("is-shown");


                // Save currently active button in localStorage
                var buttonId = target.Id;
                // save this off in a cookie somewhere
                //cookie.settings.set('activeSectionButtonId', buttonId)
            }
        }
示例#3
0
        public virtual void OpeningItem(IWebDriver wd, Logger logger)
        {
            var eventArgs = new DOMEventArgs(wd, logger);
            OnOpeningItem(this, eventArgs);

            if (eventArgs.ShouldCancelNavigation)
            {
                return;
            }

            var link = wd.FirstOrDefault(By.CssSelector(this.LocationCriteria));
            
            if (link == null || !link.IsDisplayed())
            {
                logger.Info("Couldn't find Element to Engage Alternate Activity for: {0}", Key);
                return;
            }

            link.Click();
        }
示例#4
0
 static void Button_OnClick(JSObject sender, DOMEventArgs args)
 {
     var button = (HTMLButtonElement)sender;
     //button.TextContent = "Clicked";
 }
示例#5
0
 public virtual void ClosingItem(IWebDriver wd, Logger logger)
 {
     var eventArgs = new DOMEventArgs(wd, logger);
     OnClosingItem(this, eventArgs);
 }