Esempio n. 1
0
 /// <summary>
 /// Удаление дуги
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DdLinkDeleted(object sender, LinkEventArgs e)
 {
     if (Load)
     {
         return;
     }
     if (!CanEdit)
     {
         return;
     }
     // DD.Links.Remove()
     if (e.Link.Text != "")
     {
         if ((bool)e.Link.Tag)
         {
             if (!Load || !Reload)
             {
                 SemanticWeb.Web().DeleteArc(((Node)e.Link.Origin.Tag).ID, e.Link.Text, ((Node)e.Link.Destination.Tag).ID);
             }
         }
         Messages.Add("дуга удалена: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         // _somethingChanged = true;
     }
     // e.Link.Destination - цель
     // e.Link.Origin//откуда
 }
Esempio n. 2
0
        static void OnNewLink(object p, LinkEventArgs e)
        {
            test1 = e.lnk;
            Console.WriteLine("New client connected: remote IPAdress {0} , remote Identity: {1}", e.lnk.IPv4Address.ToString(), e.lnk.UserName);

            e.lnk.EmptyBuffer += OnEmptyBuffer;
            e.lnk.Accept();

            Console.WriteLine("Reading metadata from Link:");
            Console.WriteLine("lnk1.Connect.StreamIsConnected is {0}", e.lnk.IsConnected.ToString());
            Console.WriteLine("lnk1.Connect.IPv4Address is {0}", e.lnk.IPv4Address.ToString());

            testmode = 2;
            Console.WriteLine("Send 1000 Packets....");
            con2.test = "Message ";

            try
            {
                lock (Buffer_lock)
                {
                    for (int x = 0; x < 10; x++)
                    {
                        con2.ID++;
                        system.SendContainer(test1, con2, 1, 1, true);
                    }
                    //Portal.Finialize();
                }
            }
            catch (Exception es)
            {
                Console.WriteLine(es.ToString());
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Создание дуги
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DdLinkCreated(object sender, LinkEventArgs e)
 {
     try
     {
         var formLink = new ComboBoxForm();
         formLink.RefreshValue(SemanticWeb.Web().GetAllowedArcNames(((Node)e.Link.Origin.Tag).ID));
         formLink.ShowDialog();
         Messages.Add("Создание дуги " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         if (formLink.DialogResult == true)
         {
             e.Link.Text = formLink.ReturnValue().ToString();
             SemanticWeb.Web().AddArc(((Node)e.Link.Origin.Tag).ID, e.Link.Text, ((Node)e.Link.Destination.Tag).ID);
             e.Link.Tag = true;
             Messages.Add("Создание дуги завершилось: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         }
         else
         {
             DD.Links.Remove(e.Link);
             Messages.Add("Создание дуги отменено: " + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         }
     }
     catch (ArgumentException e1)
     {
         MessageBox.Show(e1.Message);
         /*произошла ошибка вставки, удаляем дугу из графа*/
         e.Link.Tag = false;
         DD.Links.Remove(e.Link);
         Messages.Add("Создание дуги отменено: " + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// PivotViewer LinkClicked event handler
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">Event data for LinkClicked event</param>
        private void OnPivotViewerLinkClicked(object sender, LinkEventArgs e)
        {
            string linkUriString = e.Link.ToString();

            this.resourceId = string.Empty;
            if (!linkUriString.Contains(".cxml"))
            {
                HtmlPage.Window.Navigate(e.Link, "_blank");
            }
            else
            {
                int index = linkUriString.IndexOf("?", StringComparison.InvariantCultureIgnoreCase);
                if (index > 0)
                {
                    this.collectionUri = linkUriString.Remove(index);
                    index = linkUriString.IndexOf("?Id=EQ.", StringComparison.InvariantCultureIgnoreCase);
                    if (index > 0)
                    {
                        this.resourceId = linkUriString.Substring(index + 7);
                    }
                }

                this.pivotViewer.LoadCollection(linkUriString, string.Empty);
            }
        }
Esempio n. 5
0
 private void LinkAddedOrDeleted(object sender, LinkEventArgs e)
 {
     if (e.Source.Type == STR.Email)
     {
         if (e.Target.Type == STR.Category && Settings.SyncMailCategory)
         {
             ExportCategories.Do(JobPriority.AboveNormal, e.Source);
         }
         else if (e.Target.Type == STR.Flag)
         {
             ExportEmailFlag.Do(JobPriority.AboveNormal, e.Source);
         }
     }
     else
     if (e.Source.Type == STR.Task)
     {
         if (e.Target.Type == STR.Category && Settings.SyncTaskCategory)
         {
             ExportCategories.Do(JobPriority.AboveNormal, e.Source);
         }
     }
     else
     if (e.Source.Type == STR.Contact)
     {
         if (e.Target.Type == STR.Category && Settings.SyncContactCategory)
         {
             OutlookSession.OutlookProcessor.QueueJob(JobPriority.AboveNormal, new ExportContactCategoryDescriptor(e.Source));
         }
     }
 }
Esempio n. 6
0
 private void DD_LinkCreated(object sender, LinkEventArgs e)
 {
     try
     {
         ComboBoxForm formLink = new ComboBoxForm();
         formLink.RefreshValue(SemanticWeb.SystemArcs);
         formLink.ShowDialog();
         SendMessage("создание дуги " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         if (formLink.DialogResult == true)
         {
             //throw new ArgumentException();
             e.Link.Text = formLink.ReturnValue().ToString();
             myWeb.AddArc(e.Link.Origin.Text, e.Link.Text, e.Link.Destination.Text);
             SendMessage("создание дуги завершилось: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         }
         else
         {
             //throw new ArgumentException("отмена выбора имени дуги");
             DD.Links.Remove(e.Link);
             SendMessage("создание дуги отменено: " + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         }
     }
     catch (ArgumentException e1)
     {
         MessageBox.Show(e1.Message);
         /*произошла ошибка вставки, удаляем дугу из графа*/
         DD.Links.Remove(e.Link);
         SendMessage("создание дуги отменено: " + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
     }
 }
Esempio n. 7
0
 private void DD_LinkModified(object sender, LinkEventArgs e)
 {
     SendMessage("изменение дуги: " + oldLink.Text + " от " + oldLink.Origin.Text + " к " + oldLink.Destination.Text);
     try
     {
         if (oldLink.Origin.Text != e.Link.Origin.Text)
         {
             myWeb.ChangeArcDirectionFrom(((Node)oldLink.Origin.Tag).ID, ((Node)e.Link.Origin.Tag).ID, e.Link.Text, ((Node)e.Link.Destination.Tag).ID);
             SendMessage("изменение дуги заврешено: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         }
         if (oldLink.Destination.Text != e.Link.Destination.Text)
         {
             myWeb.ChangeArcDirectionTo(((Node)e.Link.Origin.Tag).ID, oldLink.Destination.Text, ((Node)e.Link.Tag).ID, ((Node)e.Link.Destination.Tag).ID);
             SendMessage("изменение дуги заврешено: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
         }
     }
     catch (ArgumentException e1)
     {
         e.Link.Text        = oldLink.Text;
         e.Link.Origin      = oldLink.Origin;
         e.Link.Destination = oldLink.Destination;
         MessageBox.Show(e1.Message);
         SendMessage("изменение дуги отменено: " + oldLink.Text + " от " + oldLink.Origin.Text + " к " + oldLink.Destination.Text);
     }
 }
Esempio n. 8
0
        private void diagram1_LinkSelected(object sender, LinkEventArgs e)
        {
            List <DiagramItem> ListItemDiagram = GetItemSelected();

            if (ListItemDiagram.Count == 1)
            {
                if (ListItemDiagram[0].GetType() == typeof(DiagramLink))
                {
                    try
                    {
                        TextboxLine.Text  = ListItemDiagram[0].Text;
                        TextboxWidth.Text = ListItemDiagram[0].Pen.Width.ToString();

                        if (ListItemDiagram[0].Pen.Color == Color.Red)
                        {
                            comboBox2.SelectedItem = 1;
                        }
                        else
                        {
                            comboBox2.SelectedItem = 2;
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
        }
Esempio n. 9
0
 private async void Reader_LinkTapped(object sender, LinkEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Link))
     {
         await Launcher.LaunchUriAsync(new Uri(e.Link));
     }
     else
     {
         if (!string.IsNullOrEmpty(e.Id))
         {
             var node = Reader.GetSpecificIdNode(e.Id, e.FileName);
             if (node.Name == "body")
             {
                 Reader.LocateToSpecificFile(e.FileName);
             }
             else
             {
                 var tip = Reader.GetSpecificIdContent(node, e.Id);
                 await new MessageDialog(tip.Description, tip.Title).ShowAsync();
             }
         }
         else if (!string.IsNullOrEmpty(e.FileName))
         {
             Reader.LocateToSpecificFile(e.FileName);
         }
     }
 }
Esempio n. 10
0
 static void OnDisconnectingLinkServer2(object p, LinkEventArgs e)
 {
     //Console.WriteLine("                                  CL2 DIS");
     lock (Livinglist_lock)
     {
         Livinglist.Remove(e.lnk);
     }
 }
Esempio n. 11
0
 private void DD_LinkDeleted(object sender, LinkEventArgs e)
 {
     // DD.Links.Remove()
     myWeb.DeleteArc(((Node)e.Link.Origin.Tag).ID, e.Link.Text, ((Node)e.Link.Destination.Tag).ID);
     SendMessage("дуга удалена: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text);
     // e.Link.Destination - цель
     // e.Link.Origin//от куда
 }
Esempio n. 12
0
 /// <summary>
 /// 拦截消息通知
 /// </summary>
 private void _HistoryReceiving(object sender, LinkEventArgs <Packet> e)
 {
     if (e.Object.Index != _profile.Id)
     {
         return;
     }
     e.Finish = true;
 }
Esempio n. 13
0
 /// <summary>
 /// 如果 Frame 不为用户列表 则消息提示应当存在
 /// </summary>
 private void _HistoryReceiving(object sender, LinkEventArgs <Packet> e)
 {
     if (uiFrame.Content == _profPage)
     {
         return;
     }
     e.Cancel = true;
 }
Esempio n. 14
0
 static void OnDisconnectingLink(object p, LinkEventArgs e)
 {
     Debug.WriteLine("CL1 CON");
     lock (Livinglist_lock)
     {
         Livinglist.Remove(e.lnk);
     }
 }
Esempio n. 15
0
        internal void OnLinkClicked(object sender, LinkEventArgs e)
        {
            var handler = this.LinkClicked;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Esempio n. 16
0
 static void OnDisconnectingLink(object p, LinkEventArgs e)
 {
     //Console.Write("CL OnDisconnectingLink: " + e.lnk.AttachedID);
     lock (Livinglist_lock)
     {
         Livinglist.Remove(e.lnk);
         //Console.WriteLine("   Okay  "+ Livinglist.Count);
     }
 }
Esempio n. 17
0
 private void diagram1_LinkClicked(object sender, LinkEventArgs e)
 {
     if (e.MouseButton == MouseButton.Right)
     {
         Point point = diagramView1.DocToClient((e.MousePosition));
         point.X = point.X + diagramView1.Bounds.X;
         contextMenuStrip1.Show(this, point);
         link = e.Link;
     }
 }
Esempio n. 18
0
        private static void _HistoryHandled(object sender, LinkEventArgs <Packet> e)
        {
            var hdl = new WindowInteropHelper(Application.Current.MainWindow).Handle;

            if (e.Finish == false || Application.Current.MainWindow.IsActive == false)
            {
                NativeMethods.FlashWindow(hdl, true);
            }
            return;
        }
Esempio n. 19
0
        void OnNewLinkRunningServer(object p, LinkEventArgs e)
        {
            e.lnk.Accept();

            //send data
            con3.ID   = 0;
            con3.test = "You are connected to Server 1 via Vaser. Please send your Logindata.";
            // the last 2 digits are manually set [1]
            testS.SendContainer(e.lnk, con3, 1, 0);
        }
Esempio n. 20
0
 private void LinkDeleted(object sender, LinkEventArgs e)
 {
     if (e.Source.Type == STR.Email && e.Target.Type == STR.Category)
     {
         IResourceList resAttachments = e.Source.GetLinksOfType(null, PROP.Attachment);
         foreach (IResource attach in resAttachments.ValidResources)
         {
             Core.CategoryManager.RemoveResourceCategory(attach, e.Target);
         }
     }
     LinkAddedOrDeleted(sender, e);
 }
Esempio n. 21
0
        public static void OnDisconnectingLink(object sender, LinkEventArgs e)
        {
            //MessageBox.Show("Lost Connection...");
            if (OPTIONS.clientID != 0)
            {
                OPTIONS.clientID = 0;

                Message msg = new Message();
                msg.command     = 2; //close
                msg.Messagedata = "Lost connection.";
                IncommingLogin.Enqueue(msg);
            }
        }
Esempio n. 22
0
        DiagramLink _rightLink; //связь по которой щелкнули правой кнопкой
        private void DdLinkClicked(object sender, LinkEventArgs e)
        {
            myContextMenu.IsEnabled  = false;
            myContextMenu.Visibility = Visibility.Collapsed;

            if (e.MouseButton == MouseButton.Right && CanEdit)
            {
                _rightLink = e.Link;
                myContextMenu.IsEnabled   = true;
                myContextMenu.Visibility  = Visibility.Visible;
                myContextMenu.DataContext = MenuOptionsLink;
            }
        }
Esempio n. 23
0
        /**
         * tracking adding links to file resources
         * if link added to a transient file resource, it becomes permanent
         * ParentFolder links are obviously ignored
         */
        private static void ResourceStore_LinkAdded(object sender, LinkEventArgs e)
        {
            IResource res = e.Source;

            if (e.PropType != _propParentFolder && res.IsTransient)
            {
                IResource source = FileResourceManager.GetSource(res);
                if (source != null && source.Type == _folderResourceType)
                {
                    res.EndUpdate();
                    Core.TextIndexManager.QueryIndexing(res.Id);
                }
            }
        }
Esempio n. 24
0
        static void OnNewLink(object p, LinkEventArgs e)
        {
            Console.WriteLine("Client connected from IP: " + e.lnk.IPv4Address);

            Client C1 = new Client();

            C1.ID  = myPool.GetFreeID();
            C1.lnk = e.lnk;
            Client.ClientList.Add(C1);
            Client.ClientArray[C1.ID] = C1;

            e.lnk.AttachedID     = C1.ID;
            e.lnk.AttachedObject = C1;

            e.lnk.Accept();
        }
Esempio n. 25
0
 static void OnEmptyBuffer(object p, LinkEventArgs e)
 {
     //Console.WriteLine("OnEmptyBuffer called!");
     lock (Buffer_lock)
     {
         for (int x = 0; x < 10; x++)
         {
             if (con2.ID < 1000)
             {
                 con2.ID++;
                 system.SendContainer(test1, con2, 1, 1, true);
             }
         }
         //Portal.Finialize();
     }
 }
Esempio n. 26
0
        static void OnNewLink(object p, LinkEventArgs e)
        {
            Debug.WriteLine("New client connected: " + e.lnk.IPv4Address);

            e.lnk.EmptyBuffer += OnEmptyBuffer;

            Client c = new Client();

            c.lnk = e.lnk;
            lock (Client.ClientList)
            {
                Client.ClientList.Add(c);
            }

            e.lnk.Accept();
        }
Esempio n. 27
0
        static void OnNewLinkServer2(object p, LinkEventArgs e)
        {
            //Console.WriteLine("             CL2 CON " + object_counter);
            lock (Livinglist_lock)
            {
                Livinglist.Add(e.lnk);
            }
            e.lnk.Accept();

            //send data
            con4.ID   = 0;
            con4.test = "You are connected to Server 2 via Vaser. Please send your Logindata.";
            // the last 2 digits are manually set [1]
            object_counter++;
            system.SendContainer(e.lnk, con4, 1, object_counter);
        }
Esempio n. 28
0
        static void OnDisconnectingLink(object p, LinkEventArgs e)
        {
            Debug.WriteLine("Client disconnected");
            try
            {
                Client c = (Client)e.lnk.vCDObject;

                e.lnk.EmptyBuffer -= OnEmptyBuffer;

                lock (Client.ClientList)
                {
                    Client.ClientList.Remove(c);
                }
            }
            catch
            {
            }
        }
Esempio n. 29
0
        private void diagram1_LinkCreated(object sender, LinkEventArgs e)
        {
            //tim kiem device goc
            Device origin      = FindDevice(e.Link.Origin);
            Device destination = FindDevice(e.Link.Destination);

            // tim kiem diem port
            //port origin
            PointF portOrigin     = origin.port[0];
            double distanceOrigin = GetDistance(e.Link.StartPoint, portOrigin);

            for (int i = 1; i < origin.PortCount; i++)
            {
                if (distanceOrigin > GetDistance(portOrigin, origin.port[i]))
                {
                    portOrigin     = origin.port[i];
                    distanceOrigin = GetDistance(portOrigin, origin.port[i]);
                }
            }
            if (distanceOrigin < 20)
            {
                e.Link.StartPoint = portOrigin;
            }


            //port destination

            PointF portDestination     = destination.port[0];
            double distanceDestination = GetDistance(e.Link.EndPoint, portDestination);

            for (int i = 1; i < destination.PortCount; i++)
            {
                if (distanceDestination > GetDistance(portDestination, destination.port[i]))
                {
                    portDestination     = destination.port[i];
                    distanceDestination = GetDistance(portDestination, destination.port[i]);
                }
            }
            if (distanceDestination < 20)
            {
                e.Link.EndPoint  = portDestination;
                e.Link.AutoRoute = true;
            }
        }
Esempio n. 30
0
        static void OnDisconnectingLink(object p, LinkEventArgs e)
        {
            Client c = (Client)e.lnk.AttachedObject;

            Client.ClientList.Remove(c);
            Client.ClientArray[c.ID] = null;

            //BCast Send disconnect
            SendU2.StatusID = STATUS.USER_DISCONNECT;
            SendU2.UserID   = c.ID;
            SendU2.Username = c.Username;
            Client.BCastContainer(SendU2, SEND_USER.ContID);

            myPool.DisposeID(c.ID);

            //free all resources
            c.lnk.Dispose();
            Console.WriteLine("Client disconnected from IP: " + c.lnk.IPv4Address);
        }
Esempio n. 31
0
        public static void OnDisconnectingLink(object sender, LinkEventArgs e)
        {
            //MessageBox.Show("Lost Connection...");
            if (OPTIONS.clientID != 0)
            {
                OPTIONS.clientID = 0;

                Message msg = new Message();
                msg.command = 2; //close
                msg.Messagedata = "Lost connection.";
                IncommingLogin.Enqueue(msg);

            }
        }
Esempio n. 32
0
        private void FrameDiagram_LinkCreated(object sender, LinkEventArgs e)
        {
            Frame frame = new Frame();
            Frame frame1 = new Frame();

            Frame frameUpper;// = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Destination.Id);
            Frame frameLower;
            string str = "";
            switch (cmbTypeLink.SelectedIndex)
            {
                case 0:
                    e.Link.Text = "Is_a";
                    e.Link.TextColor = Color.DarkRed;
                    e.Link.Pen.Color = Color.Red;
                    frameUpper = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Destination.Id);
                    frameLower = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Origin.Id);

                    //foreach (DiagramNode node in FrameDiagram.Nodes)
                    //{
                    //    if (node.GetBounds().Contains(StartLinkPoint.X, StartLinkPoint.Y))
                    //    {
                    //        if (cmbTypeLink.SelectedIndex == 0)
                    //        {
                    //            frame = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)node.Id);
                    //        }

                    //        str = node.Id.ToString() + cmbTypeLink.SelectedItem.ToString();
                    //    }
                    //    if (node.GetBounds().Contains(EndLinkPoint.X, EndLinkPoint.Y))
                    //    {
                    //        frame1 = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)node.Id);
                    //    }

                    //}

                    //frame.IsA.ParentId = frame1.FrameId;
                    //frame.IsA.SlotDefault = frame1.FrameName;
                    //frame.IsA.frameId = frame1.FrameId;

                    frameLower.IsA.ParentId = frameUpper.FrameId;
                    frameLower.IsA.SlotDefault = frameUpper.FrameName;
                    frameLower.IsA.frameId = frameUpper.FrameId;
                    ClassFactory.kBase.AddIsA(frame); //простор для оптимизации
                    break;
                case 1:
                    e.Link.Text = "Sub";
                    e.Link.TextColor = Color.DarkBlue;
                    e.Link.Pen.Color = Color.Blue;

                    frameUpper = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Destination.Id);
                    frameLower = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Origin.Id);

                    //foreach (DiagramNode node in FrameDiagram.Nodes)
                    //{
                    //    if (node.GetBounds().Contains(StartLinkPoint.X, StartLinkPoint.Y))
                    //    {
                    //        if (cmbTypeLink.SelectedIndex == 0)
                    //        {
                    //            frame = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)node.Id);

                    //        }

                    //        str = node.Id.ToString() + cmbTypeLink.SelectedItem.ToString();
                    //    }
                    //    if (node.GetBounds().Contains(EndLinkPoint.X, EndLinkPoint.Y))
                    //    {
                    //        frame1 = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)node.Id);
                    //    }
                    //}

                    Slot slotSubframe = new Slot(){ IsSystem = false, frameId = frameLower.FrameId, ParentId = frameUpper.FrameId, SlotName="sub", SlotType = Classes.SlotType.Frame};
                    frameUpper.FrameSlots.Add(slotSubframe);
                    break;
            }

            //MessageBox.Show(str + str1);
        }
        private void DiagramNetwork_LinkSelected(object sender, LinkEventArgs e)
        {
            if (DiagramNetwork.Selection.Items.Count > 1)
                return;

            DiagramLink link = e.Link;
            if (link == null)
                return;

            Network network = _project.Network;
            if (network == null)
                return;

            NetworkEdge edge = network.Edges.FindById(Int32.Parse(link.Uid));
            //PanelProps.Edge = edge;
            if (edge == null)
                return;

            _currentType = edge.Type;

            //edge.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(edge_PropertyChanged);
        }
        private void DiagramNetwork_LinkCreated(object sender, LinkEventArgs e)
        {
            DiagramLink link = e.Link;
            if (link == null)
                return;

            Network network = _project.Network;
            if (network == null)
                return;

            NetworkNode origin = network.Nodes.FindById(Int32.Parse(link.Origin.Uid));
            NetworkNode destination = network.Nodes.FindById(Int32.Parse(link.Destination.Uid));

            try
            {
                NetworkEdge edge = network.Edges.Add(origin, destination, _currentType);
                //link.Uid = edge.Id.ToString();
                //link.Text = Utils.ConvertType(edge.Type);
                ////yay, the king has returned!
                //Binding binding = new Binding();
                //binding.Path = new PropertyPath("Type");
                //binding.Converter = new NetworkEdgeTypeStringConverter();
                //binding.Source = edge;
                //binding.Mode = BindingMode.TwoWay;
                //binding.NotifyOnSourceUpdated = true;
                //binding.NotifyOnTargetUpdated = true;
                //binding.ConverterParameter = link;
                //link.SetBinding(DiagramLink.TextProperty, binding);
                _project.LinkAdded(link, edge);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                DiagramNetwork.Links.Remove(e.Link);
            }
        }
Esempio n. 35
0
 /// <summary>
 /// Raises the <see cref="LinkParsed" /> event.
 /// </summary>
 /// <param name="e"> The event data. </param>
 private void OnLinkParsed(LinkEventArgs e)
 {
     LinkParsed?.Invoke(this, e);
 }
Esempio n. 36
0
		private void OnPivotViewerLinkClicked(object sender, LinkEventArgs e)
		{
			OpenLink(e.Link);
		}
        private void DiagramNetwork_LinkDeleted(object sender, LinkEventArgs e)
        {
            DiagramLink link = e.Link;
            if (link == null)
                return;

            Network network = _project.Network;
            if (network == null)
                return;

            if (link.Uid != "")
            {
                NetworkEdge edge = network.Edges.FindById(Int32.Parse(link.Uid));
                if (edge != null)
                    network.Edges.Remove(edge);
            }
        }
Esempio n. 38
0
 /// <summary>
 /// Handle links clicked in the metadata pane
 /// </summary>
 private void SessionsPivot_LinkClicked(object sender, LinkEventArgs args)
 {
     OpenLink(args.Link.ToString());
 }
Esempio n. 39
0
        void _manager_LinkAttached(object sender, LinkEventArgs e)
        {
            if (_images.ContainsKey(e.Link)) throw new InvalidOperationException();

            _images[e.Link] = e.Link.CreateBitmap();
        }
Esempio n. 40
0
        static void OnDisconnectingLink(object p, LinkEventArgs e)
        {
            Client c = (Client)e.lnk.AttachedObject;
            Client.ClientList.Remove(c);
            Client.ClientArray[c.ID] = null;

            //BCast Send disconnect
            SendU2.StatusID = STATUS.USER_DISCONNECT;
            SendU2.UserID = c.ID;
            SendU2.Username = c.Username;
            Client.BCastContainer(SendU2, SEND_USER.ContID);

            myPool.DisposeID(c.ID);

            //free all resources
            c.lnk.Dispose();
            Console.WriteLine("Client disconnected from IP: " + c.lnk.IPv4Address);
        }
Esempio n. 41
0
        static void OnNewLink(object p, LinkEventArgs e)
        {
            Console.WriteLine("Client connected from IP: " + e.lnk.IPv4Address);

            Client C1 = new Client();
            C1.ID = myPool.GetFreeID();
            C1.lnk = e.lnk;
            Client.ClientList.Add(C1);
            Client.ClientArray[C1.ID] = C1;

            e.lnk.AttachedID = C1.ID;
            e.lnk.AttachedObject = C1;

            e.lnk.Accept();
        }
Esempio n. 42
0
        public virtual string Link(string href, string title, string text)
        {
            if (Options.Sanitize)
            {
                string prot = null;

                try
                {
                    prot = Regex.Replace(StringHelper.DecodeURIComponent(StringHelper.Unescape(href)), @"[^\w:]", string.Empty).ToLower();
                }
                catch (Exception)
                {
                    return string.Empty;
                }

                if (prot.IndexOf("javascript:") == 0 || prot.IndexOf("vbscript:") == 0)
                {
                    return string.Empty;
                }
            }

            var args = new LinkEventArgs(href, href, text, title, "");
            OnLinkParsed(args);

            var response = $"<a href=\"{args.Href}\"";

            if (!string.IsNullOrEmpty(args.Title))
            {
                response += $" title=\"{args.Title}\"";
            }

            if (!string.IsNullOrEmpty(args.CssClass))
            {
                response += $" class=\"{args.CssClass}\"";
            }

            response += ">" + args.Text + "</a>";
            return response;
        }
Esempio n. 43
0
 // 事件实现
 protected virtual void OnFinded(LinkEventArgs e)
 {
     if (FindedLink != null)
     {
         FindedLink(this, e);
     }
 }
Esempio n. 44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrameDiagram_LinkCreated(object sender, LinkEventArgs e)
        {
            Frame frameUpper; //тот фрейм, к которому идет дуга
            Frame frameLower; //тот фрейм, от которого идет дуга
            switch (cmbTypeLink.SelectedIndex)
            {
                case 0:
                    e.Link.Text = "Is_a";
                    e.Link.TextColor = Color.DarkRed;
                    e.Link.Pen.Color = Color.Red;
                    frameUpper = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Destination.Id);
                    frameLower = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Origin.Id);

                    frameLower.IsA.ParentId = frameUpper.FrameId;
                    frameLower.IsA.SlotDefault = frameUpper.FrameName;
                    frameLower.IsA.frameId = frameUpper.FrameId;
                    ClassFactory.kBase.AddIsA(frameLower); //простор для оптимизации
                    break;
                case 1:
                    e.Link.Text = "Sub";
                    e.Link.TextColor = Color.DarkBlue;
                    e.Link.Pen.Color = Color.Blue;

                    frameUpper = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Destination.Id);
                    frameLower = ClassFactory.kBase.FrameList().Find(f => f.FrameId == (int)e.Link.Origin.Id);

                    Slot slotSubframe = new Slot(){ IsSystem = false, frameId = frameLower.FrameId, ParentId = frameUpper.FrameId, SlotName="sub", SlotType = Classes.SlotType.Frame};
                    frameUpper.FrameSlots.Add(slotSubframe);
                    break;
            }
        }
Esempio n. 45
0
        /// <summary>
        /// 取得页面上所有的联接
        /// </summary>
        /// <param name="page_url"></param>
        /// <returns></returns>
        public bool getAllLinksOnPage(string page_url, int parent_id, bool SearchAll = false)
        {
            if (string.IsNullOrEmpty(page_url))
                return false;

            // 如果没有域名,则加上域名
            if (page_url.Substring(0, 1) == "/")
                page_url = WEB_ROOT + page_url;

            // 表格的XPath
            const string xpath = "/html[1]/body[1]/table[2]/tr[1]/td[2]/table[4]/tr[1]/td[1]/table[1]/tr[1]/td[3]/table[2]/tr[1]/td[1]/table[1]/tr";

            HtmlWeb web = new HtmlWeb();
            HtmlDocument doc = web.Load(page_url);
            HtmlNodeCollection lists = doc.DocumentNode.SelectNodes(xpath);

            bool finded = true;
            foreach (HtmlNode hn in lists)
            {
                if (hn.SelectNodes("td[@class='black14']") != null)
                {
                    // 补全地址!
                    string url = hn.SelectNodes("td/a")[0].Attributes["href"].Value;
                    if (url.Substring(0, 1) == "/")
                        url = WEB_ROOT + url;

                    // 判断地址是否已经存在,如果不存在,那么至少要检查下一页的数据
                    if (Leo.DB.Contents.Select(string.Format("url = '{0}'", url)).Count == 0)
                        finded = false;

                    LinkEventArgs e = new LinkEventArgs(url,
                                                        hn.SelectNodes("td/a")[0].Attributes["title"].Value,
                                                        hn.SelectNodes("td")[1].InnerText,
                                                        parent_id);
                    OnFinded(e);
                    GetLinkContent(e.url);

                }
            }

            string next_page;

            // 是否要循环
            if (SearchAll)
            {
                next_page = this.getNextPage(page_url);
                if(!string.IsNullOrEmpty(next_page))
                    getAllLinksOnPage(next_page, parent_id, SearchAll);
            }
            else if (!finded)
            {
                next_page = this.getNextPage(page_url);
                if (!string.IsNullOrEmpty(next_page))
                    getAllLinksOnPage(next_page, parent_id, SearchAll);
            }
            return true;
        }
Esempio n. 46
0
        void _manager_LinkDetached(object sender, LinkEventArgs e)
        {
            if (!_images.ContainsKey(e.Link)) throw new InvalidOperationException();

            Image image = _images[e.Link];

            image.Dispose();

            _images.Remove(e.Link);
        }
        private void DiagramNetwork_LinkDeselected(object sender, LinkEventArgs e)
        {
            DiagramLink link = e.Link;
            if (link == null)
                return;

            Network network = _project.Network;
            if (network == null)
                return;

            NetworkEdge edge = network.Edges.FindById(Int32.Parse(link.Uid));

            //if (PanelProps.Edge == edge)
            //    PanelProps.Edge = null;
            //if (edge != null)
            //    edge.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(edge_PropertyChanged);
        }