Esempio n. 1
0
        public Formula(string name, Topic top, Subject sub)
        {
            this.name = name;
            this.topic = top;

            this.subject = sub;
        }
Esempio n. 2
0
        //For calling this for a list of subjects
        public ListEdit(BindingList<Subject> sb, listType t)
        {
            type = t;
            subjects = sb;

            selectedSubject = null;
            selectedTopic = null;

            InitializeComponent();
        }
Esempio n. 3
0
        //For calling this for a list of formulas (as they need both selected subject and topic)
        public ListEdit(BindingList<Subject> sb, Subject selSub, Topic selTop, listType t)
        {
            type = t;
            subjects = sb;

            selectedSubject = selSub;
            selectedTopic = selTop;

            InitializeComponent();
        }
Esempio n. 4
0
        //Add or remove formulas in a new dialogue box
        private void formulaOptions_Click(object sender, EventArgs e)
        {
            currentSubject = (Subject)listSubject.SelectedValue;
            currentTopic = (Topic)listTopic.SelectedValue;

            if (currentSubject != null && currentTopic != null)
            {
                ListEdit ld = new ListEdit(subjects, currentSubject, currentTopic, ListEdit.listType.Formula);
                ld.ShowDialog();

                if(ld.DialogResult == DialogResult.OK)
                {
                    listFormula.DataSource = null;
                    listFormula.DataSource = currentTopic.formulas;
                }
            }
            else
            {
                statusSay.Text = "Invalid Subject or Topic";
            }
        }
Esempio n. 5
0
        //When a new item on the subject list is selected, update all other lists and show the first formula of the first topic
        private void listSubject_SelectedIndexChanged(object sender, EventArgs e)
        {
            currentSubject = (Subject)listSubject.SelectedValue;

            if (currentSubject != null)
            {
                listTopic.DisplayMember = "name";
                listTopic.DataSource = currentSubject.topics;

                statusSay.Text = "Selected " + currentSubject.ToString();
            }
            else if (currentSubject == null)
            {
                listTopic.DataSource = null;
                statusSay.Text = "No subject to be selected";

            }

            listFormula.DataSource = null;
        }
Esempio n. 6
0
        //Add or remove topics in a new dialogue box
        private void topicOptions_Click(object sender, EventArgs e)
        {
            currentSubject = (Subject)listSubject.SelectedValue;

            if (currentSubject != null)
            {
                ListEdit ld = new ListEdit(subjects, currentSubject, ListEdit.listType.Topic);
                ld.ShowDialog();

                if(ld.DialogResult == DialogResult.OK)
                {
                    listTopic.DataSource = null;
                    listTopic.DataSource = currentSubject.topics;

                    if(currentTopic == null && currentSubject.topics.Count > 0)
                    {
                        currentTopic = currentSubject.topics[0];
                    }
                }

            }
            else
            {
                statusSay.Text = "Invalid Subject.";
            }
        }
Esempio n. 7
0
 public Topic(string name, Subject parent)
 {
     this.name = name;
     this.subject = parent;
     formulas = new BindingList<Formula>();
 }