Пример #1
0
        public RemoteControlForm(LgService lgService, List <LgPreset> buttons)
        {
            _lgService = lgService;
            _buttons   = buttons;

            InitializeComponent();

            pnlMouse.MouseWheel += new MouseEventHandler(pnlMouse_MouseWheel);
        }
Пример #2
0
        private static bool HandleStartupParams(StartUpParams startUpParams, Process existingProcess)
        {
            if (startUpParams.ActivateChromeFontFix || startUpParams.DeactivateChromeFontFix)
            {
                Utils.InstallChromeFix(startUpParams.ActivateChromeFontFix);
                return(true);
            }
            if (startUpParams.EnableAutoStart || startUpParams.DisableAutoStart)
            {
                Utils.RegisterTask(TS_TASKNAME, startUpParams.EnableAutoStart);
                return(true);
            }

            var useConsole = startUpParams.NoGui || existingProcess != null;

            if (!useConsole)
            {
                return(false);
            }

            startUpParams.NoGui = true;

            var result = false;

            if (startUpParams.ExecuteHelp)
            {
                Utils.OpenConsole();

                Console.WriteLine("\nColorControl CLI");
                Console.WriteLine("Syntax  : ColorControl command options");
                Console.WriteLine("Commands:");
                Console.WriteLine("--nvpreset  <preset name or id>: execute NVIDIA-preset");
                Console.WriteLine("--amdpreset <preset name or id>: execute AMD-preset");
                Console.WriteLine("--lgpreset  <preset name>      : execute LG-preset");
                Console.WriteLine("--help                         : displays this help info");
                Console.WriteLine("Options:");
                Console.WriteLine("--nogui: starts command from the command line and will not open GUI (is forced when GUI is already running)");

                result = true;
            }

            if (startUpParams.ExecuteLgPreset)
            {
                Utils.OpenConsole();

                Console.WriteLine($"Executing LG-preset '{startUpParams.LgPresetName}'...");
                var task = LgService.ExecutePresetAsync(startUpParams.LgPresetName);

                var taskResult = Utils.WaitForTask(task);

                if (taskResult)
                {
                    Console.WriteLine("Done.");
                }

                result = true;
            }

            if (startUpParams.ExecuteNvidiaPreset)
            {
                Utils.OpenConsole();

                Console.WriteLine($"Executing NVIDIA-preset '{startUpParams.NvidiaPresetIdOrName}'...");
                var taskResult = NvService.ExecutePresetAsync(startUpParams.NvidiaPresetIdOrName);

                if (taskResult)
                {
                    Console.WriteLine("Done.");
                }

                result = true;
            }

            if (startUpParams.ExecuteAmdPreset)
            {
                Utils.OpenConsole();

                Console.WriteLine($"Executing AMD-preset '{startUpParams.AmdPresetIdOrName}'...");
                var taskResult = AmdService.ExecutePresetAsync(startUpParams.AmdPresetIdOrName);

                if (taskResult)
                {
                    Console.WriteLine("Done.");
                }

                result = true;
            }

            return(result);
        }