Beispiel #1
0
        //public List<Link> Links
        //{
        //    get { return links; }
        //    set
        //    {
        //        linkLabel1.Text = definitionBox.Text;
        //        value.Sort((x, y) => x.StartChar.CompareTo(y.StartChar));
        //        foreach (Link link in value)
        //        {
        //            //linkLabel1.LinkArea = new LinkArea(link.StartChar, link.Descriptor.Length);
        //            LinkLabel.Link data = new LinkLabel.Link();
        //            data.LinkData = link.DescriptorID;
        //            linkLabel1.Links.Add(link.StartChar, link.Descriptor.Length, data.LinkData);
        //        }
        //        linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.Link_LinkClicked);
        //    }
        //}

        private void Link_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Termin    termin;
            DBQueries db = new DBQueries();

            termin = db.GetTermin(Convert.ToInt32(e.Link.LinkData));
            foreach (Definition def in termin.Definitions)
            {
                TerminControl tc = new TerminControl
                {
                    Relator            = termin.Relator,
                    Descriptor         = termin.Descriptor,
                    Definition         = def.Content,
                    Ascriptors         = termin.Ascriptors,
                    definitionId       = def.ID,
                    DefinitionLocation = new int[] { def.StartLine, def.StartChar, def.EndLine, def.EndChar },
                    DescriptorLocation = new int[] { termin.StartLine, termin.StartChar, termin.EndLine, termin.EndChar },
                    Relations          = termin.Relations,
                    Links = def.Links
                };

                TerminViewForm tvf = new TerminViewForm();
                tvf.AddControl(tc);
                tvf.Show();
            }
        }
Beispiel #2
0
        private void InfoButton_Click(object sender, EventArgs e)
        {
            answersPanel.Controls.Clear();
            Termin termin = db.GetTermin((int)terminView.Rows[terminView.SelectedCells[0].RowIndex].Cells["id"].Value);

            foreach (Definition def in termin.Definitions)
            {
                TerminControl tc = new TerminControl
                {
                    Relator            = termin.Relator,
                    Descriptor         = termin.Descriptor,
                    Definition         = def.Content,
                    Ascriptors         = termin.Ascriptors,
                    definitionId       = def.ID,
                    DefinitionLocation = new int[] { def.StartLine, def.StartChar, def.EndLine, def.EndChar },
                    DescriptorLocation = new int[] { termin.StartLine, termin.StartChar, termin.EndLine, termin.EndChar },
                    Relations          = termin.Relations,
                    Links = def.Links
                };
                tc.Click += new EventHandler(ItemClick);
                answersPanel.Controls.Add(tc);
            }
            ItemClick(answersPanel.Controls[0], null);
            bool reg = CurrentSession.CurrentUser != null;

            ChangeButton.Enabled           = reg && (CheckedItem != null);
            addRelationButton.Enabled      = reg && (CheckedItem != null);
            AddSynonymButton.Enabled       = reg && (CheckedItem != null);
            addLinkButton.Enabled          = reg && (CheckedItem != null);
            deleteDefinitionButton.Enabled = reg && (CheckedItem != null);
        }