public AboutView(IServiceProvider serviceProvider, INativeBrowser browser) : base("about", serviceProvider) { DataContext = this; InitializeComponent(); Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); VersionNumber = fileVersionInfo.ProductVersion; try { OperatingSystem = Environment.OSVersion.VersionString; EnvironmentVersion = Environment.Version.ToString(); } catch (Exception) { // Getting the operating system can fail } Show(); this.browser = browser; }
public PriceView( IServiceProvider serviceProvider, PriceViewModel viewModel, INativeBrowser nativeBrowser, INativeCursor cursor) : base(serviceProvider, closeOnBlur: true) { this.viewModel = viewModel; this.nativeBrowser = nativeBrowser; InitializeComponent(); DataContext = viewModel; Loaded += OverlayWindow_Loaded; Show(); Activate(); var position = cursor.GetCursorPosition(); SetWindowPositionFromBottomRight(position.X - 10, position.Y - 10); if (viewModel.IsError) { Dispatcher.InvokeAsync(async() => { await Task.Delay(1500); Close(); }); } }
public PoeDbClient(ILogger logger, ILanguageProvider languageProvider, INativeBrowser nativeBrowser) { this.logger = logger; this.languageProvider = languageProvider; this.nativeBrowser = nativeBrowser; }
public PoeDbClient(ILogger logger, ILanguageProvider languageProvider, INativeBrowser nativeBrowser) { this.logger = logger.ForContext(GetType()); this.languageProvider = languageProvider; this.nativeBrowser = nativeBrowser; }
public TradeSearchService(ILogger logger, ILanguageProvider languageProvider, IHttpClientProvider httpClientProvider, IStaticDataService staticDataService, SidekickSettings configuration, IPoeTradeClient poeTradeClient, INativeBrowser nativeBrowser) { this.logger = logger.ForContext(GetType()); this.languageProvider = languageProvider; this.httpClientProvider = httpClientProvider; this.staticDataService = staticDataService; this.configuration = configuration; this.poeTradeClient = poeTradeClient; this.nativeBrowser = nativeBrowser; }
public TradeClient(ILogger logger, ILanguageProvider languageProvider, IHttpClientProvider httpClientProvider, IStaticItemCategoryService staticItemCategoryService, SidekickSettings configuration, IPoeApiClient poeApiClient, INativeBrowser nativeBrowser) { this.logger = logger; this.languageProvider = languageProvider; this.httpClientProvider = httpClientProvider; this.staticItemCategoryService = staticItemCategoryService; this.configuration = configuration; this.poeApiClient = poeApiClient; this.nativeBrowser = nativeBrowser; }
public PriceView( IServiceProvider serviceProvider, PriceViewModel viewModel, INativeBrowser nativeBrowser, INativeCursor cursor) : base(serviceProvider, closeOnBlur: true) { this.viewModel = viewModel; this.nativeBrowser = nativeBrowser; InitializeComponent(); DataContext = viewModel; Loaded += OverlayWindow_Loaded; Show(); Activate(); if (GetMouseXPercent() > 0.5) { MoveWhenOpeningPreview = true; SetWindowPositionPercent(0.66 - GetWidthPercent(), 0.5 - (GetHeightPercent() / 2)); } else { SetWindowPositionPercent(0.34, 0.5 - (GetHeightPercent() / 2)); } if (viewModel.IsError) { Dispatcher.InvokeAsync(async() => { await Task.Delay(1500); Close(); }); } viewModel.PropertyChanged += ViewModel_PropertyChanged; }
public PriceView( IServiceProvider serviceProvider, PriceViewModel viewModel, INativeBrowser nativeBrowser) : base("price", serviceProvider) { this.viewModel = viewModel; this.nativeBrowser = nativeBrowser; InitializeComponent(); DataContext = viewModel; Loaded += OverlayWindow_Loaded; Show(); Activate(); SetTopPercent(0.5, LocationSource.Center); if (GetMouseXPercent() > 0.5) { SetLeftPercent(0.654, LocationSource.End); } else { SetLeftPercent(0.346, LocationSource.Begin); } if (viewModel.IsError) { Dispatcher.InvokeAsync(async() => { await Task.Delay(1500); Close(); }); } viewModel.PropertyChanged += ViewModel_PropertyChanged; }
protected override async void OnStartup(StartupEventArgs e) { Instance = this; base.OnStartup(e); AttachErrorHandlers(); // Tooltip opened indefinitely until mouse is moved. ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(int.MaxValue)); serviceProvider = Sidekick.Startup.InitializeServices(this); logger = serviceProvider.GetRequiredService <ILogger>(); nativeProcess = serviceProvider.GetRequiredService <INativeProcess>(); nativeBrowser = serviceProvider.GetRequiredService <INativeBrowser>(); leagueDataService = serviceProvider.GetRequiredService <ILeagueDataService>(); initializer = serviceProvider.GetRequiredService <IInitializer>(); viewLocator = serviceProvider.GetRequiredService <IViewLocator>(); settings = serviceProvider.GetRequiredService <SidekickSettings>(); trayIcon = (TaskbarIcon)FindResource("TrayIcon"); trayIcon.DataContext = serviceProvider.GetRequiredService <TrayIconViewModel>(); await RunAutoUpdate(); EnsureSingleInstance(); leagueDataService.OnNewLeagues += () => { Dispatcher.Invoke(() => { AdonisUI.Controls.MessageBox.Show(InitializerResources.Warn_NewLeagues, buttons: AdonisUI.Controls.MessageBoxButton.OK); }); }; if (settings.ShowSplashScreen) { initializer.OnProgress += (a) => { if (!viewLocator.IsOpened <SplashScreenView>()) { Dispatcher.Invoke(() => { viewLocator.Open <SplashScreenView>(); }); } }; } initializer.OnError += (error) => { AdonisUI.Controls.MessageBox.Show(InitializerResources.ErrorDuringInit, buttons: AdonisUI.Controls.MessageBoxButton.OK); base.Shutdown(1); }; await initializer.Initialize(); trayIcon.ShowBalloonTip( TrayResources.Notification_Title, string.Format(TrayResources.Notification_Message, settings.Key_CheckPrices.ToKeybindString(), settings.Key_CloseWindow.ToKeybindString()), trayIcon.Icon, largeIcon: true); serviceProvider.GetRequiredService <EventsHandler>(); }