Exemplo n.º 1
0
 private void ShowInfo(List <Termin> termins)
 {
     answersPanel.Controls.Clear();
     if (termins.Count == 0)
     {
         Label label = new Label();
         label.AutoSize = true;
         label.Text     = "Поиск не дал результатов";
         answersPanel.Controls.Add(label);
         return;
     }
     foreach (Termin termin in termins)
     {
         foreach (Definition def in termin.Definitions)
         {
             TerminControl tc = new TerminControl
             {
                 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
             };
             answersPanel.Controls.Add(tc);
         }
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
0
 private void ItemClick(object sender, EventArgs e)
 {
     if (CheckedItem != null)
     {
         CheckedItem.BorderStyle = BorderStyle.FixedSingle;
     }
     CheckedItem             = (TerminControl)sender;
     CheckedItem.BorderStyle = BorderStyle.Fixed3D;
 }
Exemplo n.º 5
0
 public void AddControl(TerminControl terminControl)
 {
     terminsPanel.Controls.Add(terminControl);
 }