Exemplo n.º 1
0
        public ViewLocator(IViewPreferenceRepository viewPreferenceRepository,
                           IDebouncer debouncer,
                           ILogger <ViewLocator> logger,
                           ISidekickSettings settings,
                           ElectronCookieProtection electronCookieProtection,
                           IHostEnvironment hostEnvironment)
        {
            this.viewPreferenceRepository = viewPreferenceRepository;
            this.debouncer = debouncer;
            this.logger    = logger;
            this.settings  = settings;
            this.electronCookieProtection = electronCookieProtection;
            this.hostEnvironment          = hostEnvironment;

            ElectronNET.API.Electron.IpcMain.OnSync("close", (viewName) =>
            {
                logger.LogError("Force closing the Blazor view {viewName}", viewName);
                if (Enum.TryParse(viewName as string, true, out View view))
                {
                    Close(view);
                }
                else
                {
                    CloseAll();
                }

                return(null);
            });
        }
Exemplo n.º 2
0
        protected BaseView(Domain.Views.View view, IServiceProvider serviceProvider)
        {
            settings = serviceProvider.GetService <ISidekickSettings>();
            viewPreferenceRepository = serviceProvider.GetService <IViewPreferenceRepository>();
            logger = serviceProvider.GetService <ILogger <BaseView> >();

            IsVisibleChanged += EnsureBounds;
            Loaded           += EnsureBounds;
            Loaded           += BaseWindow_Loaded;
            SizeChanged      += EnsureBounds;

            View = view;
        }
Exemplo n.º 3
0
 public ViewInstance(ViewLocator locator, IViewPreferenceRepository viewPreferenceRepository)
 {
     view = locator.Views.Last();
     this.viewPreferenceRepository = viewPreferenceRepository;
 }