private void SaveWorkspace() { var general = m_deviceConfiguration.General; { // Profiles Tab for (var i = 0; i < general.Profiles.Length; i++) { var tabContent = (ProfileTabContent)ProfilesTabControl.TabPages[i].Controls[0]; tabContent.Save(general.Profiles[i]); } general.SelectedProfile = SelectedProfleComboBox.GetSelectedItem <byte>(); general.IsSmartEnabled = SmartCheckBox.Checked; } var ui = m_deviceConfiguration.Interface; { // General -> Screen Tab ui.Brightness = (byte)BrightnessTrackBar.Value; ui.DimTimeout = (byte)IdleTimeUpDow.Value; ui.PuffScreenDelay = (byte)(PuffScreenDelayUpDown.Value * 10); ui.IsStealthMode = StealthModeCheckBox.Checked; ui.IsFlipped = FlippedModeCheckBox.Checked; ui.MainScreenSkin = MainScreenSkinComboBox.GetSelectedItem <ArcticFoxConfiguration.Skin>(); ui.IsClassicMenu = UseClassicMenuCheckBox.Checked; ui.IsLogoEnabled = ShowLogoCheckBox.Checked; ui.IsClockOnMainScreen = ShowClockCheckBox.Checked; ui.ClockType = ClockTypeComboBox.GetSelectedItem <ArcticFoxConfiguration.ClockType>(); ui.ScreensaveDuration = ScreensaverTimeComboBox.GetSelectedItem <ArcticFoxConfiguration.ScreenProtectionTime>(); ui.ChargeScreenType = ChargeScreenComboBox.GetSelectedItem <ArcticFoxConfiguration.ChargeScreenType>(); // General -> Layout Tab -> Classic Screen ui.ClassicSkinVWLines.Line1 = SaveLineContent(ClassicVWLine1ComboBox, ClassicVWLine1FireCheckBox); ui.ClassicSkinVWLines.Line2 = SaveLineContent(ClassicVWLine2ComboBox, ClassicVWLine2FireCheckBox); ui.ClassicSkinVWLines.Line3 = SaveLineContent(ClassicVWLine3ComboBox, ClassicVWLine3FireCheckBox); ui.ClassicSkinVWLines.Line4 = SaveLineContent(ClassicVWLine4ComboBox, ClassicVWLine4FireCheckBox); ui.ClassicSkinTCLines.Line1 = SaveLineContent(ClassicTCLine1ComboBox, ClassicTCLine1FireCheckBox); ui.ClassicSkinTCLines.Line2 = SaveLineContent(ClassicTCLine2ComboBox, ClassicTCLine2FireCheckBox); ui.ClassicSkinTCLines.Line3 = SaveLineContent(ClassicTCLine3ComboBox, ClassicTCLine3FireCheckBox); ui.ClassicSkinTCLines.Line4 = SaveLineContent(ClassicTCLine4ComboBox, ClassicTCLine4FireCheckBox); // General -> Layout Tab -> Circle Screen ui.CircleSkinVWLines.Line1 = SaveLineContent(CircleVWLine1ComboBox); ui.CircleSkinVWLines.Line2 = SaveLineContent(CircleVWLine2ComboBox); ui.CircleSkinVWLines.Line3 = SaveLineContent(CircleVWLine3ComboBox, CircleVWLine3FireCheckBox); ui.CircleSkinTCLines.Line1 = SaveLineContent(CircleTCLine1ComboBox); ui.CircleSkinTCLines.Line2 = SaveLineContent(CircleTCLine2ComboBox); ui.CircleSkinTCLines.Line3 = SaveLineContent(CircleTCLine3ComboBox, CircleTCLine3FireCheckBox); // General -> Layout Tab -> Small Screen ui.SmallSkinVWLines.Line1 = SaveLineContent(SmallVWLine1ComboBox, SmallVWLine1FireCheckBox); ui.SmallSkinVWLines.Line2 = SaveLineContent(SmallVWLine2ComboBox, SmallVWLine2FireCheckBox); ui.SmallSkinTCLines.Line1 = SaveLineContent(SmallTCLine1ComboBox, SmallTCLine1FireCheckBox); ui.SmallSkinTCLines.Line2 = SaveLineContent(SmallTCLine2ComboBox, SmallTCLine2FireCheckBox); // General -> Controls Tab ui.ClicksVW[0] = ClicksVW2ComboBox.GetSelectedItem <ArcticFoxConfiguration.ClickAction>(); ui.ClicksVW[1] = ClicksVW3ComboBox.GetSelectedItem <ArcticFoxConfiguration.ClickAction>(); ui.ClicksVW[2] = ClicksVW4ComboBox.GetSelectedItem <ArcticFoxConfiguration.ClickAction>(); ui.ClicksTC[0] = ClicksTC2ComboBox.GetSelectedItem <ArcticFoxConfiguration.ClickAction>(); ui.ClicksTC[1] = ClicksTC3ComboBox.GetSelectedItem <ArcticFoxConfiguration.ClickAction>(); ui.ClicksTC[2] = ClicksTC4ComboBox.GetSelectedItem <ArcticFoxConfiguration.ClickAction>(); ui.IsUpDownSwapped = UpDownButtonsComboBox.GetSelectedItem <bool>(); ui.WakeUpByPlusMinus = WakeUpByPlusMinusCheckBox.Checked; ui.IsPowerStep1W = Step1WCheckBox.Checked; } var stats = m_deviceConfiguration.Counters; { var now = DateTime.Now; // General -> Stats Tab stats.PuffsCount = (uint)PuffsUpDown.Value; stats.PuffsTime = (uint)(PuffsTimeUpDown.Value * 10); // Time sync stats.DateTime.Year = (ushort)now.Year; stats.DateTime.Month = (byte)now.Month; stats.DateTime.Day = (byte)now.Day; stats.DateTime.Hour = (byte)now.Hour; stats.DateTime.Minute = (byte)now.Minute; stats.DateTime.Second = (byte)now.Second; ui.PuffsTimeFormat = PuffsTimeFormatComboBox.GetSelectedItem <ArcticFoxConfiguration.PuffsTimeFormat>(); } var advanced = m_deviceConfiguration.Advanced; { advanced.PuffCutOff = (byte)(PuffCutOffUpDown.Value * 10); advanced.ShuntCorrection = (byte)ShuntCorrectionUpDown.Value; advanced.BatteryModel = BatteryModelComboBox.GetSelectedItem <ArcticFoxConfiguration.BatteryModel>(); advanced.IsX32 = X32CheckBox.Checked; advanced.IsLightSleepMode = LightSleepCheckBox.Checked; advanced.ResetCountersOnStartup = ResetCountersCheckBox.Checked; advanced.CheckTCR = CheckTCRCheckBox.Checked; advanced.IsUsbCharge = UsbChargeCheckBox.Checked; advanced.UsbNoSleep = UsbNoSleepCheckBox.Checked; advanced.BatteryVoltageOffsets[0] = (sbyte)(Battery1OffsetUpDown.Value * 100); advanced.BatteryVoltageOffsets[1] = (sbyte)(Battery2OffsetUpDown.Value * 100); advanced.BatteryVoltageOffsets[2] = (sbyte)(Battery3OffsetUpDown.Value * 100); advanced.BatteryVoltageOffsets[3] = (sbyte)(Battery4OffsetUpDown.Value * 100); } }
private void InitializeComboBoxes() { // Fill Classic Skin ComboBoxes foreach (var comboBox in new[] { ClassicVWLine1ComboBox, ClassicVWLine2ComboBox, ClassicVWLine3ComboBox, ClassicVWLine4ComboBox, ClassicTCLine1ComboBox, ClassicTCLine2ComboBox, ClassicTCLine3ComboBox, ClassicTCLine4ComboBox, }) { comboBox.Fill(PredefinedData.ArcticFox.ClassicSkinLineContentItems); } // Fill Circle Skin ComboBoxes foreach (var comboBox in new[] { CircleVWLine1ComboBox, CircleVWLine2ComboBox, CircleTCLine1ComboBox, CircleTCLine2ComboBox }) { comboBox.Fill(PredefinedData.ArcticFox.CircleSkinLineContentItems); } CircleVWLine3ComboBox.Fill(PredefinedData.ArcticFox.CircleSkin3RdLineContentItems); CircleTCLine3ComboBox.Fill(PredefinedData.ArcticFox.CircleSkin3RdLineContentItems); // Fill Small Skin ComboBoxes foreach (var comboBox in new[] { SmallVWLine1ComboBox, SmallVWLine2ComboBox, SmallTCLine1ComboBox, SmallTCLine2ComboBox, }) { comboBox.Fill(PredefinedData.ArcticFox.SmallScreenLineContentItems); } MainScreenSkinComboBox.Fill(PredefinedData.ArcticFox.MainScreenSkins); ChargeScreenComboBox.Fill(PredefinedData.ArcticFox.ChargeScreenTypes); ClockTypeComboBox.Fill(PredefinedData.ArcticFox.ClockTypes); ScreensaverTimeComboBox.Fill(PredefinedData.ArcticFox.ScreenSaverTimes); foreach (var clickComboBox in new[] { ClicksVW2ComboBox, ClicksVW3ComboBox, ClicksVW4ComboBox, ClicksTC2ComboBox, ClicksTC3ComboBox, ClicksTC4ComboBox }) { clickComboBox.Fill(PredefinedData.ArcticFox.ClickActions); } UpDownButtonsComboBox.Fill(PredefinedData.ArcticFox.UpDownButtons); PuffsTimeFormatComboBox.Fill(PredefinedData.ArcticFox.PuffTimeFormats); BatteryModelComboBox.Fill(PredefinedData.ArcticFox.BatteryModels); BatteryModelComboBox.SelectedValueChanged += (s, e) => { var batteryModel = BatteryModelComboBox.GetSelectedItem <ArcticFoxConfiguration.BatteryModel>(); BatteryEditButton.Visible = batteryModel == ArcticFoxConfiguration.BatteryModel.Custom; }; SelectedProfleComboBox.SelectedValueChanged += (s, e) => { var profileIndex = SelectedProfleComboBox.GetSelectedItem <byte>(); if (profileIndex >= ProfilesTabControl.TabCount) { return; } for (var i = 0; i < ProfilesTabControl.TabCount; i++) { var tabPage = ProfilesTabControl.TabPages[i]; var tabContent = tabPage.Controls[0] as ProfileTabContent; if (tabContent == null) { return; } if (i == profileIndex) { tabContent.CanDeactive = false; tabContent.IsProfileActivated = true; } else { tabContent.CanDeactive = true; } } }; }