void DrawPowerSettingColorRect(Rect controlRect, PowerSetting powerSetting) { float size = EditorGUIUtility.singleLineHeight - POPUP_MARGIN; Rect colorRect = new Rect(controlRect.x + EditorGUIUtility.labelWidth - size, controlRect.y + POPUP_MARGIN / 2, size, size); EditorGUI.DrawRect(colorRect, powerSetting.GetVisualizationColor()); }
void SetAllTo(PowerSetting powerSetting) { for (int i = 0; i < settingsValues.arraySize; i++) { settingsValues.GetArrayElementAtIndex(i).enumValueIndex = (int)powerSetting; } }
private void ProcessActiveHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: IPowerScheduler ps = GlobalServiceProvider.Instance.Get <IPowerScheduler>(); if (ps == null) { return; } PowerSetting setting = ps.Settings.GetSetting("Processes"); TvBusinessLayer layer = new TvBusinessLayer(); string processString = layer.GetSetting("PowerSchedulerProcesses").Value; List <string> processes = new List <string>(); foreach (string process in processString.Split(',')) { processes.Add(process.Trim()); } if (!IsEqual(processes, setting.Get <List <string> >())) { setting.Set <List <string> >(processes); _processes = processes; foreach (string process in processes) { Log.Debug("PowerScheduler: preventing standby for process: {0}", process); } } break; } }
private void ProcessActiveHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: IPowerScheduler ps = GlobalServiceProvider.Instance.Get <IPowerScheduler>(); if (ps == null) { return; } PowerSetting setting = ps.Settings.GetSetting("Processes"); TvBusinessLayer layer = new TvBusinessLayer(); // Get processes to be monitored string processes = layer.GetSetting("PowerSchedulerProcesses").Value; // Split processes into processList elements List <string> processList = new List <string>(); foreach (string process in processes.Split(',')) { processList.Add(process.Trim()); } // If something has changed... if (!IsEqual(processList, setting.Get <List <string> >())) { setting.Set <List <string> >(processList); _processList = processList; Log.Debug("ProcessActiveHandler: Preventing standby for processes: {0}", processes); } // Check for MP client running? setting = ps.Settings.GetSetting("CheckForMPClientRunning"); _checkForMPClientRunning = Convert.ToBoolean(layer.GetSetting("PowerSchedulerCheckForMPClientRunning", "false").Value); if (setting.Get <bool>() != _checkForMPClientRunning) { setting.Set <bool>(_checkForMPClientRunning); Log.Debug("ProcessActiveHandler: Prevent standby when MP client is not running : {0}", _checkForMPClientRunning); } // Check if away mode should be used setting = ps.Settings.GetSetting("ProcessesAwayMode"); _useAwayMode = Convert.ToBoolean(layer.GetSetting("PowerSchedulerProcessesAwayMode", "false").Value); if (setting.Get <bool>() != _useAwayMode) { setting.Set <bool>(_useAwayMode); Log.Debug("ProcessActiveHandler: Use away mode: {0}", _useAwayMode); } break; } }
void DrawPowerSetting(SerializedProperty keyProperty, SerializedProperty valueProperty) { GUIContent label = new GUIContent(keyProperty.FindPropertyRelative("name").stringValue); Rect controlRect = EditorGUILayout.GetControlRect(true); PowerSetting currentSetting = GetPowerSettingFromSerializedProperty(valueProperty); DrawPowerSettingColorRect(controlRect, currentSetting); EditorGUI.PropertyField(controlRect, valueProperty, label, false); }
// The minimum settings required for a radio. protected void InitializeRadio(int serialNumber, FreqRange freqRange) { this.serialNumber = serialNumber; this.freqRange = freqRange; DetermineFreqRange(freqRange); currentPower = PowerSetting.Medium; currentChannel = (int)Channel.CH1; rx = new int[10]; tx = new int[10]; }
void DrawSetAllButton() { Rect controlRect = EditorGUILayout.GetControlRect(); Rect buttonRect = new Rect(controlRect.x, controlRect.y, EditorGUIUtility.labelWidth, EditorGUIUtility.singleLineHeight); if (GUI.Button(buttonRect, "Set all to:")) { SetAllTo(setAllValue); } Rect popupRect = new Rect(buttonRect.xMax + POPUP_MARGIN, buttonRect.y, controlRect.width - buttonRect.width, buttonRect.height); setAllValue = (PowerSetting)EditorGUI.EnumPopup(popupRect, GUIContent.none, setAllValue); }
private void ProcessActiveHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: IPowerScheduler ps = GlobalServiceProvider.Instance.Get <IPowerScheduler>(); if (ps == null) { return; } PowerSetting setting = ps.Settings.GetSetting("Processes"); using (Settings reader = new MPSettings()) { // Get processes to be monitored string processes = reader.GetValueAsString("psclientplugin", "Processes", String.Empty); // Split processes into processList elements List <string> processList = new List <string>(); foreach (string process in processes.Split(',')) { processList.Add(process.Trim()); } // If something has changed... if (!IsEqual(processList, setting.Get <List <string> >())) { setting.Set <List <string> >(processList); _processList = processList; Log.Debug("ProcessActiveHandler: Preventing standby for processes: {0}", processes); } // Check if away mode should be used setting = ps.Settings.GetSetting("ProcessesAwayMode"); _useAwayMode = reader.GetValueAsBool("psclientplugin", "ProcessesAwayMode", false); if (setting.Get <bool>() != _useAwayMode) { setting.Set <bool>(_useAwayMode); Log.Debug("ProcessActiveHandler: Use away mode: {0}", _useAwayMode); } break; } } }
/// <summary> /// For Debug and Editor purposes. /// Returns the associated Color for the PowerSetting. /// </summary> public static Color GetVisualizationColor(this PowerSetting powerSetting) { switch (powerSetting) { case PowerSetting.Kinematic: return(new Color(0.2f, 0.56f, 0.92f)); case PowerSetting.Powered: return(new Color(0.2f, 0.92f, 0.2f)); case PowerSetting.Unpowered: return(new Color(0.92f, 0.67f, 0.2f)); default: return(Color.white); } }
public static AquosCommand Power(PowerSetting setting) { return new AquosCommand(PowerSettingCommand, (int) setting); }
public static AquosCommand Power(PowerSetting setting) { return(new AquosCommand("POWR", Convert.ToString((int)setting))); }
public MainWindow() { InitializeComponent(); backlightPercentButtons.Add(new Button() { Content = "25 %", Style = FindResource("ButtonStyle") as Style }); backlightPercentButtons.Add(new Button() { Content = "50 %", Style = FindResource("ButtonSelectedStyle") as Style }); backlightPercentButtons.Add(new Button() { Content = "75 %", Style = FindResource("ButtonStyle") as Style }); backlightPercentButtons.Add(new Button() { Content = "100 %", Style = FindResource("ButtonStyle") as Style }); foreach (var backlightPercentButton in backlightPercentButtons) { backlightPercentButton.Click += BacklightPercentButton_Click; } SourceInitialized += (s, e) => { #if !UI_DESIGN PowerSetting.Init(new WindowInteropHelper(this).Handle); PowerSetting.OnMonitorStateChanged += PowerSetting_OnMonitorStateChanged; KeyboardHook.Init(); KeyboardHook.OnNumLockPressed += KeyboardHook_OnNumLockPressed; #endif }; Loaded += (s, e) => { Hide(); }; Unloaded += (s, e) => { #if !UI_DESIGN PowerSetting.Dispose(); KeyboardHook.Dispose(); #endif }; Closed += (s, e) => { taskbarIcon.Dispose(); #if !UI_DESIGN Chroma.Instance.Unregister(); Chroma.Instance.Uninitialize(); LogitechGSDK.LogiLedShutdown(); #endif }; CreateTaskbarIconInit(); #if !UI_DESIGN WaitForLEDSDKInit(); #else CreateTaskbarIcon(); #endif }
public static AquosCommand Power(PowerSetting setting, Television television = null) { return(new AquosCommand("POWR", Convert.ToString((int)setting), television)); }
public SettingNode(Guid powerSchemeGuid, Guid subGroupGuid, Guid powerSettingGuid, PersistentSettings settings) : base() { this.settings = settings; this.powerSchemeGuid = powerSchemeGuid; this.subGroupGuid = subGroupGuid; uint returnCode = 0; IntPtr friendlyName = IntPtr.Zero; IntPtr settingGuidPtr = IntPtr.Zero; IntPtr subGroupGuidPtr = IntPtr.Zero; IntPtr powerSchemeGuidPtr = IntPtr.Zero; try { friendlyName = Marshal.AllocHGlobal(1000); settingGuidPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Guid))); subGroupGuidPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Guid))); powerSchemeGuidPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Guid))); uint bufferSize = 1000; Marshal.StructureToPtr(powerSchemeGuid, powerSchemeGuidPtr, true); Marshal.StructureToPtr(subGroupGuid, subGroupGuidPtr, true); Marshal.StructureToPtr(powerSettingGuid, settingGuidPtr, true); //Get the power setting name. NativeMethods.PowerReadFriendlyName( IntPtr.Zero, powerSchemeGuidPtr, subGroupGuidPtr, settingGuidPtr, friendlyName, ref bufferSize); string settingName = Marshal.PtrToStringUni(friendlyName); powerSetting = new PowerSetting(); powerSetting.Name = settingName; powerSetting.Guid = powerSettingGuid.ToString(); powerSetting.Description = PowerManager.GetDescription(powerSchemeGuid.ToString(), subGroupGuid.ToString(), powerSetting.Guid); returnCode = NativeMethods.PowerReadACValueIndex( IntPtr.Zero, powerSchemeGuidPtr, subGroupGuidPtr, settingGuidPtr, ref acValue); returnCode = NativeMethods.PowerReadDCValueIndex( IntPtr.Zero, powerSchemeGuidPtr, subGroupGuidPtr, settingGuidPtr, ref dcValue); isRange = NativeMethods.PowerIsSettingRangeDefined(subGroupGuidPtr, settingGuidPtr); // Bit mask !!! isHidden = 1 == (NativeMethods.PowerReadSettingAttributes(subGroupGuidPtr, settingGuidPtr) & 1); base.IsVisible = !isHidden; if (isRange) { ReadNonindexedValues(subGroupGuidPtr, settingGuidPtr); } else { ReadIndexedValues(subGroupGuidPtr, settingGuidPtr); } } catch (Exception exception) { throw new PowerManagerException(exception.Message, exception); } finally { Marshal.FreeHGlobal(friendlyName); Marshal.FreeHGlobal(powerSchemeGuidPtr); Marshal.FreeHGlobal(subGroupGuidPtr); Marshal.FreeHGlobal(settingGuidPtr); } }
public static AquosCommand Power(PowerSetting setting, Television television = null) { return new AquosCommand("POWR", Convert.ToString((int)setting), television); }
public static AquosCommand Power(PowerSetting setting) { return new AquosCommand("POWR", Convert.ToString((int)setting)); }