Beispiel #1
0
        void scriptPanel_VisibleChanged(object sender, EventArgs e)
        {
            ScriptPanel panel = ((ScriptPanel)sender);

            if (panel.Visible)
            {
                try
                {
                    panel.TraceDock.Show(dockPanel1, DockState.DockRight);
                }
                catch
                {
                }
            }
            else
            {
                try
                {
                    panel.TraceDock.Hide();
                }
                catch
                {
                }
            }
        }
Beispiel #2
0
        private void NewConnect()
        {
            toolStripButton_New.Enabled  = false;
            toolStripButton_Run.Enabled  = false;
            toolStripButton_Open.Enabled = false;
            toolStripButton_Save.Enabled = false;

            LoginForm loginForm = new LoginForm();

            if (loginForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    scriptPanel = new ScriptPanel();

                    proxySocket.BeginAccept(new AsyncCallback(OnInSocketAccept), scriptPanel);

                    scriptPanel.VisibleChanged += new EventHandler(scriptPanel_VisibleChanged);

                    scriptPanel.ShowPanel(loginForm.ServerIP, loginForm.Port, dockPanel1);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Beispiel #3
0
        //private void OnInSocketAcceptForPolicy(IAsyncResult result)
        //{
        //    try
        //    {
        //        Socket flashSocket = policySocket.EndAccept(result);

        //        policySocket.BeginAccept(new AsyncCallback(OnInSocketAcceptForPolicy), null);

        //        while (flashSocket.Available == 0)
        //        {
        //        }

        //        while (flashSocket.Available != 0)
        //        {
        //            flashSocket.Receive(dummyBuffer);
        //        }

        //        int sendLen = 0;

        //        while (sendLen < policyBuffer.Length)
        //        {
        //            sendLen += flashSocket.Send(policyBuffer, sendLen, policyBuffer.Length - sendLen, SocketFlags.None);
        //        }

        //        flashSocket.Close();
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //    }
        //}

        private void OnInSocketAccept(IAsyncResult result)
        {
            ScriptPanel panel = (ScriptPanel)result.AsyncState;

            Socket inSocket = proxySocket.EndAccept(result);

            panel.SetInSocket(inSocket);

            EnableToolStripButton();
        }