示例#1
0
        public ClassWindow()
        {
            var accessMod = new BasicDataCollection();

            InitializeComponent();

            if (main._Class_List.SelectedIndex != -1)
            {
                MainClassObject = main.Classes[main._Class_List.SelectedIndex];
                _Name.Text      = MainClassObject.Name;
                _InheritanceCheckBox.IsChecked = true;
                _InheritanceTextBox.Text       = MainClassObject.Inheritance;
                _AccessModifier.ItemsSource    = accessMod.Modifiers;
                _AccessModifier.SelectedItem   = MainClassObject.AccessModifier;
                foreach (string keyword in MainClassObject.Keywords)
                {
                    foreach (CheckBox chk in _KeyWords.Children)
                    {
                        if (keyword == chk.Content.ToString())
                        {
                            chk.IsChecked = true;
                        }
                    }
                }
                foreach (RadioButton type in _ClassOrInterface.Children)
                {
                    if (MainClassObject.Type == "class" && type.Content.ToString() == "class")
                    {
                        type.IsChecked = true;
                    }
                    else if (MainClassObject.Type == "interface" && type.Content.ToString() == "interface")
                    {
                        type.IsChecked = true;
                    }
                }

                if (MainClassObject.Interfaces.Count != 0)
                {
                    _InterfaceCheckBox.IsChecked = true;
                }
            }
            else
            {
                MainClassObject               = new ClassObject();
                _AccessModifier.ItemsSource   = accessMod.Modifiers;
                _AccessModifier.SelectedIndex = 0;
            }

            Class_Pole_List.ItemsSource = MainClassObject.Properties;
            _Method_List.ItemsSource    = MainClassObject.Methods;

            _ImplementedInterfaces.ItemsSource = MainClassObject.Interfaces;
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();
            Classes = new List <ClassObject>();
            _Class_List.ItemsSource = Classes;

            List <string> kw = new List <string>();

            kw.Add("const");
            //kw.Add("key2");
            //kw.Add("key3");

            ArgumentObject ao = new ArgumentObject
            {
                Name     = "Name",
                Type     = "type",
                Keywords = kw
            };

            PropertyObject po = new PropertyObject
            {
                Name           = "Name",
                Type           = "int",
                AccessModifier = "public",
                Keywords       = kw
            };

            List <ArgumentObject> aol = new List <ArgumentObject>();

            aol.Add(ao);
            aol.Add(ao);
            aol.Add(ao);
            aol.Add(ao);

            MethodObject mo = new MethodObject
            {
                Name           = "Method",
                AccessModifier = "public",
                ReturnType     = "string",
                Arguments      = aol,
                Keywords       = kw
            };

            //MessageBox.Show("normal\n" + "\ttabbed\n" + mo.ToFinalString());

            List <MethodObject> mol = new List <MethodObject>();

            mol.Add(mo);
            mol.Add(mo);
            mol.Add(mo);
            mol.Add(mo);

            List <string> i = new List <string>();

            i.Add("interface1");
            i.Add("interface2");
            i.Add("interface3");

            List <PropertyObject> pol = new List <PropertyObject>();

            pol.Add(po);
            pol.Add(po);
            pol.Add(po);

            ClassObject co = new ClassObject
            {
                Name           = "KLASA",
                Type           = "class",
                Keywords       = kw,
                AccessModifier = "public",
                Inheritance    = "INNAKLASA",
                Interfaces     = i,
                Methods        = mol,
                Properties     = pol
            };

            //MessageBox.Show(co.ToFinalString());

            Preview_TextBox.Text = co.ToFinalString();

            Classes.Add(co);

            _Class_List.ItemsSource = Classes;

            //this.Close();
        }