Esempio n. 1
0
        internal LinkChooser(LinkControl links, uint project)
        {
            InitializeComponent();

            Links     = links;
            ProjectID = project;
        }
Esempio n. 2
0
        private IControl BuildLinkControl(ControlConfig controlConfig)
        {
            var control = new LinkControl()
            {
                ControlType = ControlType.Link,
                OpenNewPage = controlConfig.OpenNewPage,
                ExternalUrl = controlConfig.ExternalUrl,
                Text        = controlConfig.Text,
                View        = controlConfig.View,
                ModelId     = controlConfig.ModelId,
            };

            if (controlConfig.EndpointId != EndpointId.None)
            {
                control.Method            = _modelRepository.GetEndpoint(controlConfig.EndpointId).Method;
                control.PrimaryInt        = GetParameterString(controlConfig.PrimaryInt, BasicType.Int);
                control.SecondaryInt      = GetParameterString(controlConfig.SecondaryInt, BasicType.Int);
                control.PrimaryString     = GetParameterString(controlConfig.PrimaryString, BasicType.String);
                control.SecondaryString   = GetParameterString(controlConfig.SecondaryString, BasicType.String);
                control.PrimaryBool       = GetParameterString(controlConfig.PrimaryBool, BasicType.Bool);
                control.SecondaryBool     = GetParameterString(controlConfig.SecondaryBool, BasicType.Bool);
                control.PrimaryDateTime   = GetParameterString(controlConfig.PrimaryDateTime, BasicType.DateTime);
                control.SecondaryDateTime = GetParameterString(controlConfig.SecondaryDateTime, BasicType.DateTime);
            }

            return(control);
        }
Esempio n. 3
0
 internal void setSelectedValue(LinkControl linkControl)
 {
     int Id = (int)GridView.CurrentRow.Cells["Id"].Value;
     string Text = GridView.CurrentRow.Cells[1].Value.ToString();
     linkControl.LabelText = Text;
     linkControl.LinkedRowId = Id;
 }
Esempio n. 4
0
 public RemoveLinkMenuItem Create(LinkControl link, NodeControl toNode)
 {
     BindOppositeNodeCaptionTextChangeNotifier(toNode);
     SetHeader(toNode.Caption.Text);
     link.RemoveAssociatedElements += Remove;
     this.link = link;
     return this;
 }
Esempio n. 5
0
        internal void setSelectedValue(LinkControl linkControl)
        {
            int    Id   = (int)GridView.CurrentRow.Cells["Id"].Value;
            string Text = GridView.CurrentRow.Cells[1].Value.ToString();

            linkControl.LabelText   = Text;
            linkControl.LinkedRowId = Id;
        }
Esempio n. 6
0
 public SelectControl(LinkControl linkedControl)
 {
     InitializeComponent();
     this.linkedControl = linkedControl;
     gridView.Name      = linkedControl.LinkType.Additional;
     view        = Program.Context.ViewToGridManager.bindToView(gridView);
     this.Height = OKButton.Location.Y + OKButton.Height + 40;
     this.Width  = CancelButton.Location.X + CancelButton.Width + 20;
 }
Esempio n. 7
0
 public SelectControl(LinkControl linkedControl)
 {
     InitializeComponent();
     this.linkedControl = linkedControl;
     gridView.Name = linkedControl.LinkType.Additional;
     view = Program.Context.ViewToGridManager.bindToView(gridView);
     this.Height = OKButton.Location.Y + OKButton.Height + 40;
     this.Width = CancelButton.Location.X + CancelButton.Width + 20;
 }
 private void MakeControls()
 {
     linkControls.Children.Clear();
     for (int i = 0; i < linksList.Children.Count; i++)
     {
         var newlinkControl = new LinkControl();
         newlinkControl.LinkNum       = i;
         newlinkControl.ValueChanged += LinkControl_OnValueChanged;
         linkControls.Children.Add(newlinkControl);
     }
 }
Esempio n. 9
0
 protected void AddLink(Point linkPosition, NodeControl nodeControl)
 {
     log.Debug("Now adding user link, first link control is: " + nodeControl.Caption.Text);
     var linkControl = new LinkControl().Create();
     linkControl.BindNode1(nodeControl);
     linkControl.BindPoint2MouseMove(Canvas);
     Canvas.Children.Add(linkControl.TheLine);
     new MouseDrop<NodeControl>().Create(Cursors.Pen,
         (Point linkPosition2, NodeControl nodeControl2) =>
             AddLinkFinal(linkControl, new Tuple<NodeControl, NodeControl>(nodeControl, nodeControl2)),
         () => AddLinkCancel(linkControl)
     ).Drop(Canvas);
 }
Esempio n. 10
0
 public void AddRemoveLinkContextMenuItem(LinkControl link)
 {
     Assert.Assigned(Panel.ContextMenu);
     Panel.ContextMenu.Items.Add(CreateRemoveLinkMenuItem(link));
 }
Esempio n. 11
0
        public Link(List <Formated> s, float emSize, FontStyle style)
        {
            int count = 1;

            for (int i = s.Count - 1; i >= 0; i--)
            {
                if (s[i].s == ']')
                {
                    count = i; break;
                }
            }
            ;
            List <Control> v = new List <Control>();
            bool           isLink = false;
            string         link = "", context = "";

            for (int k = s.Count - 2; k >= count + 2; k--)
            {
                if (s[k - 1].s == ' ' && s[k].s == '\"')
                {
                    isLink = true; k -= 2;
                }
                if (isLink)
                {
                    link = s[k].s + link;
                }
                else
                {
                    context = s[k].s + context;
                }
            }
            if (!isLink)
            {
                link = context; context = "";
            }
            else
            {
                try { context = context.Remove(context.Length - 1, 1); } catch { }
            }
            List <ImageText> imageTexts = new List <ImageText>();
            List <int>       q          = new List <int>();

            for (int i = 1; i < s.Count; i++)
            {
                int end;
                if (s[i].s == '!')
                {
                    if (LinesText.isImage(s.GetRange(i + 1, count - i), out end))
                    {
                        imageTexts.Add(new ImageText(s.GetRange(i, end + 2), link, Form1.emSize, style));
                        q.Add(i);
                        s.RemoveRange(i, end + 2);
                        count -= end + 2;
                        i--;
                    }
                }
            }
            int st = 0;

            for (int i = 1; i < count; i++)
            {
                string current = "";
                for (int j = i; true; j++)
                {
                    bool tr = false;
                    while (q.Count > st && j == q[st])
                    {
                        if (current != "")
                        {
                            tr = true;
                            v.Add(new LinkLabel());
                            v[v.Count - 1].AutoSize = true;
                            try { (v[v.Count - 1] as LinkLabel).Links.Add(0, v[v.Count - 1].Text.Length, link); } catch { }
                            v[v.Count - 1].ContextMenuStrip = new ContextMenuStrip();
                            try { v[v.Count - 1].ContextMenuStrip.Text = context; } catch { v[v.Count - 1].ContextMenuStrip.Text = ""; }
                            (v[v.Count - 1] as LinkLabel).LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);
                            v[v.Count - 1].MouseHover += new EventHandler(LinkMouseHover);
                            v[v.Count - 1].MouseLeave += new EventHandler(LinkMouseLeave);
                            current             = current.Replace((char)(65534), '*');
                            current             = current.Replace((char)(65533), '~');
                            current             = current.Replace((char)(65535), '_');
                            v[v.Count - 1].Text = current;
                            current             = "";
                            v[v.Count - 1].Font = new Font(Form1.baseFamilyName, emSize, style | Format(s[i].isItalic, s[i].isBolt, s[i].isStricedOut, s[i].isUnderLine), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                            i = j - 1;
                        }
                        v.Add(imageTexts[st].value);
                        st++;
                    }
                    if (tr)
                    {
                        break;
                    }
                    if (j < count && s[i].isBolt == s[j].isBolt && s[i].isItalic == s[j].isItalic && s[i].isStricedOut == s[j].isStricedOut && s[i].isUnderLine == s[j].isUnderLine)
                    {
                        current += s[j].s;
                    }
                    else
                    {
                        v.Add(new LinkLabel());
                        v[v.Count - 1].AutoSize = true;
                        try { (v[v.Count - 1] as LinkLabel).Links.Add(0, v[v.Count - 1].Text.Length, link); } catch { }
                        v[v.Count - 1].ContextMenuStrip = new ContextMenuStrip();
                        try { v[v.Count - 1].ContextMenuStrip.Text = context; } catch { v[v.Count - 1].ContextMenuStrip.Text = ""; }
                        (v[v.Count - 1] as LinkLabel).LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);
                        v[v.Count - 1].MouseHover += new EventHandler(LinkMouseHover);
                        v[v.Count - 1].MouseLeave += new EventHandler(LinkMouseLeave);
                        current             = current.Replace((char)(65534), '*');
                        current             = current.Replace((char)(65533), '~');
                        current             = current.Replace((char)(65535), '_');
                        v[v.Count - 1].Text = current;
                        current             = "";
                        v[v.Count - 1].Font = new Font(Form1.baseFamilyName, emSize, style | Format(s[i].isItalic, s[i].isBolt, s[i].isStricedOut, s[i].isUnderLine), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                        i = j - 1;
                        break;
                    }
                }
            }
            for (; st < imageTexts.Count; st++)
            {
                v.Add(imageTexts[st].value);
            }
            value = new LinkControl(v, (int)(emSize));
        }
Esempio n. 12
0
 protected MenuItem CreateRemoveLinkMenuItem(LinkControl link)
 {
     var opposite = link.LinkedNodes.Item1 != this ? link.LinkedNodes.Item1 : link.LinkedNodes.Item2;
     var item = new RemoveLinkMenuItem().Create(link, opposite);
     return item;
 }
Esempio n. 13
0
 protected void AddLinkFinal(LinkControl link, Tuple<NodeControl, NodeControl> nodes)
 {
     log.Debug("Now linking: '{0}' & '{1}'", nodes.Item1.Caption.Text, nodes.Item2.Caption.Text);
     link.BindNode2(nodes.Item2);
 }
Esempio n. 14
0
 protected void AddLinkCancel(LinkControl link)
 {
     log.Debug("Now aborting user link...");
     link.Remove();
 }
Esempio n. 15
0
 protected void ReadLink(XElement element)
 {
     var link = new LinkControl().Create(element, TheCanvas);
     link.SetValue(IdProperty, element.GetIdAttribute());
     TheCanvas.Children.Add(link.TheLine);
 }
Esempio n. 16
0
 protected void TestGenerateLargeDocument(int count, int countOfLinks)
 {
     ClearContent();
     log.Debug(() => "Now generating document: count of nodes: " + count + "; count of links: " + countOfLinks);
     var nodes = new List<NodeControl>(count);
     var random = new Random();
     for (int i = 0; i < count; ++i)
     {
         //log.Debug(() => "Node #" + i + "...");
         var node = new NodeControl(i.ToString());
         nodes.Add(node);
         Canvas.Children.Add(node);
         node.UpdateLayout();
         Canvas.SetLeft(node, random.NextDouble() * (Canvas.Width - node.ActualWidth));
         Canvas.SetTop(node, random.NextDouble() * (Canvas.Height - node.ActualHeight));
     }
     for (int i = 0; i < countOfLinks; ++i)
     {
         //log.Debug(() => "Link #" + i + "...");
         var index1 = random.Next(count);
         var index2 = random.Next(count);
         if (index1 != index2)
         {
             var link = new LinkControl().Create();
             var node1 = nodes[index1];
             var node2 = nodes[index2];
             Canvas.Children.Add(link.TheLine);
             link.BindNode1(node1);
             link.BindNode2(node2);
         }
     }
 }
Esempio n. 17
0
 protected void WriteLink(XElement elements, LinkControl link)
 {
     Assert.Assigned(link);
     var element = link.SaveToElement();
     link.SetValue(IdProperty, GetNewId(link));
     element.SetIdAttribute(GetExistingId(link));
     elements.Add(element);
 }