private void dgwTopics_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow value = dgwTopics.Rows[e.RowIndex];
                switch (formType)
                {
                case (TopicChooseFormType.ChooseTopicOnExit):
                {
                    if (value != null)
                    {
                        TopicChosen = topicsDone[e.RowIndex];
                        this.Close();
                    }
                    break;
                }

                case (TopicChooseFormType.OpenTopicOnExit):
                {
                    List <Topic> oneItemList = new List <Topic>();
                    oneItemList.Add(topicsDone[e.RowIndex]);
                    frmTopics t = new frmTopics(frmTopics.TopicsFormType.HighlightTopics,
                                                oneItemList, currentClass, currentSubject);
                    t.ShowDialog();
                    t.Dispose();
                    break;
                }
                }
            }
        }
        private void btnChoose_Click(object sender, EventArgs e)
        {
            if (dgwTopics.SelectedRows.Count == 0)
            {
                MessageBox.Show("Scegliere un argomento nella griglia");
                return;
            }
            int rowIndex = dgwTopics.SelectedRows[0].Index;
            //DataRow row = ((DataTable)(dgwTopics.DataSource)).Rows[rowIndex];
            DataGridViewRow value = dgwTopics.Rows[rowIndex];

            switch (formType)
            {
            case (TopicChooseFormType.ChooseTopicOnExit):
            {
                if (value != null)
                {
                    TopicChosen = topicsDone[rowIndex];
                    this.Close();
                }
                break;
            }

            case (TopicChooseFormType.OpenTopicOnExit):
            {
                List <Topic> oneItemList = new List <Topic>();
                oneItemList.Add(topicsDone[rowIndex]);
                frmTopics t = new frmTopics(frmTopics.TopicsFormType.HighlightTopics,
                                            oneItemList, currentClass, currentSubject);
                t.ShowDialog();
                t.Dispose();
                break;
            }
            }
        }
Esempio n. 3
0
        private void btnTopicsManagement_Click(object sender, EventArgs e)
        {
            frmTopics f = new frmTopics(frmTopics.TopicsFormType.NormalManagement,
                                        null, null, null);

            f.ShowDialog();
            f.Dispose();
        }
        private void btnImportTopics_Click(object sender, EventArgs e)
        {
            // !!!! TODO fix using Regex.Split(string, ...) !!!!
            MessageBox.Show("To fix!");
            return;

            List <Topic> ListTopics = new List <Topic>();

            string[] topics = TextFile.FileToArray(Commons.PathDatabase + "\\Argomenti_DA IMPORTARE.tsv");
            if (topics == null)
            {
                MessageBox.Show("Non è stato possibile aprire il file Argomenti_DA IMPORTARE.tsv");
                return;
            }
            foreach (string line in topics)
            {
                Topic    t      = new Topic();
                string[] fields = line.Split('\t');
                // count tabs in the beginning of the line
                int nTabs = 0;
                while (fields[nTabs] == "" && nTabs < fields.Length - 1)
                {
                    nTabs++;
                }
                if (fields[nTabs] != "")
                {
                    // store temporarily the level in field Parent node ID
                    // (not used for other in this phase)
                    t.ParentNodeNew = nTabs;  // it is the level count
                    t.Name          = fields[nTabs++];
                    if (nTabs < fields.Length && fields[nTabs] != "")
                    {
                        t.Desc = fields[nTabs];
                    }
                    ListTopics.Add(t);
                }
            }
            MessageBox.Show("Salvare per rendere definitiva l'importazione.");
            frmTopics ft = new frmTopics(frmTopics.TopicsFormType.ImportWithErase, ListTopics, null, null);

            ft.ShowDialog();
            ft.Dispose();
        }
Esempio n. 5
0
        private void btnChooseTopic_Click(object sender, EventArgs e)
        {
            Topic chosenTopic;

            chosenTopic = currentTopic;
            List <Topic> oneItemList = new List <Topic>();

            oneItemList.Add(chosenTopic);
            frmTopics f = new frmTopics(frmTopics.TopicsFormType.NormalDialog,
                                        oneItemList, currentClass, currentSubject);

            f.ShowDialog();
            if (f.UserHasChosen)
            {
                chosenTopic             = f.ChosenTopic;
                currentTopic            = chosenTopic;
                currentQuestion.IdTopic = chosenTopic.Id;
                txtTopic.Text           = dbMptt.GetTopicPath(currentTopic.Id);
            }
            f.Dispose();
        }