Esempio n. 1
0
        //public void Advices()
        //{
        //    advices = new List<Advice>();
        //}
        public static void AddAdvice(string AdviceKind, string pointcutName, string adviceCode)
        {
            Advice advice = new Advice();
            advice.adviceName = AdviceKind + " (): " + pointcutName + "()";
            advice.adviceCode = adviceCode;
            advice.advicePointcutKind = AdviceKind;
            advice.advicePointcutName = pointcutName;
            string AdviceString = advice.adviceName + "{\n" + advice.adviceCode + "\n}\n";
            advice.adviceString = AdviceString;

            advices.Add(advice);

        }
        private void editButton1_Click(object sender, RoutedEventArgs e)
        {
            int index = adviceComboBox.SelectedIndex;
            if (index == -1) return;
            addAdvice aa = new addAdvice();
            aa.Owner = this;
            aa.index = index;

            Advice ad = new Advice();
            ad = Advices.getAdvices(index);
            int i;
            for (i = 0; i < Pointcuts.pointcuts.Count; i++)
            {
                if (Pointcuts.pointcuts[i].pointcutName == ad.advicePointcutName)
                {
                    break;
                }
            }
            if (i < Pointcuts.pointcuts.Count) aa.pointCutComboBox.SelectedIndex = i;
            if (ad.advicePointcutKind == "before") 
                aa.kindComboBox.SelectedIndex = 0;
            else
                aa.kindComboBox.SelectedIndex = 1;

            aa.textBox.Text = ad.adviceCode;

            aa.ShowDialog();
            updataAdvice();

        }