static void Zadanie3() { Console.WriteLine("1. Сделать скрипт который бы прокликал поочередно по всем элементам выпадающего меню"); MyMozila.Navigate().GoToUrl(UrlSite[0]); var wait = new WebDriverWait(MyMozila, TimeSpan.FromSeconds(15)); wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.CssSelector(".dropdown-menu"))); int DropMenuCount = MyMozila.FindElements(By.CssSelector("ul[class='dropdown-menu'] > li")).Count; int DropMenuSubCount = 0; IWebElement DropMenu, DropMenuSub; //var MyActions = new OpenQA.Selenium.Interactions.Actions(MyMozila); Console.WriteLine("Разделов меню: " + DropMenuCount); for (int i = 0; i < DropMenuCount; i++) { wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.CssSelector("ul[class='dropdown-menu'] > li"))); DropMenu = MyMozila.FindElements(By.CssSelector("ul[class='dropdown-menu'] > li"))[i]; DropMenuSubCount = DropMenu.FindElements(By.CssSelector("div[class='submenu-col'] ul li a")).Count; Console.WriteLine("Ссылок " + DropMenuSubCount + " в " + (i + 1) + " меню "); for (int j = 0; j < DropMenuSubCount; j++) { bool IsExit = false; while (!IsExit) { try { wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.CssSelector("ul[class='dropdown-menu'] > li"))); DropMenu = MyMozila.FindElements(By.CssSelector("ul[class='dropdown-menu'] > li"))[i]; DropMenu.Click(); // выбавет не показывает меню //MyActions.MoveToElement(DropMenu).Build().Perform(); wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("ul[class='dropdown-menu'] > li:nth-child(" + (i + 1) + ") div[class='submenu-col'] ul li a"))); DropMenuSub = DropMenu.FindElements(By.CssSelector("div[class='submenu-col'] ul li a"))[j]; Console.WriteLine(DropMenuSub.GetAttribute("href") + " " + (j + 1)); //break; DropMenuSub.Click(); Thread.Sleep(1500); // увидеть результат MyMozila.Navigate().GoToUrl(UrlSite[0]); IsExit = true; } catch { Console.WriteLine("клик не прошел, пробуем еще раз"); MyMozila.Navigate().GoToUrl(UrlSite[0]); } } } } Console.WriteLine("2. Сделать скрипт который бы прокликал поочередно по всем элементам выпадающего меню (один цикл)"); MyMozila.Navigate().GoToUrl(UrlSite[0]); wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.CssSelector("div[class='submenu-col']"))); Int32 objLinkForClickCount = MyMozila.FindElements(By.CssSelector("div[class='submenu-col'] ul li a")).Count; Console.WriteLine("Найдено " + objLinkForClickCount + " элементов"); IWebElement itemLink; for (int i = 0; i < objLinkForClickCount; i++) { wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.CssSelector("div[class='submenu-col'] ul li a"))); itemLink = MyMozila.FindElements(By.CssSelector("div[class='submenu-col'] ul li a"))[i]; Console.WriteLine(itemLink.GetAttribute("href") + " " + (i + 1)); ((IJavaScriptExecutor)MyMozila).ExecuteScript("arguments[0].click();", itemLink); wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.CssSelector("footer"))); Thread.Sleep(1500); // увидеть результат //MyMozila.Navigate().Back(); // на странице https://msk.tele2.ru/shop/number?pageParams=type%3Dchoose%26price%3D0 не пашет MyMozila.Navigate().GoToUrl(UrlSite[0]); // тогда так //break; } }
void Start() { Fon(0); //меняем фон на фон без поля dropMenu = GetComponent <DropMenu>(); }
public SettingsMenuOverlay(IGameLoopObject state) { titleMenuState = state; this.Add(new Cursor()); //Create button list settings = new GameObjectList(0, "buttons"); //Scroll scroll = new DropDown("scroll", new Vector2(600, -1000)); scroll.Drop = true; scroll.Speed = 600; settings.Add(scroll); //Menu text options = new TextGameObject("buttonFont", 1); options.Text = "Options"; options.Position = scroll.Position + new Vector2(150, 50); settings.Add(options); //Music Slider musicSlider = new SliderButton("sliderBack", "sliderFront", 1, "Music Volume:"); musicSlider.Position = scroll.Position + new Vector2(150, 150); musicSlider.Value = GameSettings.MusicVolume; settings.Add(musicSlider); //SoundEffect Slider soundEffectSlider = new SliderButton("sliderBack", "sliderFront", 1, "Sound Volume:"); soundEffectSlider.Position = scroll.Position + new Vector2(150, 250); soundEffectSlider.Value = GameSettings.SoundVolume; settings.Add(soundEffectSlider); //VoiceOver Slider voiceOverSlider = new SliderButton("sliderBack", "sliderFront", 1, "Voice Volume:"); voiceOverSlider.Position = scroll.Position + new Vector2(150, 350); voiceOverSlider.Value = GameSettings.VoiceVolume; settings.Add(voiceOverSlider); //Fullscreen CheckBox fullscreen = new CheckBox("checkBox", "buttonFont", 0, "Toggle Fullscreen:"); fullscreen.Position = scroll.Position + new Vector2(150, 450); fullscreen.Check = GameSettings.Fullscreen; settings.Add(fullscreen); //VSync CheckBox vsync = new CheckBox("checkBox", "buttonFont", 0, "Toggle VSync:"); vsync.Position = scroll.Position + new Vector2(150, 570); vsync.Check = GameSettings.VSync; settings.Add(vsync); //Resolution DropDown resolution = new DropMenu("dropMenu", "buttonFont", 3, 0, "Resolution:"); resolution.Position = scroll.Position + new Vector2(150, 690); switch (GameSettings.Resolution.X) { case 1920: resolution.Options[0].Text = "1900px X 1080px"; break; case 1600: resolution.Options[0].Text = "1600px X 900px"; break; case 1280: resolution.Options[0].Text = "1280px X 720px"; break; default: break; } resolution.Options[1].Text = "1920px X 1080px"; resolution.Options[2].Text = "1600px X 900px"; resolution.Options[3].Text = "1280px X 720px"; settings.Add(resolution); //Apply button apply = new Button("smallButton", "font", "smallFont", 0, "Apply"); apply.Position = scroll.Position + new Vector2(850, 750); settings.Add(apply); this.Add(settings); }
/// <summary> /// Default constructor. /// </summary> public MainWindow() { InitializeComponent(); IsRepeating = true; UseAnimation = true; OriginMouseSpeed = (uint)System.Windows.Forms.SystemInformation.MouseSpeed; Topmost = true; var vlcLibDirectory = new DirectoryInfo(Path.Combine( System.Reflection.Assembly.GetEntryAssembly().Location.Replace("TinyVideoPlayer.exe", ""), "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64")); var options = new [] { //"--file-logging", "-vvv", "--extraintf=logger", "--logfile=Logs.log", "--no-ignore-config" }; VideoControl.SourceProvider.CreatePlayer(vlcLibDirectory, options); VideoControl.RenderTransform = new TransformGroup { Children = new TransformCollection { new TranslateTransform(), new ScaleTransform() } }; #region Events subscribing VideoControl.SourceProvider.MediaPlayer.EndReached += MediaPlayer_EndReached; VideoControl.SourceProvider.MediaPlayer.MediaChanged += MediaPlayer_MediaChanged; VideoControl.SourceProvider.MediaPlayer.PositionChanged += MediaPlayer_PositionChanged; VideoControl.SourceProvider.MediaPlayer.EncounteredError += MediaPlayer_EncounteredError; VideoControl.Loaded += VideoControl_Loaded; DropZone.MouseWheel += DropZone_MouseWheel; DropZone.Drop += DropZone_Drop; DropZone.SizeChanged += DropZone_SizeChanged; DropZone.PreviewMouseLeftButtonDown += DropZone_PreviewMouseLeftButtonDown; DropZone.PreviewMouseMove += DropZone_PreviewMouseMove; DropZone.PreviewMouseLeftButtonUp += DropZone_PreviewMouseLeftButtonUp; DropZone.MouseDown += DropZone_MouseDown; MediaGrid.MouseEnter += MediaGrid_MouseEnter; MediaGrid.MouseLeave += MediaGrid_MouseLeave; SoundGrid.MouseEnter += SoundGrid_MouseEnter; SoundGrid.MouseLeave += SoundGrid_MouseLeave; ToolGrid.MouseEnter += ToolGrid_MouseEnter; ToolGrid.MouseLeave += ToolGrid_MouseLeave; TimeGrid.MouseEnter += TimeGrid_MouseEnter; TimeGrid.MouseLeave += TimeGrid_MouseLeave; ResizeButton.Click += MediaButton_ButtonClick; MaximizeButton.Click += MediaButton_ButtonClick; FindMediaButton.Click += MediaButton_ButtonClick; BrowserButton.Click += MediaButton_ButtonClick; ToggleMuteButton.Click += MediaButton_ButtonClick; ToggleRepeatButton.Click += MediaButton_ButtonClick; VolumeSlider.ValueChanged += VolumeSlider_ValueChanged; TimeSlider.ValueChanged += TimeSlider_ValueChanged; TimeSlider.PreviewMouseDown += TimeSlider_PreviewMouseDown; TimeSlider.PreviewMouseUp += TimeSlider_PreviewMouseUp; ThumbButton.Click += ThumbButton_Click; FavoriteButton.Click += FavoriteButton_Click; this.PreviewMouseLeftButtonDown += MainWindow_PreviewMouseLeftButtonDown; this.PreviewMouseRightButtonDown += MainWindow_PreviewMouseRightButtonDown; this.PreviewMouseMove += MainWindow_PreviewMouseMove; this.MouseEnter += MainWindow_MouseEnter; this.MouseLeave += MainWindow_MouseLeave; #endregion // Events subscribing #region Init bindings MediaGrid.SetBinding(Canvas.LeftProperty, new MultiBinding { Converter = new CenterConverter(), ConverterParameter = "left", Mode = BindingMode.TwoWay, Bindings = { new Binding("ActualWidth") { Source = DropZone }, new Binding("ActualHeight") { Source = DropZone }, new Binding("ActualWidth") { Source = MediaGrid }, new Binding("ActualHeight") { Source = MediaGrid } } }); DropMenu.SetBinding(Canvas.LeftProperty, new MultiBinding { Converter = new CenterConverter(), ConverterParameter = "left", Mode = BindingMode.TwoWay, Bindings = { new Binding("ActualWidth") { Source = DropZone }, new Binding("ActualHeight") { Source = DropZone }, new Binding("ActualWidth") { Source = DropMenu }, new Binding("ActualHeight") { Source = DropMenu } } }); DropMenu.SetBinding(Canvas.TopProperty, new MultiBinding { Converter = new CenterConverter(), ConverterParameter = "top", Mode = BindingMode.TwoWay, Bindings = { new Binding("ActualWidth") { Source = DropZone }, new Binding("ActualHeight") { Source = DropZone }, new Binding("ActualWidth") { Source = DropMenu }, new Binding("ActualHeight") { Source = DropMenu } } }); DropText.SetBinding(Canvas.TopProperty, new MultiBinding { Converter = new CenterConverter(), ConverterParameter = "top", Mode = BindingMode.TwoWay, Bindings = { new Binding("ActualWidth") { Source = DropZone }, new Binding("ActualHeight") { Source = DropZone }, new Binding("ActualWidth") { Source = DropText }, new Binding("ActualHeight") { Source = DropText } } }); TimeSlider.SetBinding(Canvas.BottomProperty, new MultiBinding { Converter = new CenterConverter(), ConverterParameter = "bottom", Mode = BindingMode.TwoWay, Bindings = { new Binding("ActualWidth") { Source = DropZone }, new Binding("ActualHeight") { Source = DropZone }, new Binding("ActualWidth") { Source = TimeSlider }, new Binding("ActualHeight") { Source = TimeSlider } } }); #endregion //Init bindings #region Init Visibility states ResizeButton.Visibility = Visibility.Hidden; FindMediaButton.Visibility = Visibility.Hidden; BrowserButton.Visibility = Visibility.Hidden; MaximizeButton.Visibility = Visibility.Hidden; VolumeSlider.Visibility = Visibility.Hidden; ToggleMuteButton.Visibility = Visibility.Hidden; DropMenu.Visibility = Visibility.Visible; TimeSlider.Visibility = Visibility.Hidden; ThumbButton.Visibility = Visibility.Hidden; FavoriteButton.Visibility = Visibility.Hidden; ToggleRepeatButton.Visibility = Visibility.Hidden; #endregion //Init Visibility states }