static void Main() { Log.Info("Application started."); // Application configuration. System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); // Main window creation and configuration. MainForm form = new MainForm(); form.Text = Resources.ApplicationTitle; // Browser initialisation. BrowserService.Init(); // Email configuration EmailService.SmtpServer = Properties.Settings.Default.SMTPIp; EmailService.SmtpPort = (int.Parse(Properties.Settings.Default.SMTPPort)); EmailService.SmtpUsername = Properties.Settings.Default.SMTPUsername; EmailService.SmtpPassword = Properties.Settings.Default.SMTPPassword; EmailService.SmtpEmailFrom = Properties.Settings.Default.Email; // Launch the MainForm. System.Windows.Forms.Application.Run(form); // Browser Destruction. BrowserService.Exit(); Log.Info("Application ended."); }
public BrowserNavigator(BrowserService rpOwner) { r_Owner = rpOwner; r_Owner.Messages.Subscribe(CommunicatorMessages.LoadCompleted, r => { var rMatch = r_LoadCompletedParameterRegex.Match(r); if (!rMatch.Success) { return; } CanGoBack = bool.Parse(rMatch.Groups[1].Value); CanGoForward = bool.Parse(rMatch.Groups[2].Value); Url = rMatch.Groups[3].Value; }); GoBackCommand = new DelegatedCommand(GoBack); GoForwardCommand = new DelegatedCommand(GoForward); NavigateCommand = new DelegatedCommand(Navigate); RefreshCommand = new DelegatedCommand(Refresh); SetCookieCommand = new DelegatedCommand(SetCookie); ResizeBrowserToFitGameCommand = new DelegatedCommand(ResizeBrowserToFitGame); }
public ExeMain() { InitializeComponent(); BrowserControl.BrowserInterfaceControl.LicenseDataContext.LicenseKeyStore = LicenseKeyStore; ConfigFromModelToView(ExeConfig.Default); try { var config = Bib3.Glob.InhaltAusDataiMitPfaad(ConfigFilePath).DeserializeFromUtf8 <ExeConfig>(); ConfigAttemptWriteToFileLast = config; ConfigFromModelToView(config); } catch { } BrowserControl.BrowserProcessCreateAction = () => { Task.Run(() => { BrowserProcessCreate("UI command"); }); }; BrowserService = new BrowserService { BrowserProcessCreatedLast = () => BrowserProcessCreationLast?.Value, BrowserProcessCreate = BrowserProcessCreate, }; Timer = new DispatcherTimer(TimeSpan.FromMilliseconds(100), DispatcherPriority.Normal, new EventHandler(TimerElapsed), Dispatcher); }
public GameController(BrowserService rpOwner) { r_Owner = rpOwner; TakeScreenshotToFileCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: false)); TakeScreenshotToClipboardCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: true)); OpenScreenshotToolCommand = new DelegatedCommand(ScreenshotTool.Open); if (OS.IsWin7OrLater && !rpOwner.NoInstalledLayoutEngines) try { foreach (var rSession in VolumeManager.Instance.EnumerateSessions()) rSession.Dispose(); VolumeManager.Instance.NewSession += VolumeManager_NewSession; } catch (Exception) { r_IsAudioDeviceNotAvailable = true; } MuteToggleCommand = new DelegatedCommand(() => { if (Volume != null) Volume.IsMute = !Volume.IsMute; }, () => OS.IsWin7OrLater && !r_IsAudioDeviceNotAvailable); SetZoomCommand = new DelegatedCommand<double>(SetZoom); SupportedZoomFactors = new[] { .25, .5, .75, 1.0, 1.25, 1.5, 1.75, 2.0, 3.0, 4.0 }.Select(r => new BrowserZoomInfo(r, SetZoomCommand)).ToList().AsReadOnly(); RestartGameCommand = new DelegatedCommand(RestartGame); }
private async Task ChangeBodyNav(ConfigType configType) { await InvokeAsync(() => { switch (configType) { case ConfigType.Face: BodyManager = BrowserService.GetBodyComponentManager <Face>(); break; case ConfigType.Hair: BodyManager = BrowserService.GetBodyComponentManager <Hair>(); break; case ConfigType.Coat: BodyManager = BrowserService.GetBodyComponentManager <Coat>(); break; case ConfigType.Pants: BodyManager = BrowserService.GetBodyComponentManager <Pants>(); break; case ConfigType.Head: case ConfigType.Body: default: break; } StateHasChanged(); }); }
public async void OpensTermsOfService() { ViewModel.ViewTermsOfService.Execute(); TestScheduler.Start(); BrowserService.Received().OpenUrl(termsOfServiceUrl); }
public async Task CallsTheOpenStoreMethodOfTheBrowserService() { ViewModel.UpdateApp.Execute(); TestScheduler.Start(); BrowserService.Received().OpenStore(); }
public async void OpensPrivacyPolicy() { ViewModel.ViewPrivacyPolicy.Execute(); TestScheduler.Start(); BrowserService.Received().OpenUrl(privacyPolicyUrl); }
public AnalyticsOptInWindowViewModel() { _browserService = GoogleCloudExtensionPackage.Instance.GetMefServiceLazy <IBrowserService>(); OptInCommand = new ProtectedCommand(OnOptInCommand); AnalyticsLearnMoreLinkCommand = new ProtectedCommand( () => BrowserService.OpenBrowser(AnalyticsLearnMoreConstants.AnalyticsLearnMoreLink)); }
public void TogglesTheCurrentValueOfTheToggleUseTwentyFourHourClockProperty() { const string togglWebsiteUrl = "https://toggl.com"; ViewModel.OpenWebsiteCommand.Execute(); BrowserService.Received().OpenUrl(Arg.Is(togglWebsiteUrl)); }
public GameController(BrowserService rpOwner) { r_Owner = rpOwner; TakeScreenshotToFileCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: false)); TakeScreenshotToClipboardCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: true)); OpenScreenshotToolCommand = new DelegatedCommand(ScreenshotTool.Open); OpenScreenshotFolderCommand = new DelegatedCommand(() => Process.Start(Preference.Instance.Browser.Screenshot.Path)); if (OS.IsWin7OrLater && !rpOwner.NoInstalledLayoutEngines) { try { AudioManager.StartSessionNotification(); AudioManager.NewSession += AudioManager_NewSession; } catch (Exception) { r_IsAudioDeviceNotAvailable = true; } } MuteToggleCommand = new DelegatedCommand(() => { if (AudioSession != null) { try { AudioSession.IsMute = !AudioSession.IsMute; } catch (COMException e) when(e.ErrorCode == 0x8889004) { new TaskDialog() { Caption = StringResources.Instance.Main.Product_Name, Instruction = UnhandledExceptionDialogStringResources.Instruction, Icon = TaskDialogIcon.Error, Content = StringResources.Instance.Main.MessageDialog_AudioSessionDisconnected, OwnerWindow = App.Current.MainWindow, ShowAtTheCenterOfOwner = true, }.Show(); } } catch (COMException e) when(e.ErrorCode != 0x8889004) { new TaskDialog() { Caption = StringResources.Instance.Main.Product_Name, Instruction = UnhandledExceptionDialogStringResources.Instruction, Icon = TaskDialogIcon.Error, Content = e.ErrorCode.ToString(), OwnerWindow = App.Current.MainWindow, ShowAtTheCenterOfOwner = true, }.Show(); } }, () => OS.IsWin7OrLater && !r_IsAudioDeviceNotAvailable);
public async Task CallsTheOpenWebsiteMethodOfTheBrowserService() { const string togglWebsiteUrl = "https://toggl.com"; ViewModel.OpenWebsite.Execute(); TestScheduler.Start(); BrowserService.Received().OpenUrl(Arg.Is(togglWebsiteUrl)); }
public static object Evaluate <TComponent>(this TComponent element, string expression) where TComponent : Component { _javaScriptService = ServicesCollection.Current.Resolve <JavaScriptService>(); _browserService = ServicesCollection.Current.Resolve <BrowserService>(); _browserService.WaitForAngular(); return(_javaScriptService.Execute(AngularClientSideScripts.Evaluate, element, expression)); }
public BrowserViewModel(Authenticator authenticator, ICremaHost cremaHost, ICremaAppHost cremaAppHost, PropertyService propertyService, BrowserService browserService, DocumentServiceViewModel documentService) { this.authenticator = authenticator; this.cremaHost = cremaHost; this.cremaAppHost = cremaAppHost; this.propertyService = propertyService; this.browserService = browserService; this.documentService = documentService; }
public void ChangeRegion_MustReturnRegionNotFoundException() { IBrowserService browserService = new BrowserService(); var regionChangeService = new RegionChangeService(browserService); Assert.ThrowsException <RegionNotFoundException>(() => regionChangeService.ChangeRegion("monako")); browserService.Browser.Close(); browserService.Browser.Dispose(); }
async Task <bool> IAuthenticate.SignOutAsync() { var auth = BaseAuthProvider.GetAuthProvider(GlobalAttributes.User.EProviderType); await App.CurrentClient.LogoutAsync(); if (!string.IsNullOrWhiteSpace(auth.GetSignoutUrl())) { BrowserService.OpenUrl(this, auth.GetSignoutUrl()); } return(true); }
public void UpdateProductQuantity(int productNumber, int newQuantity) { if (productNumber > QuantityBoxes.Count()) { throw new ArgumentException("There are less added items in the cart. Please specify smaller product number."); } BrowserService.WaitUntilReady(); QuantityBoxes[productNumber - 1].SetNumber(newQuantity); UpdateCart.Click(); BrowserService.WaitUntilReady(); }
public GameController(BrowserService rpOwner) { r_Owner = rpOwner; TakeScreenshotToFileCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: false)); TakeScreenshotToClipboardCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: true)); OpenScreenshotToolCommand = new DelegatedCommand(ScreenshotTool.Open); if (OS.IsWin7OrLater && !rpOwner.NoInstalledLayoutEngines) { try { AudioManager.Instance.StartSessionNotification(); AudioManager.Instance.NewSession += AudioManager_NewSession; } catch (Exception) { r_IsAudioDeviceNotAvailable = true; } } MuteToggleCommand = new DelegatedCommand(() => { if (AudioSession != null) { try { AudioSession.IsMute = !AudioSession.IsMute; } catch (COMException e) when(e.ErrorCode == 0x8889004) { new TaskDialog() { Caption = StringResources.Instance.Main.Product_Name, Instruction = UnhandledExceptionDialogStringResources.Instruction, Icon = TaskDialogIcon.Error, Content = StringResources.Instance.Main.MessageDialog_AudioSessionDisconnected, OwnerWindow = App.Current.MainWindow, ShowAtTheCenterOfOwner = true, }.Show(); } } }, () => OS.IsWin7OrLater && !r_IsAudioDeviceNotAvailable); SetZoomCommand = new DelegatedCommand <double>(SetZoom); ZoomInCommand = new DelegatedCommand(() => SetZoom(Zoom + .05)); ZoomOutCommand = new DelegatedCommand(() => SetZoom(Zoom - .05)); ZoomFactors = new[] { .25, .5, .75, 1.0, 1.25, 1.5, 1.75, 2.0 }.Select(r => new BrowserZoomInfo(r, SetZoomCommand)).ToList().AsReadOnly(); RestartGameCommand = new DelegatedCommand(RestartGame); }
public IGhost[] GetGhosts(IServiceProvider prov) { SvgHelper svgHelper = (SvgHelper)prov.GetService(typeof(SvgHelper)); BrowserService bs = (BrowserService)prov.GetService(typeof(BrowserService)); return(new[] { new Ghost(svgHelper, bs), new Ghost(svgHelper, bs), new Ghost(svgHelper, bs), new Ghost(svgHelper, bs) }); }
protected async override Task OnInitializedAsync() { currentNode = await Manager.GetNode(Path); req = new ListRequest <Node> { Start = 0, Parameter = currentNode, Num = 100 }; items = await LoadingItems(0); searchItems = items; mediatimer = new Timer(new TimerCallback(LoadingMedias), null, 100, 500); await BrowserService.DebugInfo("init"); }
public void ChangeRegion_MustChangeRegionInMVideoSite() { IBrowserService browserService = new BrowserService(); var regionChangeService = new RegionChangeService(browserService); regionChangeService.ChangeRegion("Екатеринбург"); Assert.AreEqual(browserService.Browser.FindElement(HomePageProperties.LocationText).Text, "Екатеринбург"); browserService.Browser.Close(); browserService.Browser.Dispose(); }
protected async override Task OnInitializedAsync() { Notifier.Notify += OnNotify; BodyManager = BrowserService.GetBodyComponentManager <Face>(); anitimer = new Timer(new TimerCallback(Animate), null, Timeout.Infinite, 60); Skins = await BrowserService.GetSkins(); character = await BrowserService.GetDefaultCharacter(); currentSkin = character.Id; currentAction = character.CurrentHeadMotion.Name; faceAniTimer = new Timer(new TimerCallback(FaceAnimate), null, 100, character.FaceDelay); await RefreshDataAsync(true); }
public void Detect() { foreach (var accessor in Accessors) { var contextService = new HttpContextService(accessor); var userAgentService = new UserAgentService(contextService); var platformService = new PlatformService(userAgentService); var engineService = new EngineService(userAgentService, platformService); var browserService = new BrowserService(userAgentService, engineService); var deviceService = new DeviceService(userAgentService); _ = browserService.Name; _ = browserService.Version; _ = deviceService.Type; } }
protected override async Task OnInitializedAsync() { // Subscribe to the StateChanged EventHandler AppState.StateChanged += AppStateHasChanged; System.Console.WriteLine("Main Layout Initialized"); AppState.IsMobile = await BrowserService.CheckIsMobile(); System.Console.WriteLine("Main Layout Initialized 2"); AppState.StateHasChanged(); System.Console.WriteLine("Sections Initialized"); }
public bool IsApplicable(Exception ex = null, ServicesCollection container = null, params object[] context) { if (container == null) { container = ServicesCollection.Current; } BrowserService browserService = container.Resolve <BrowserService>(); if (browserService == null) { throw new ArgumentNullException(nameof(BrowserService)); } var result = browserService.HtmlSource.Contains(TextToSearchInSource); return(result); }
protected async Task RefreshDataAsync(bool isFirst = false) { loading = true; StopAnimation(); Actions = await BrowserService.GetActions(character.Id); if (!isFirst) { character = await BrowserService.GetCharacterAsync(currentSkin, currentAction, 0); } Frames = character.CurrentBodyMotion.Actions.Keys.Select(key => int.Parse(key)).ToList(); CurrentFrame = 0; CurrentFaceFrame = 0; character.EarType = currentEarType; PlayAnimation(); loading = false; }
protected async override Task OnAfterRenderAsync(bool firstRender) { if (hasNext) { var results = await LoadingItems(items.Count); foreach (var item in results) { if (items.ContainsKey(item.Key)) { continue; } items.Add(item); } searchItems = items; StateHasChanged(); } await BrowserService.DebugInfo("render"); }
public void RunTest() { Console.WriteLine(nameof(RegisterAppointmentTestScenario)); using (IBrowserService browserService = new BrowserService()) { browserService.GoToUrl($"{AllergoConsts.ApplicationUrl}/login"); browserService.FillInput(By.Id("pp-login"), "patient"); browserService.FillInput(By.Id("pp-password"), "Haslo123."); browserService.ClickElement(By.XPath("//button//span[text()='Zaloguj się']")); browserService.ClickElement(By.XPath("//app-nav-menu/div/ul/li[2]/a")); browserService.FillInput(By.Id("pp-search-doctor"), "Doktor Doktorski"); browserService.ClickElement( By.XPath("//span[@class='mat-option-text' and contains(text(),'Doktor Doktorski')]")); browserService.Sleep(TimeSpan.FromSeconds(3)); browserService.ClickElement( By.XPath("//mat-accordion//mat-panel-title[contains(text(),'Piątek')]")); browserService.ClickElement( By.XPath( "//mat-accordion//mat-panel-title[contains(text(),'Piątek')]//..//..//..//button//span[contains(text(),'11:30')]")); browserService.ClickElement(By.XPath("//app-set-appointment//button//span[text()='Tak']")); browserService.ClickElement(By.XPath("//button//span[contains(text(),'Przejdź do Twoich wizyt')]")); browserService.ClickElement(By.XPath( "//mat-expansion-panel//span[@class='mat-content']//mat-panel-title[contains(text(),'11:30')]")); browserService.ClickElement(By.XPath("//button//span[contains(text(),'Odwołaj')]")); browserService.Sleep(TimeSpan.FromSeconds(2)); } }
public BrowserNavigator(BrowserService rpOwner) { r_Owner = rpOwner; r_Owner.Messages.Subscribe(CommunicatorMessages.LoadCompleted, r => { var rMatch = r_LoadCompletedParameterRegex.Match(r); if (!rMatch.Success) return; CanGoBack = bool.Parse(rMatch.Groups[1].Value); CanGoForward = bool.Parse(rMatch.Groups[2].Value); Url = rMatch.Groups[3].Value; }); GoBackCommand = new DelegatedCommand(GoBack); GoForwardCommand = new DelegatedCommand(GoForward); NavigateCommand = new DelegatedCommand(Navigate); RefreshCommand = new DelegatedCommand(Refresh); ResizeBrowserToFitGameCommand = new DelegatedCommand(ResizeBrowserToFitGame); }
public void RunTest() { Console.WriteLine(nameof(CreateScheduleTestScenario)); using (IBrowserService browserService = new BrowserService()) { browserService.GoToUrl($"{AllergoConsts.ApplicationUrl}/login"); browserService.FillInput(By.Id("pp-login"), "doctor"); browserService.FillInput(By.Id("pp-password"), "Haslo123."); browserService.ClickElement(By.XPath("//button//span[text()='Zaloguj się']")); browserService.ClickElement(By.XPath("//app-nav-menu/div/ul/li[2]/ul/li/a")); browserService.ClickElement( By.XPath("//button//span[contains(text(),'Dodaj nowe godziny przyjęć')]")); browserService.ClickElement( By.Id("pp-add-admission-hour-weekday")); browserService.ClickElement( By.XPath("//span[@class='mat-option-text' and contains(text(),'Piątek')]")); browserService.FillInput(By.Id("mat-input-2"), "800AM"); browserService.FillInput(By.Id("mat-input-3"), "1000AM"); browserService.ClickElement(By.XPath("//button//span[text()='Zapisz']")); browserService.Sleep(TimeSpan.FromSeconds(1)); browserService.ClickElement( By.XPath("//mat-accordion//mat-panel-title[contains(text(),'Piątek')]")); browserService.ClickElement( By.XPath( "//mat-accordion//div[@class='mat-expansion-panel-body']//button//span[contains(text(),'8:00 - 10:00')]")); browserService.ClickElement(By.XPath("//app-remove-admission-hour//button//span[text()='Tak']")); } }
public void WaitForAjax() { BrowserService.WaitForAjax(); }
public void OpensPrivacyPolicy() { ViewModel.ViewPrivacyPolicyCommand.Execute(); BrowserService.Received().OpenUrl(privacyPolicyUrl); }
public GameController(BrowserService rpOwner) { r_Owner = rpOwner; TakeScreenshotToFileCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: false)); TakeScreenshotToClipboardCommand = new DelegatedCommand(() => ScreenshotService.Instance.TakeScreenshotAndOutput(rpOutputToClipboard: true)); OpenScreenshotToolCommand = new DelegatedCommand(ScreenshotTool.Open); OpenScreenshotFolderCommand = new DelegatedCommand(() => Process.Start(Preference.Instance.Browser.Screenshot.Path)); if (OS.IsWin7OrLater && !rpOwner.NoInstalledLayoutEngines) try { AudioManager.StartSessionNotification(); AudioManager.NewSession += AudioManager_NewSession; } catch (Exception) { r_IsAudioDeviceNotAvailable = true; } MuteToggleCommand = new DelegatedCommand(() => { if (AudioSession != null) try { AudioSession.IsMute = !AudioSession.IsMute; } catch (COMException e) when (e.ErrorCode == 0x8889004) { new TaskDialog() { Caption = StringResources.Instance.Main.Product_Name, Instruction = UnhandledExceptionDialogStringResources.Instruction, Icon = TaskDialogIcon.Error, Content = StringResources.Instance.Main.MessageDialog_AudioSessionDisconnected, OwnerWindow = App.Current.MainWindow, ShowAtTheCenterOfOwner = true, }.Show(); } catch (COMException e) when (e.ErrorCode != 0x8889004) { new TaskDialog() { Caption = StringResources.Instance.Main.Product_Name, Instruction = UnhandledExceptionDialogStringResources.Instruction, Icon = TaskDialogIcon.Error, Content = e.ErrorCode.ToString(), OwnerWindow = App.Current.MainWindow, ShowAtTheCenterOfOwner = true, }.Show(); } }, () => OS.IsWin7OrLater && !r_IsAudioDeviceNotAvailable); SetZoomCommand = new DelegatedCommand<double>(SetZoom); ZoomInCommand = new DelegatedCommand(() => SetZoom(Preference.Instance.Browser.Zoom.Value + .05)); ZoomOutCommand = new DelegatedCommand(() => SetZoom(Preference.Instance.Browser.Zoom.Value - .05)); ZoomFactors = new[] { .25, .5, .75, 1.0, 1.25, 1.5, 1.75, 2.0 }.Select(r => new BrowserZoomInfo(r, SetZoomCommand)).ToArray(); RestartGameCommand = new DelegatedCommand(RestartGame); }