private void pictureBox11_Click(object sender, EventArgs e) { if (ConfigPanel.Visible) { ConfigPanel.Visible = false; } else { ConfigPanel.Visible = true; } ConfigPanel.Focus(); }
private void CloseAnimation() { DoubleAnimation closeAnimation = new DoubleAnimation { From = 500, To = 0, Duration = new Duration(TimeSpan.FromSeconds(0.25)) }; ConfigPanel.BeginAnimation(ColumnDefinition.MinWidthProperty, closeAnimation); Height = 390; Width = 200; }
private void OpenAnimation() { Height = 360; Width = 700; DoubleAnimation openAnimation = new DoubleAnimation { From = 0, To = 500, Duration = new Duration(TimeSpan.FromSeconds(0.25)) }; ConfigPanel.BeginAnimation(ColumnDefinition.MinWidthProperty, openAnimation); }
private void ShowConfig() { MenuVisiable(false); ConfigPanel.Visible = true; ConfigPanel.Focus(); soundOn.Checked = config.Sound; speed.Value = config.Speed; if (config.Mos) { radioButton1.Checked = true; } else { radioButton2.Checked = true; } }
protected override void OnMouseDown(MouseButtonEventArgs e) { base.OnMouseDown(e); Console.WriteLine("JHLIM_DEBUG : " + servergrid.btn_group[0]?.Root["work_group"]?["test3"]); JObject root = JObject.Parse("{ \"File Config\" : " + servergrid.btn_group[0].Root + ", \"Sam Config\" : " + servergrid.btn_group[1].Root + ", \"Tail Config\" : " + servergrid.btn_group[2].Root + " }"); servergrid.btn_group.Clear(); ConfigPanel panel_server = ConvertFromJson(root); grid.Children.Clear(); grid.Children.Add(panel_server); if (servergrid.btn_group.Count > 0) { servergrid.btn_group[0].IsChecked = true; } }
/// <summary> /// Create a plug-in dialog. /// </summary> /// <remarks> /// Save the last used algorithm configuration to a file. /// </remarks> /// <returns>Gimp plug-in dialog</returns> protected override GimpDialog CreateDialog() { gimp_ui_init("HalftoneLab", true); GimpDialog dialog = DialogNew("Halftone Laboratory", "HalftoneLab", IntPtr.Zero, 0, Gimp.StandardHelpFunc, "HalftoneLab"); Table table = new Table(2, 1, false); initConfigManager(); ConfigPanel<HalftoneAlgorithm> configPanel = new ConfigPanel<HalftoneAlgorithm>(configManager); HalftoneAlgorithmPanel algorithmPanel = new HalftoneAlgorithmPanel(selectedAlgorithm); configPanel.ModuleChanged += delegate { algorithmPanel.Module = configPanel.CurrentModule; }; algorithmPanel.ModuleChanged += delegate { selectedAlgorithm = algorithmPanel.Module; configPanel.CurrentModule = selectedAlgorithm; }; table.Attach(configPanel, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand, 0, 0); table.Attach(algorithmPanel, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0); dialog.VBox.PackStart(table); dialog.Response += delegate { Console.Out.WriteLine("Algorithm name: {0}", selectedAlgorithm.Name); Console.Out.WriteLine("Description: {0}", selectedAlgorithm.Description); // save the last used algorithm to the config manager selectedAlgorithm.Name = "_LAST"; configManager.saveModule(selectedAlgorithm); }; return dialog; }
void InitConfigTab() { try { //ConfigInfo.jobj_root = JObject.Parse(json); JObject root = JObject.Parse("{ \"File Config\" : " + Properties.Resources.file_config_default + ", \"Sam Config\" : " + Properties.Resources.sam_config_default + ", \"Tail Config\" : " + Properties.Resources.tail_config_default + " }"); ConfigPanel panel_server = ConvertFromJson(root); grid.Children.Add(panel_server); } catch (Exception e) { Log.PrintError(e.Message, "UserControls.ConfigMenu.InitConfigtab"); } if (servergrid.btn_group.Count > 0) { servergrid.btn_group[0].IsChecked = true; } }
private void Configure() { this.licensesMenuItem = this.FindControl <MenuItem>("licensesMenuItem"); licensesMenuItem.Click += (async(s, e) => { var window = new LicenseWindow(); await window.ShowDialog(this); }); this.scanMenuItem = this.FindControl <MenuItem>("scanMenuItem"); scanMenuItem.Click += (s, e) => { LookForDevices(); }; ConnectedDevices = new ObservableCollection <RoxyDevice>(); this.boardGrid = this.FindControl <DataGrid>("boardGrid"); boardGrid.DataContext = this; boardGrid.SelectionChanged += BoardGrid_SelectionChanged; this.tabControl = this.FindControl <TabControl>("tabControl"); this.loadElfButton = this.FindControl <Button>("loadElfButton"); loadElfButton.Click += LoadElfFile; this.getLatestButton = this.FindControl <Button>("getLatestButton"); getLatestButton.Click += GetLatestFirmware; this.elfFilenameText = this.FindControl <TextBlock>("elfFilenameText"); this.flashElfButton = this.FindControl <Button>("flashElfButton"); flashElfButton.Click += FlashElfButton; this.consoleText = this.FindControl <TextBlock>("consoleText"); this.consoleContainer = this.FindControl <Border>("consoleContainer"); this.configTab = this.FindControl <Grid>("configTab"); this.configButtons = this.FindControl <Grid>("configButtons"); this.readConfigButton = this.FindControl <Button>("readConfigButton"); readConfigButton.Click += ReadConfigButton_Click; this.writeConfigButton = this.FindControl <Button>("writeConfigButton"); writeConfigButton.Click += WriteConfigButton_Click; this.configPanel = this.FindControl <ConfigPanel>("configPanel"); configPanel.SubPanelChanged += SubPanelChanged; this.rgbControl = this.FindControl <HueColorSliderControl>("rgbControl"); rgbControl.OnClosed += rgbControl_Closed; this.rgbScrollViewer = this.FindControl <ScrollViewer>("rgbScrollViewer"); this.keyMappingControl = this.FindControl <KeyMappingControl>("keyMappingControl"); keyMappingControl.OnClosed += configControl_Closed; this.keyMappingScrollViewer = this.FindControl <ScrollViewer>("keyMappingScrollViewer"); this.buttonLedControl = this.FindControl <ButtonLedControl>("buttonLedControl"); buttonLedControl.OnClosed += configControl_Closed; this.buttonLedScrollViewer = this.FindControl <ScrollViewer>("buttonLedScrollViewer"); this.deviceControl = this.FindControl <DeviceControl>("deviceControl"); deviceControl.OnClosed += configControl_Closed; this.deviceScrollViewer = this.FindControl <ScrollViewer>("deviceScrollViewer"); this.joystickMappingControl = this.FindControl <JoystickMappingControl>("joystickMappingControl"); joystickMappingControl.OnClosed += configControl_Closed; this.joystickMappingScrollViewer = this.FindControl <ScrollViewer>("joystickMappingScrollViewer"); this.ttControl = this.FindControl <TurntableControl>("ttControl"); ttControl.OnClosed += configControl_Closed; this.ttScrollViewer = this.Find <ScrollViewer>("ttScrollViewer"); this.argbControl = this.FindControl <ArgbControl>("argbControl"); argbControl.OnClosed += configControl_Closed; this.argbScrollViewer = this.Find <ScrollViewer>("argbScrollViewer"); var svre9left = this.FindControl <Button>("svre9Left"); svre9left.Click += ((s, e) => { SendCommand(1, 0); }); var svre9right = this.FindControl <Button>("svre9Right"); svre9right.Click += ((s, e) => { SendCommand(1, 1); }); flashElfEvent += flashElf; RoxyDevice.StatusWrite = delegate(string status) { StatusWrite(status); }; devList = DeviceList.Local; devList.Changed += DevList_Changed; LookForDevices(); }
private void DisplayConfigure() { if (!stylesInitted) { InitStyles(); } GUILayout.BeginVertical(); #if DEBUG GUILayout.BeginHorizontal(); GUILayout.Label("Log:"); LogLevelButton(KSP_Log.Log.LEVEL.OFF, "OFF"); LogLevelButton(KSP_Log.Log.LEVEL.ERROR, "ERROR"); LogLevelButton(KSP_Log.Log.LEVEL.WARNING, "WARNING"); LogLevelButton(KSP_Log.Log.LEVEL.INFO, "INFO"); LogLevelButton(KSP_Log.Log.LEVEL.DETAIL, "DETAIL"); LogLevelButton(KSP_Log.Log.LEVEL.TRACE, "TRACE"); GUILayout.EndHorizontal(); #endif GUILayout.Space(20); GUILayout.BeginHorizontal(); GUI.enabled = showPanel != ConfigPanel.Quicksave; if (GUILayout.Button("Options")) { showPanel = ConfigPanel.Quicksave; windowBounds.height = 0; } GUI.enabled = showPanel != ConfigPanel.QuickSaveIntervals; if (GUILayout.Button("Intervals")) { showPanel = ConfigPanel.QuickSaveIntervals; windowBounds.height = 0; } GUI.enabled = showPanel != ConfigPanel.QuickSaveAging; if (GUILayout.Button("Age Settings")) { showPanel = ConfigPanel.QuickSaveAging; windowBounds.height = 0; } GUI.enabled = showPanel != ConfigPanel.Editor; if (GUILayout.Button("Editor Options")) { showPanel = ConfigPanel.Editor; windowBounds.height = 0; } GUI.enabled = showPanel != ConfigPanel.Sound; if (GUILayout.Button("Sound Options")) { showPanel = ConfigPanel.Sound; windowBounds.height = 0; } GUILayout.EndHorizontal(); GUI.enabled = true; switch (showPanel) { case ConfigPanel.Quicksave: { GUILayout.Space(15); // QuickSave options // quicksave on launch QuickSaveOnLaunchToggle("Quicksave on launch"); QuickSaveOnSceneChange("Quicksave on scene change"); GUILayout.BeginHorizontal(); GUILayout.Label("Minimum time between quicksaves (for scene changes only, in seconds): "); String sMinTimeBetweenQuicksaves = GUILayout.TextField(Configuration.MinTimeBetweenQuicksaves.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.MinTimeBetweenQuicksaves = ParseInt(sMinTimeBetweenQuicksaves); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Templates:"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Template Info")) { showTemplateInfo = !showTemplateInfo; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("(Click the Launch/Quicksave/Scenesave template button to select, or enter your own template)"); GUILayout.EndHorizontal(); GUI.enabled = (TemplateSelectionGui.templateGui == null); var buttonRect = GUILayoutUtility.GetRect(new GUIContent("Launch Template"), GUI.skin.button, GUILayout.Width(TEMPLATE_WIN_BUTTON_WIDTH)); if (GUILayout.Button("Launch Template", GUILayout.Width(TEMPLATE_WIN_BUTTON_WIDTH))) { TemplateSelectionGui.StartWindow("Launch", Configuration.LaunchNameTemplate, windowBounds, buttonRect); TemplateSelectionGui.templateGui = gameObject.AddComponent <TemplateSelectionGui>(); } GUI.enabled = true; //GUILayout.Label("Launch template: ", STYLE_CONFIG_BACKUP_PATH_LABEL); Configuration.LaunchNameTemplate = GUILayout.TextField(Configuration.LaunchNameTemplate); GUILayout.BeginHorizontal(); string newName = StringTranslation.AddFormatInfo(Configuration.LaunchNameTemplate, "", ""); GUILayout.Label(" ==> "); GUILayout.TextField(Quicksave.LAUNCH_QS_PREFIX + newName); GUILayout.EndHorizontal(); GUI.enabled = (TemplateSelectionGui.templateGui == null); buttonRect = GUILayoutUtility.GetRect(new GUIContent("Quicksave Template"), GUI.skin.button, GUILayout.Width(TEMPLATE_WIN_BUTTON_WIDTH)); if (GUILayout.Button("Quicksave Template", GUILayout.Width(TEMPLATE_WIN_BUTTON_WIDTH))) { TemplateSelectionGui.StartWindow("Quicksave", Configuration.QuickSaveNameTemplate, windowBounds, buttonRect); TemplateSelectionGui.templateGui = gameObject.AddComponent <TemplateSelectionGui>(); } GUI.enabled = true; //GUILayout.Label("Quicksave template: ", STYLE_CONFIG_BACKUP_PATH_LABEL); Configuration.QuickSaveNameTemplate = GUILayout.TextField(Configuration.QuickSaveNameTemplate); GUILayout.BeginHorizontal(); newName = StringTranslation.AddFormatInfo(Configuration.QuickSaveNameTemplate, "", ""); GUILayout.Label(" ==> "); GUILayout.TextField(Quicksave.AUTO_QS_PREFIX + newName); GUILayout.EndHorizontal(); GUI.enabled = (TemplateSelectionGui.templateGui == null); buttonRect = GUILayoutUtility.GetRect(new GUIContent("Scenesave Template"), GUI.skin.button, GUILayout.Width(TEMPLATE_WIN_BUTTON_WIDTH)); if (GUILayout.Button("Scenesave Template", GUILayout.Width(TEMPLATE_WIN_BUTTON_WIDTH))) { TemplateSelectionGui.StartWindow("Scenesave", Configuration.SceneSaveNameTemplate, windowBounds, buttonRect); TemplateSelectionGui.templateGui = gameObject.AddComponent <TemplateSelectionGui>(); } GUI.enabled = true; //GUILayout.Label("Scenesave template: ", STYLE_CONFIG_BACKUP_PATH_LABEL); Configuration.SceneSaveNameTemplate = GUILayout.TextField(Configuration.SceneSaveNameTemplate); GUILayout.BeginHorizontal(); newName = StringTranslation.AddFormatInfo(Configuration.SceneSaveNameTemplate, "", ""); GUILayout.Label(" ==> "); GUILayout.TextField(Quicksave.SCENE_QS_PREFIX + newName); GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.EndVertical(); } break; case ConfigPanel.QuickSaveIntervals: { GUILayout.Label("Quicksave interval: "); QuicksaveIntervalToggle(Configuration.QuickSave_Interval.ONCE_IN_10_MINUTES, "Once in 10 minutes"); QuicksaveIntervalToggle(Configuration.QuickSave_Interval.ONCE_IN_30_MINUTES, "Once in 30 minutes"); QuicksaveIntervalToggle(Configuration.QuickSave_Interval.ONCE_PER_HOUR, "Once per hour"); QuicksaveIntervalToggle(Configuration.QuickSave_Interval.ONCE_IN_2_HOURS, "Once in 2 hours"); QuicksaveIntervalToggle(Configuration.QuickSave_Interval.ONCE_IN_4_HOURS, "Once in 4 hours"); GUILayout.BeginHorizontal(); QuicksaveIntervalToggle(Configuration.QuickSave_Interval.CUSTOM, "Custom (minutes)"); GUILayout.FlexibleSpace(); GUI.enabled = (Configuration.QuicksaveInterval == Configuration.QuickSave_Interval.CUSTOM); String sCustomInterval = GUILayout.TextField(Configuration.CustomQuicksaveInterval.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.CustomQuicksaveInterval = ParseInt(sCustomInterval); GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(20); } break; case ConfigPanel.QuickSaveAging: { GUILayout.Space(15); GUILayout.BeginHorizontal(); GUILayout.Label("Days to keep quicksaves: "); String sDaysToKeepQuicksaves = GUILayout.TextField(Configuration.DaysToKeepQuicksaves.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.DaysToKeepQuicksaves = ParseInt(sDaysToKeepQuicksaves); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Min number of quicksaves: "); String sMinNumberOfQuicksaves = GUILayout.TextField(Configuration.MinNumberOfQuicksaves.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.MinNumberOfQuicksaves = ParseInt(sMinNumberOfQuicksaves); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Max number of quicksaves: "); String sMaxNumberOfQuicksaves = GUILayout.TextField(Configuration.MaxNumberOfQuicksaves.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.MaxNumberOfQuicksaves = ParseInt(sMaxNumberOfQuicksaves); GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Label("Max number of launch saves: "); String sMaxNumberOfLaunchsaves = GUILayout.TextField(Configuration.MaxNumberOfLaunchsaves.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.MaxNumberOfLaunchsaves = ParseInt(sMaxNumberOfLaunchsaves); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Max number of scene change saves: "); String sMaxNumberOfScenesaves = GUILayout.TextField(Configuration.MaxNumberOfScenesaves.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.MaxNumberOfScenesaves = ParseInt(sMaxNumberOfScenesaves); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(20); } break; case ConfigPanel.Editor: { GUILayout.Space(15); Configuration.saveVesselInEditor = GUILayout.Toggle(Configuration.saveVesselInEditor, "Auto-save vessels in the editor"); GUI.enabled = Configuration.saveVesselInEditor; GUILayout.BeginHorizontal(); GUILayout.Label("Time interval between autosaves (in seconds): "); String sEditorTimeToSave = GUILayout.TextField(Configuration.editorTimeIntervalToSave.ToString(), STYLE_CONFIG_TEXTFIELD); GUILayout.Space(CONFIG_TEXTFIELD_RIGHT_MARGIN); Configuration.editorTimeIntervalToSave = ParseInt(sEditorTimeToSave); GUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.EndVertical(); GUILayout.Space(20); } break; case ConfigPanel.Sound: GUILayout.Space(15); Configuration.SoundOnSave = GUILayout.Toggle(Configuration.SoundOnSave, "Enable sound on quicksave"); if (Configuration.SoundOnSave) { GUILayout.Space(15); if (files == null) { files = Directory.GetFiles(KSPUtil.ApplicationRootPath + "GameData/" + Configuration.AUDIO_DIR, "*"); } audioListscrollPosition = GUILayout.BeginScrollView(audioListscrollPosition, GUI.skin.box, GUILayout.Height(160)); int cnt = 0; foreach (var name in files) { var shortName = Path.GetFileNameWithoutExtension(name); if (selectedAudio == -1 && Configuration.AUDIO_DIR + shortName == Configuration.SoundLocation) { selectedAudio = cnt; } GUILayout.BeginHorizontal(); btnStyle.normal.textColor = (cnt == selectedAudio) ? Color.green : GUI.skin.button.normal.textColor; if (GUILayout.Button(shortName, btnStyle, GUILayout.Width(400))) { selectedAudio = cnt; Configuration.SoundLocation = Configuration.AUDIO_DIR + shortName; } if (GUILayout.Button("►", btnStyle, GUILayout.Width(25))) { Audio.InitializeAudio(); Audio.markerAudio.PlayOneShot(GameDatabase.Instance.GetAudioClip(Configuration.AUDIO_DIR + shortName)); } cnt++; GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } GUILayout.EndVertical(); break; } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("(Click <B>Save Config</b> button to save) ==>"); if (GUILayout.Button("Save Config", GUI.skin.button)) { Configuration.Save(); Toggle(); Quicksave.instance.RestartLoop(); } GUILayout.EndHorizontal(); GUI.DragWindow(); }
public ConfigPanel ConvertFromJson(JObject jobj_root) { if (jobj_root == null) { return(null); } servergrid = new ConfigPanel(); try { foreach (var v in jobj_root.Properties()) { JObject jobj_config_root = v.Value as JObject; if (jobj_config_root == null) { continue; } ConfigMenuButton smbtn = new ConfigMenuButton(servergrid, jobj_config_root, v.Name); servergrid.Children.Add(smbtn); servergrid.SubPanel.Children.Add(smbtn.child); JObject jobj_work_group_root = jobj_config_root.GetValue("work_group") as JObject; if (jobj_work_group_root == null) { continue; } foreach (var work in jobj_work_group_root.Properties()) { JObject jobj_server_menu = work.Value as JObject; if (jobj_server_menu == null) { continue; } ConfigInfoPanel ui_config_group = new ConfigInfoPanel(smbtn, jobj_config_root, work.Name); ui_config_group.IsExpanded = true; smbtn.child.Items.Add(ui_config_group); JArray jarr_processes = jobj_server_menu.GetValue("processes") as JArray; if (jarr_processes == null) { continue; } int i = 0; foreach (var jprop_server_info in jarr_processes) { JObject jobj_process_info = jprop_server_info as JObject; if (jobj_process_info == null) { continue; } string dir = null; string daemon_yn = null; if (jobj_config_root.GetValue("type").ToString() == "file") { dir = (jobj_process_info.GetValue("enc_option") as JObject)?.GetValue("input_dir")?.ToString(); } else { dir = (jobj_process_info.GetValue("comm_option") as JObject)?.GetValue("input_dir")?.ToString(); } ui_config_group.Items.Add(new ConfigInfoPanel(smbtn, jobj_config_root, work.Name, i.ToString(), dir)); string daemon_keyword = "dir_monitoring_yn"; if (jobj_config_root.GetValue("type").ToString() == "tail") { daemon_keyword = "daemon_yn"; } JToken jcur = jobj_process_info; while (jcur != null && daemon_yn == null) { daemon_yn = (jcur["comm_option"] as JObject)?.GetValue(daemon_keyword)?.ToString(); jcur = jcur.Parent; while (jcur != null && jcur as JObject == null) { jcur = jcur.Parent; } } if (daemon_yn == "True") { LinuxTreeViewItem.ChangeColor(root, dir, jobj_config_root["type"] + "-" + work.Name + "-" + i); } i++; } } } return(servergrid); } catch (Exception e) { Log.PrintError(e.Message, "UserControls.ServerInfo.ConvertFromJson"); } return(null); }