private void OnClickOkButton(object sender, RoutedEventArgs e) { int retval = 0; try { if ((retval = ConfigOptionManager.SaveOption()) != 0) { Console.WriteLine("JHLIM_DEBUG : Window_Config " + retval); } } catch (Exception ex) { Console.WriteLine("JHLIM_DEBUG : Window_Config " + ex.Message); } if (IsModal) { if (retval == 0) { this.DialogResult = true; } else { this.DialogResult = false; } } this.Close(); }
void DelConfigWorkGroup(object parameter) { if (this.ConfigIdx?.JobjRoot == null) { return; } WindowMain.current.ShowMessageDialog("Delete Config Work Group", "해당 Config Group 을 정말 삭제하시겠습니까? 하위 Config 정보도 모두 삭제됩니다.", MahApps.Metro.Controls.Dialogs.MessageDialogStyle.AffirmativeAndNegative, () => { try { JObject cloneRoot = this.ConfigIdx?.JobjRoot?.DeepClone() as JObject; cloneRoot["work_group"]?[WorkName]?.Parent?.Remove(); if (ConfigOptionManager.SaveOption(cloneRoot) != 0) { return; } this.ConfigIdx?.JobjRoot["work_group"]?[WorkName]?.Parent?.Remove(); (this.Parent as ItemsControl)?.Items.Remove(this); } catch (Exception ex) { Log.ErrorIntoUI(ex.Message, "Del Config Menu", Status.current.richTextBox_status); Log.PrintError(ex.Message, "UserControls.ConfigMenuButton.DeleteConfigMenuUI"); } }); }
private void NewJsonFile_Tail() { ConfigOptionManager.Clear(); JToken jtok = JsonController.ParseJsonUI(Properties.Resources.tail_config_default); Refresh(jtok); UserControls.ConfigOptions.ConfigOptionManager.bChanged = true; }
public dec_option(JObject root) { InitializeComponent(); if (root == null) { Log.PrintLog("NotFound File.dec_option", "UserControls.ConfigOptions.File.dec_option.dec_option"); return; } Root = root; DataContext = root; ConfigOptionManager.MakeUI(grid, root, groups, GetUIOptionKey, GetUIOptionValue); }
public Window_Config(UserControl ui, bool _IsModal = false, string path = null) { InitializeComponent(); IsModal = _IsModal; ConfigOptionManager.Clear(); ConfigOptionManager.Path = path; if (ui != null) { grid.Children.Add(ui); } }
public enc_inform_line(JObject root) { InitializeComponent(); if (root == null) { Log.PrintLog("NotFound Tail.enc_inform", "UserControls.ConfigOptions.Tail.enc_inform_line.enc_inform_line"); return; } Root = root; DataContext = root; ConfigOptionManager.MakeUI(grid, root, groups, GetUIOptionKey, GetUIOptionValue); }
void AddConfigWorkGroup(object parameter) { if (WindowMain.current?.EnableConnect?.SshManager?.IsConnected != true) { return; } Window_AddConfigWorkGroup wms = new Window_AddConfigWorkGroup(); Point pt = this.PointToScreen(new Point(0, 0)); wms.Left = pt.X; wms.Top = pt.Y; if (wms.ShowDialog() == true) { try { string work_group_name = wms.textBox_name.Text; JObject cloneRoot = this.Root?.DeepClone() as JObject; JProperty jprop_new = new JProperty(work_group_name, new JObject(new JProperty("processes", new JArray()))); if (cloneRoot?["work_group"] as JObject == null) { return; } (cloneRoot?["work_group"] as JObject).Add(jprop_new); if (ConfigOptionManager.SaveOption(cloneRoot) != 0) { return; } (this.Root?["work_group"] as JObject)?.Add(jprop_new); ConfigMenuTreeViewItem ui_config_group = new ConfigMenuTreeViewItem() { ConfigIdx = new ConfigMenuModel(this.Root) { WorkName = work_group_name } }; ui_config_group.IsExpanded = true; this.DetailView?.Items.Add(ui_config_group); } catch (Exception ex) { Log.ErrorIntoUI("config 그룹명이 중복됩니다.\r", "Add Config Group Name", Status.current.richTextBox_status); Log.PrintError(ex.Message, "UserControls.ConfigOptions.ConfigPanel.ConfigInfoPanel"); Console.WriteLine("JHLIM_DEBUG : " + ex.Message); WindowMain.current?.ShowMessageDialog("Add Config Fail", "그룹명이 중복됩니다.\n" + ex.Message, MahApps.Metro.Controls.Dialogs.MessageDialogStyle.Affirmative); } } }
private void Refresh(JToken root) { if (root == null) { return; } grid.Children.Clear(); UserControl ui = ConfigOptionManager.CreateOption(root); if (ui != null) { grid.Children.Add(ui); } }
private void Refresh(JToken root) { if (root == null) { return; } grid.Children.Clear(); //UserControl retval = null; //if(root["type"].ToString() == "file") // retval = new ConfigOptions.File.FileOptions() { DataContext = root }; //else if(root["type"].ToString() == "sam") // retval = new ConfigOptions.Sam.SamOptions() { DataContext = root }; //else if(root["type"].ToString() == "tail") // retval = new ConfigOptions.Tail.TailOptions() { DataContext = root }; //grid.Children.Add(retval); UserControl ui = ConfigOptionManager.CreateOption(root); if (ui != null) { grid.Children.Add(ui); } }
static FrameworkElement GetUIOptionKey(int opt, JObject root) { Option option = (Option)opt; FrameworkElement ret = null; try { string detail = detailOptions[(int)opt]; switch (option) { // Basical case Option.input_dir: case Option.output_dir: { TextBlock tb = new TextBlock() { Text = detail }; ret = tb; } break; // Optional case Option.output_extension: case Option.output_suffix_head: case Option.output_suffix_tail: case Option.blacklist_filter: { StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal }; CheckBox cb = new CheckBox(); JProperty jprop = GetJProperty(option, root); cb.IsChecked = !(jprop.Name[0] == ConfigOptionManager.StartDisableProperty); sp.Children.Add(cb); TextBlock tb = new TextBlock() { Text = detail }; sp.Children.Add(tb); // delegate 에 지역변수를 사용하면 지역변수를 메모리에서 계속 잡고있는다. (전역변수 화 (어디 소속으로 전역변수 인지 모르겠다.)) cb.Checked += delegate { ConfigOptionManager.CheckedKey(ref jprop); }; cb.Unchecked += delegate { ConfigOptionManager.UncheckedKey(ref jprop); }; ret = sp; } break; case Option.input_extension: case Option.input_filter: { StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal }; RadioButton cb = new RadioButton(); JProperty jprop = GetJProperty(option, root); cb.IsChecked = !(jprop.Name[0] == ConfigOptionManager.StartDisableProperty); sp.Children.Add(cb); TextBlock tb = new TextBlock() { Text = detail }; sp.Children.Add(tb); // delegate 에 지역변수를 사용하면 지역변수를 메모리에서 계속 잡고있는다. (전역변수 화 (어디 소속으로 전역변수 인지 모르겠다.)) cb.Checked += delegate { ConfigOptionManager.CheckedKey(ref jprop); }; cb.Unchecked += delegate { ConfigOptionManager.UncheckedKey(ref jprop); }; ret = sp; } break; default: break; } } catch (Exception e) { Log.PrintError(e.Message + " (" + option.ToString() + ")", "UserControls.ConfigOption.File.dec_option.GetUIOptionKey"); } if (ret != null) { ret.Margin = new Thickness(10, 3, 10, 3); ret.VerticalAlignment = VerticalAlignment.Center; ret.HorizontalAlignment = HorizontalAlignment.Left; } return(ret); }
static FrameworkElement GetUIOptionKey(int opt, JObject root) { Option option = (Option)opt; FrameworkElement ret = null; try { string detail = detailOptions[(int)opt]; switch (option) { // Basical case Option.sid: case Option.item: case Option.encode_type: case Option.log_console_yn: case Option.header_file_save_yn: case Option.file_reserver_yn: case Option.dir_monitoring_yn: case Option.verify_yn: case Option.result_log_yn: case Option.dir_recursive_yn: case Option.dir_recursive_max_depth: { TextBlock tb = new TextBlock() { Text = detail }; ret = tb; } break; // Optional //case Option.thread_count: case Option.delay_time: { StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal }; CheckBox cb = new CheckBox(); JProperty jprop = GetJProperty(option, root); cb.IsChecked = !(jprop.Name[0] == ConfigOptionManager.StartDisableProperty); sp.Children.Add(cb); TextBlock tb = new TextBlock() { Text = detail }; sp.Children.Add(tb); // delegate 에 지역변수를 사용하면 지역변수를 메모리에서 계속 잡고있는다. (전역변수 화 (어디 소속으로 전역변수 인지 모르겠다.)) cb.Checked += delegate { ConfigOptionManager.CheckedKey(ref jprop); }; cb.Unchecked += delegate { ConfigOptionManager.UncheckedKey(ref jprop); }; ret = sp; } break; case Option.schedule_time: case Option.dir_monitoring_term: { StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal }; RadioButton rb = new RadioButton(); JProperty jprop = GetJProperty(option, root); rb.IsChecked = !(jprop.Name[0] == ConfigOptionManager.StartDisableProperty); sp.Children.Add(rb); TextBlock tb = new TextBlock() { Text = detail }; sp.Children.Add(tb); // delegate 에 지역변수를 사용하면 지역변수를 메모리에서 계속 잡고있는다. (전역변수 화 (어디 소속으로 전역변수 인지 모르겠다.)) rb.Checked += delegate { ConfigOptionManager.CheckedKey(ref jprop); }; rb.Unchecked += delegate { ConfigOptionManager.UncheckedKey(ref jprop); }; ret = sp; } break; default: break; } } catch (Exception e) { Log.PrintError(e.Message + " (" + option.ToString() + ")", "UserControls.ConfigOption.File.comm_option.GetUIOptionKey"); } if (ret != null) { ret.Margin = new Thickness(10, 3, 10, 3); ret.VerticalAlignment = VerticalAlignment.Center; ret.HorizontalAlignment = HorizontalAlignment.Left; } return(ret); }
public Window_Config(JObject jobj_config_root, string work_name = null, string index = null, bool _IsModal = false, string path = null) : this(ConfigOptionManager.CreateOption(jobj_config_root, work_name, index), _IsModal, path) { }
static FrameworkElement GetUIOptionKey(int opt, JObject root) { Options option = (Options)opt; FrameworkElement ret = null; try { string detail = detailOptions[(int)opt]; switch (option) { // Basical case Options.sam_type: case Options.no_col: case Options.sid: case Options.delimiter: case Options.trim: case Options.skip_header: case Options.record_len: case Options.input_dir: case Options.output_dir: case Options.output_ext: case Options.dir_monitoring_yn: case Options.dir_monitoring_term: case Options.file_reserver_yn: { TextBlock tb = new TextBlock() { Text = detail }; ret = tb; } break; // Optional case Options.no_access_sentence: case Options.log_file: { StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal }; CheckBox cb = new CheckBox(); JProperty jprop = GetJProperty(option, root); cb.IsChecked = !(jprop.Name[0] == ConfigOptionManager.StartDisableProperty); sp.Children.Add(cb); TextBlock tb = new TextBlock() { Text = detail }; sp.Children.Add(tb); // delegate 에 지역변수를 사용하면 지역변수를 메모리에서 계속 잡고있는다. (전역변수 화 (어디 소속으로 전역변수 인지 모르겠다.)) cb.Checked += delegate { ConfigOptionManager.CheckedKey(ref jprop); }; cb.Unchecked += delegate { ConfigOptionManager.UncheckedKey(ref jprop); }; ret = sp; } break; case Options.input_filter: case Options.input_ext: { StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal }; RadioButton cb = new RadioButton(); JProperty jprop = GetJProperty(option, root); cb.IsChecked = !(jprop.Name[0] == ConfigOptionManager.StartDisableProperty); sp.Children.Add(cb); TextBlock tb = new TextBlock() { Text = detail }; sp.Children.Add(tb); // delegate 에 지역변수를 사용하면 지역변수를 메모리에서 계속 잡고있는다. (전역변수 화 (어디 소속으로 전역변수 인지 모르겠다.)) cb.Checked += delegate { ConfigOptionManager.CheckedKey(ref jprop); }; cb.Unchecked += delegate { ConfigOptionManager.UncheckedKey(ref jprop); }; ret = sp; } break; default: break; } } catch (Exception e) { Log.PrintError(e.Message + " (" + option.ToString() + ")", "UserControls.ConfigOption.Sam.comm_option.GetUIOptionKey"); } if (ret != null) { ret.Margin = new Thickness(10, 3, 10, 3); ret.VerticalAlignment = VerticalAlignment.Center; ret.HorizontalAlignment = HorizontalAlignment.Left; } return(ret); }