Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }