Esempio n. 1
0
        public void Disconnected()
        {
            if (LV != null)
            {
                Program.form1.Invoke((MethodInvoker)(() =>
                {
                    try
                    {
                        lock (Settings.LockListviewClients)
                            LV.Remove();

                        if (LV2 != null)
                        {
                            lock (Settings.LockListviewThumb)
                                LV2.Remove();
                        }
                    }
                    catch { }
                    SoundPlayer sp = new SoundPlayer(Server.Properties.Resources.offline);
                    sp.Load();
                    sp.Play();
                    new HandleLogs().Addmsg($"Client {Ip} disconnected.", Color.Red);
                }));
            }

            try
            {
                SslClient?.Dispose();
                TcpClient?.Dispose();
            }
            catch { }
        }
Esempio n. 2
0
        public void Disconnected()
        {
            if (LV != null)
            {
                Program.form1.BeginInvoke((MethodInvoker)(() =>
                {
                    try
                    {
                        lock (Settings.LockListviewClients)
                            LV.Remove();

                        if (LV2 != null)
                        {
                            lock (Settings.LockListviewThumb)
                                LV2.Remove();
                        }
                    }
                    catch { }
                }));
                new HandleLogs().Addmsg($"Client {TcpClient.RemoteEndPoint.ToString().Split(':')[0]} disconnected", Color.Red);
            }

            try
            {
                SslClient?.Dispose();
                TcpClient?.Dispose();
                ClientMS?.Dispose();
            }
            catch { }
        }
Esempio n. 3
0
        public void Disconnected()
        {
            if (LV != null)
            {
                Program.form1.Invoke((MethodInvoker)(() =>
                {
                    try
                    {
                        lock (Settings.LockListviewClients)
                            LV.Remove();

                        if (LV2 != null)
                        {
                            lock (Settings.LockListviewThumb)
                                LV2.Remove();
                        }
                    }
                    catch { }
                    new HandleLogs().Addmsg($"Client {Ip} disconnected", Color.Red);
                }));
            }

            try
            {
                SslClient?.Dispose();
                TcpClient?.Dispose();
            }
            catch { }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        UserInfoLogic       usersList = new UserInfoLogic();
        List <UserInfoItem> AllUsers  = new List <UserInfoItem>();

        AllUsers       = usersList.GetAllData();
        LV1.DataSource = AllUsers;
        LV1.DataBind();
        LV2.DataSource = AllUsers;
        LV2.DataBind();
        DV1.DataSource = AllUsers;
        DV1.DataBind();
    }
Esempio n. 5
0
        public void Disconnected()
        {
            if (LV != null)
            {
                if (Program.form1.listView1.InvokeRequired)
                {
                    Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
                    {
                        try
                        {
                            lock (Settings.Listview1Lock)
                                LV.Remove();

                            if (LV2 != null)
                            {
                                lock (Settings.Listview3Lock)
                                    LV2.Remove();
                            }
                        }
                        catch { }
                    }));
                }

                lock (Settings.Online)
                    Settings.Online.Remove(this);
            }

            try
            {
                TcpClient.Shutdown(SocketShutdown.Both);
            }
            catch { }

            try
            {
                SslClient?.Close();
                TcpClient?.Close();
                SslClient?.Dispose();
                TcpClient?.Dispose();
                ClientMS?.Dispose();
            }
            catch { }
        }
Esempio n. 6
0
        public void Disconnected()
        {
            if (LV != null)
            {
                Program.form1.Invoke((MethodInvoker)(() =>
                {
                    try
                    {
                        lock (Settings.LockListviewClients)
                            LV.Remove();

                        if (LV2 != null)
                        {
                            lock (Settings.LockListviewThumb)
                                LV2.Remove();
                        }
                    }
                    catch { }
                    new HandleLogs().Addmsg($"Client {Ip} disconnected.", Color.Red);
                    TimeZoneInfo local = TimeZoneInfo.Local;
                    if (local.Id == "China Standard Time" && Properties.Settings.Default.Notification == true)
                    {
                        SoundPlayer sp = new SoundPlayer(Server.Properties.Resources.offline);
                        sp.Load();
                        sp.Play();
                    }

                    foreach (AsyncTask asyncTask in Form1.getTasks.ToList())
                    {
                        asyncTask.doneClient.Remove(ID);
                    }
                }));
            }

            try
            {
                SslClient?.Dispose();
                TcpClient?.Dispose();
            }
            catch { }
        }
Esempio n. 7
0
        protected TreePathVertice AddAdHocVertice(PointD point, TreePathVertice.VerticeType type)
        {
            TreePathVertice V1, V2;

            if (_vertices.TryGetValue(point.HashName, out V1) == false)
            {
                /**
                 * Having ensured that our vertice does not already exist,
                 * we are either adding an origin or destination.
                 *
                 * we need to add the vertice itself (V1), as well as an additional one (V2) on the closest
                 * line segment (L) to the new vertice.
                 *
                 * The vertices at the end of (L) will have each other as neighbors. Since we are
                 * essentially splitting (L) into two segments,
                 */

                /** clear any that exist of the given type */
                ClearAdHocVertices(type);

                /** create our new vertice */
                V1 = new TreePathVertice(point, type);
                _vertices.Add(V1.HashName, V1);

                /** find closest point on the closest line for a second vertice */
                Double closestDistance;
                Line   L;
                PointD closestPoint = m_Lines.ClosestPointTo(point, out L, out closestDistance);
                DebugLogText(LogLevel.DEBUG, "Added ad-hoc vertice of type {0} at point {1} closest to line [[{2}]] at {3} pixels", type, point, L, closestDistance);
                if (closestPoint != null)
                {
                    /** if the closest vertice doesn't exist yet, we will create it, and split the line L */
                    if (_vertices.TryGetValue(closestPoint.HashName, out V2) == false)
                    {
                        /** get the vertices on the line we are about to split */
                        TreePathVertice LV1, LV2;
                        if (_vertices.TryGetValue(L.P1.HashName, out LV1) == false ||
                            _vertices.TryGetValue(L.P2.HashName, out LV2) == false)
                        {
                            throw new Exception("Vertices on original lines should exist");
                        }

                        /** create our new vertice on the split line */
                        V2 = new TreePathVertice(closestPoint, type);
                        _vertices.Add(V2.HashName, V2);

                        /** fix up neighbors */
                        LV1.TryReplaceNeighbor(LV2, V2);
                        LV2.TryReplaceNeighbor(LV1, V2);

                        V2.TryAddNeighbor(LV1);
                        V2.TryAddNeighbor(LV2);
                        V2.TryAddNeighbor(V1);

                        V1.TryAddNeighbor(V2);

                        /** replace L with two new lines L1 and L2 */
                        Line l1 = new Line(L.P1, closestPoint);
                        Line l2 = new Line(closestPoint, L.P2);

                        m_Lines.Remove(L);
                        m_Lines.Add(l1);
                        m_Lines.Add(l2);
                    }
                    else
                    {
                        V1.TryAddNeighbor(V2);
                        V2.TryAddNeighbor(V1);
                    }
                }
            }

//			DumpVertices();

            return(V1);
        }