示例#1
0
 private void procFeature(XmlNode node)
 {
     try
     {
         var nameAtt = node.Attributes["class"];
         var type    = getType(nameAtt.Value);
         if (type != null)
         {
             var feature = ((FeatureGroupBase)_group.Peek()).AddChildFeature(type);
             try
             {
                 var swAtt = node.Attributes["name"];
                 if (swAtt.Value != null && swAtt.Value.Length > 0)
                 {
                     feature.Name = swAtt.Value;
                 }
             }
             catch (Exception)
             {
             }
             try
             {
                 var swAtt = node.Attributes["enabled"];
                 if (Const.IsFalse(swAtt.Value))
                 {
                     feature.Enabled = false;
                 }
             }
             catch (Exception)
             {
             }
             // フィーチャーに引数を割り当てる
             try
             {
                 if (string.IsNullOrEmpty(node.InnerText) == false)
                 {
                     _fiParamString.SetValue(feature, node.InnerText);
                     feature.ParseParameter(node.InnerText);
                 }
             }
             catch (Exception)
             {
             }
             // メニュー情報
             procMenuItem(node, feature);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Feature Loader Error : '" + nameAtt.Value + "'は実装されていないフィーチャーです");
         }
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("Feature Loader Error 例外 : '" + e.Message + "'");
     }
 }
示例#2
0
        /// <summary>
        /// 文字列からパラメータを解析・実行する
        /// </summary>
        /// <param name="param"></param>
        public override void ParseParameter(string param)
        {
            var ss = param.Split(new char[] { ',' });

            foreach (var s in ss)
            {
                var s2 = s.Trim();

                // インターロックグループ
                var id = s2.IndexOf("(");
                if (id >= 0)
                {
                    var gr = s2.Substring(id + 1);
                    _interlockGroup = gr.Substring(0, gr.Length - 2);
                    var fcs = (IList)_interlockGroups[_interlockGroup];
                    if (fcs == null)
                    {
                        _interlockGroups[_interlockGroup] = fcs = new ArrayList();
                    }
                    fcs.Add(this);

                    s2 = s2.Substring(0, id) + "]";
                }
                // チェックボタンのイベント登録
                if (s2.StartsWith("["))
                {
                    var s3  = s2.Substring(1, s2.Length - 2);
                    var sss = s3.Split(new char[] { '=' });
                    s2 = sss[0];
                    if (sss.Length >= 2)
                    {
                        if (Const.IsFalse(sss[1]))
                        {
                            _isOn = false;
                        }
                    }
                    _initialState = _isOn;
                    _checkBox     = (System.Windows.Forms.CheckBox)GetControl(s2);
                    if (_checkBox != null)
                    {
                        AddTrigger(_checkBox, "Click", new EventHandler(onClickCheck));
                        ThreadSafe.SetChecked(_checkBox, _isOn);
                        ThreadSafe.SetEnabled(_checkBox, _canStart);
                    }
                }
            }
            _isNoToken = true;
            Finalizers.Add(new FinalizeManager.Finalize(resetSwitch));
        }