Пример #1
0
        internal SEBContext(AppSettings settings)
        {
            appSettings   = settings;
            logger        = new Logger();
            hashAlgorithm = new HashAlgorithm();

            InitializeLogging();
            InitializeText();

            _dispatcher = Dispatcher.CurrentDispatcher;

            uiFactory  = new UserInterfaceFactory(text);
            messageBox = new MessageBoxFactory(text);

            taskbar = uiFactory.CreateTaskbar(logger);
            taskbar.QuitButtonClicked += Shell_QuitButtonClicked;
            taskbar.Show();

            workingAreaHandler = new WorkingAreaHandler(new ModuleLogger(logger, nameof(WorkingAreaHandler)));
            workingAreaHandler.InitializeWorkingArea(taskbar.GetAbsoluteHeight());

            taskview = uiFactory.CreateTaskview();

            var audioSettings = new AudioSettings();
            var audio         = new Audio(audioSettings, new ModuleLogger(logger, nameof(Audio)));

            audio.Initialize();
            taskbar.AddSystemControl(uiFactory.CreateAudioControl(audio, Location.Taskbar));

            var keyboard = new Keyboard(new ModuleLogger(logger, nameof(Keyboard)));

            keyboard.Initialize();
            taskbar.AddSystemControl(uiFactory.CreateKeyboardLayoutControl(keyboard, Location.Taskbar));

            var powerSupply = new PowerSupply(new ModuleLogger(logger, nameof(PowerSupply)));

            powerSupply.Initialize();
            taskbar.AddSystemControl(uiFactory.CreatePowerSupplyControl(powerSupply, Location.Taskbar));

            var wirelessAdapter = new WirelessAdapter(new ModuleLogger(logger, nameof(WirelessAdapter)));

            wirelessAdapter.Initialize();
            taskbar.AddSystemControl(uiFactory.CreateWirelessNetworkControl(wirelessAdapter, Location.Taskbar));

            browser = new BrowserApplication(appSettings, messageBox, true, new ModuleLogger(logger, nameof(BrowserApplication)), text);
            taskbar.AddApplicationControl(uiFactory.CreateApplicationControl(browser, Location.Taskbar), true);
            browser.TerminationRequested += () =>
            {
                Browser_TerminationRequested();
            };

            taskview.Add(browser);
            InitializeCef();
            foreach (string startUrl in appSettings.StartUrls)
            {
                browser.CreateNewInstance(startUrl);
            }
        }
Пример #2
0
        internal void InitializeWorkingArea(int taskbarHeight)
        {
            var identifier = WorkingAreaHandler.GetIdentifierForPrimaryDisplay();

            if (originalWorkingArea == null)
            {
                originalWorkingArea = GetWorkingArea();
                LogWorkingArea($"Saved original working area for {identifier}", originalWorkingArea);
            }

            var area = new Bounds
            {
                Left   = 0,
                Top    = 0,
                Right  = Screen.PrimaryScreen.Bounds.Width,
                Bottom = Screen.PrimaryScreen.Bounds.Height - taskbarHeight
            };

            LogWorkingArea($"Trying to set new working area for {identifier}", area);
            SetWorkingArea(area);
            LogWorkingArea($"Working area of {identifier} is now set to", GetWorkingArea());
        }