예제 #1
0
        public virtual void InitContextMenu()
        {
            ConditionMenuList.Clear();
            MainViewModel.Resource.ConditionPrototypeList.ForEach(v =>
            {
                var command = new CommonCommand((obj) =>
                {
                    var o = v.CreateInstance() as ICondition;
                    o.GetInstrumentList = () => {
                        var l = new List <IInstrument>();
                        foreach (var inst in InstrumentList)
                        {
                            l.Add(inst);
                        }
                        return(l);
                    };

                    o.AnalyseDataSource = CurrentDataSource;
                    var vm = new ConditionViewModel()
                    {
                        TargetObject = o
                    };
                    ConditionList.Add(vm);
                    GetTargetProject().ConditionList.Add(o);
                });
                command.Name            = "New " + v.Name;
                command.Memo            = v.Memo;
                command.ForegroundBrush = new SolidColorBrush(Colors.Blue);
                ConditionMenuList.Add(command);
            });
            var dcommand = new CommonCommand((obj) =>
            {
                if (CurrentCondition != null && ConditionList.Contains(CurrentCondition))
                {
                    ConditionList.Remove(CurrentCondition);
                }
            });

            dcommand.Name            = "Delete Condition";
            dcommand.Memo            = "Delete Current Condition";
            dcommand.ForegroundBrush = new SolidColorBrush(Colors.Orange);
            ConditionMenuList.Add(dcommand);
        }
예제 #2
0
 public bool Contains(Condition item)
 {
     return(ConditionList.Contains(item));
 }