public ServerSettingsProxy(CpService serviceStub) : base(serviceStub, Consts.SERVERSETTINGS_SERVICE_NAME) { ServiceRegistration.Set <IServerSettingsClient>(this); }
public NativeTvProxy(CpService serviceStub) : base(serviceStub, "NativeTv") { ServiceRegistration.Set <ITvProvider>(this); }
public MainForm(ScreenManager screenManager) { _adaptToSizeEnabled = false; _screenManager = screenManager; ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Registering DirectX MainForm as IScreenControl service"); ServiceRegistration.Set <IScreenControl>(this); InitializeComponent(); // Use the native method because the Icon.ExtractAssociatedIcon throws an exception when running from UNC paths ushort uicon; IntPtr handle = NativeMethods.ExtractAssociatedIcon(Handle, ServiceRegistration.Get <IPathManager>().GetPath("<APPLICATION_PATH>"), out uicon); Icon = Icon.FromHandle(handle); CheckForIllegalCrossThreadCalls = false; StartupSettings startupSettings = ServiceRegistration.Get <ISettingsManager>().Load <StartupSettings>(); AppSettings appSettings = ServiceRegistration.Get <ISettingsManager>().Load <AppSettings>(); _previousMousePosition = new Point(-1, -1); // Default screen for splashscreen is the one from where MP2 was started. System.Windows.Forms.Screen preferredScreen = System.Windows.Forms.Screen.FromControl(this); int numberOfScreens = System.Windows.Forms.Screen.AllScreens.Length; int validScreenNum = GetScreenNum(); // Force the splashscreen to be displayed on a specific screen. if (startupSettings.StartupScreenNum >= 0 && startupSettings.StartupScreenNum < numberOfScreens) { validScreenNum = startupSettings.StartupScreenNum; preferredScreen = System.Windows.Forms.Screen.AllScreens[validScreenNum]; StartPosition = FormStartPosition.Manual; } // Store original desktop size _screenSize = preferredScreen.Bounds.Size; _screenBpp = preferredScreen.BitsPerPixel; Size desiredWindowedSize; if (appSettings.WindowPosition.HasValue && appSettings.WindowSize.HasValue) { desiredWindowedSize = appSettings.WindowSize.Value; Location = ValidatePosition(appSettings.WindowPosition.Value, preferredScreen.WorkingArea.Size, ref desiredWindowedSize); } else { Location = new Point(preferredScreen.WorkingArea.X, preferredScreen.WorkingArea.Y); desiredWindowedSize = new Size(SkinContext.SkinResources.SkinWidth, SkinContext.SkinResources.SkinHeight); } _previousWindowLocation = Location; _previousWindowClientSize = desiredWindowedSize; _previousWindowState = FormWindowState.Normal; if (appSettings.ScreenMode == ScreenMode.FullScreen) { SwitchToFullscreen(validScreenNum); } else { SwitchToWindowedSize(appSettings.ScreenMode, Location, desiredWindowedSize, false); } SkinContext.WindowSize = ClientSize; // GraphicsDevice has to be initialized after the form was sized correctly ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Initialize DirectX"); GraphicsDevice.Initialize_MainThread(this); // Read and apply ScreenSaver settings _screenSaverTimeOut = TimeSpan.FromMinutes(appSettings.ScreenSaverTimeoutMin); _isScreenSaverEnabled = appSettings.ScreenSaverEnabled; _applicationSuspendLevel = appSettings.SuspendLevel; UpdateSystemSuspendLevel_MainThread(); // Don't use UpdateSystemSuspendLevel() here because the window handle was not created yet Application.Idle += OnApplicationIdle; _adaptToSizeEnabled = true; VideoPlayerSynchronizationStrategy = new SynchronizeToPrimaryPlayer(); // Register touch events TouchDown += MainForm_OnTouchDown; TouchMove += MainForm_OnTouchMove; TouchUp += MainForm_OnTouchUp; }
public void Activated(PluginRuntime pluginRuntime) { ServiceRegistration.Set <ISkinEngine>(this); _screenSaverWasEnabled = WindowsAPI.ScreenSaverEnabled; WindowsAPI.ScreenSaverEnabled = false; }