コード例 #1
0
        internal void DisconnectClient(string id)
        {
            //Tell the client to disconnect

            ClearTabs(id);
            ClearGridData(id);
            MessageHub.Hub.Clients.Client(id).Disconnect();

            try {
                Application.Current.Dispatcher.Invoke((Action) delegate {
                    // The client control for the disconnecting
                    ClientControl client = clientControls.Values.FirstOrDefault <ClientControl>(x => x.ConnectionID == id);
                    //Remove it from the list of execution nodes.
                    View.clientControlStack.Children.Remove(client);
                    View.OnPropertyChanged("NumConnectedClients");

                    //Remove any entries from the messaging grid
                    IEnumerable <ExecutionRecordClass> query = View.RecordsCollection.ToList <ExecutionRecordClass>().Where(rec => rec.ConnectionID == id);
                    foreach (ExecutionRecordClass x in query)
                    {
                        View.RecordsCollection.Remove(x);
                    }

                    MessageHub.Hub.Clients.All.Refresh();
                    View.VisibleDataGrid?.Items?.Refresh();
                });
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
        public ConnectionUDP(Route route, string dstHost, int dstPort,
                             int mode, int connectId, ClientControl clientControl)
        {
            MyClientControl = clientControl;
            MyRoute = route;
            DstHost = dstHost;
            DstPort = dstPort;
            Mode = mode;
            ConnectId = connectId;

            try
            {
                MySender = new Sender(this);
                MyRecevier = new Receiver(this);
                Uos = new UDPOutputStream(this);
                Uis = new UDPInputStream(this);
                /*
                if (mode == 2)
                {
                    route.CreateTunnelProcessor().Process(this);
                }
                */
            }
            catch (Exception e)
            {
                _connected = false;
                route.ConnTable.Remove(connectId);

                lock (this)
                {
                    Monitor.PulseAll(this);
                }
                throw (e);
            }
        }
コード例 #3
0
ファイル: friendsForm.cs プロジェクト: ratt1er/JIM
 public friendsForm(string _key, string _username, ClientControl _client)
 {
     client   = _client;
     key      = _key;
     username = _username;
     InitializeComponent();
 }
コード例 #4
0
        private void Start()
        {
            try
            {
                label_runStatus.Text = "运行中...";
                button_Start.Enabled = false;
                _clientControl       = new ClientControl(10801, 10802);
                LogUtil.callback    += msgCallback;

                (AssemblyHandler.GetInstance <CloseApp>() as CloseApp).callback   += HideWindow;
                (AssemblyHandler.GetInstance <Uninstall>() as Uninstall).callback += Quit;
                //(AssemblyHandler.GetInstance<Uninstall>() as Uninstall).localUrl = Application.ExecutablePath;

                _clientControl.BeginReceive();

                //创建自启快捷方式
                //ToolForCmd.CreateShortcut();
            }
            catch (Exception e)
            {
                LogUtil.Error(e);
                label_runStatus.Text = "error!!";
                Stop();
            }
        }
コード例 #5
0
        protected void doConnect()
        {
            MsRdpClient8NotSafeForScripting rdp;

            rdp          = (MsRdpClient8NotSafeForScripting)ClientControl.GetOcx();
            rdp.Server   = _connectionConfig.ServerName;
            rdp.UserName = _connectionConfig.UserName;
            rdp.AdvancedSettings8.ClearTextPassword      = _connectionConfig.Password;
            rdp.AdvancedSettings8.AuthenticationLevel    = 2;
            rdp.AdvancedSettings8.EnableCredSspSupport   = true;
            rdp.AdvancedSettings8.NegotiateSecurityLayer = false;
            //rdp.AdvancedSettings8.SmartSizing = FitToWindow;
            rdp.AdvancedSettings8.ContainerHandledFullScreen = -1;
            //rdp.AdvancedSettings8.AudioCaptureRedirectionMode
            //rdp.AdvancedSettings8.
            //rdp.AdvancedSettings8.RelativeMouseMode
            //rdp.AdvancedSettings8.RedirectDrives = true;
            FullScreen = _connectionConfig.FullScreen;
            //rdp.FullScreen = _connectionConfig.FullScreen;
            rdp.DesktopHeight = _connectionConfig.DisplayHeight;
            rdp.DesktopWidth  = _connectionConfig.DisplayWidth;
            SetClientWindowSize(_connectionConfig.DisplayWidth, _connectionConfig.DisplayHeight);
            rdp.ColorDepth = _connectionConfig.ColorDepth;
            ClientControl.Connect();
        }
コード例 #6
0
 private void frmRDPWindow_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (ClientControl.Connected > 0)
     {
         ClientControl.Disconnect();
     }
 }
コード例 #7
0
        public void ClientConnectionInitiated(HubCallerContext context)
        {
            try {
                Application.Current.Dispatcher.Invoke((Action) delegate {
                    ClientControl client = new ClientControl(context.ConnectionId, MessageHub, this);
                    clientControls.Add(context.ConnectionId, client);
                    ClientTabControl tabControl = new ClientTabControl("PID Pending", this)
                    {
                        IsSummary = false, ConnectionID = context.ConnectionId
                    };
                    if (AutoAssignArchive != null)
                    {
                        tabControl.WorkPackage = AutoAssignArchive;
                    }
                    clientTabControls.Add(context.ConnectionId, tabControl);

                    View.AddClientControl(client);
                    View.AddClientTab(tabControl);
                });
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }

            MessageHub.Hub.Clients.Client(context.ConnectionId).Interrogate();

            if (AutoAssignArchive != null)
            {
                MessageHub.Hub.Clients.Client(context.ConnectionId).RetrieveArchive(WebServerURL + "/" + AutoAssignArchive);
            }
        }
コード例 #8
0
 public MatchingParameters(string application, string platform, ClientControl control, UserAgentParser.UserAgentVersion version)
 {
     this.Application = application;
     this.Platform    = platform;
     this.Control     = control;
     this.Version     = version;
 }
コード例 #9
0
        public void init(ClientControl cs)
        {
            enable = true;
            Thread t = new Thread(() => { updateServer(cs); });

            t.IsBackground = true;
            t.Start();
        }
コード例 #10
0
 public MainForm(string key, string _username, ClientControl _client)
 {
     InitializeComponent();
     client    = _client;
     username  = _username;
     this.Text = key;
     this.key  = key;
 }
コード例 #11
0
        public Sources(ClientControl clientControl)
        {
            _clientControl = clientControl;

            InitializeComponent();

            itmsSource.ItemsSource = ClientConfiguration.Current.Sources;
        }
コード例 #12
0
        public MainWindow(ClientControl clientControl, ServerControl serverControl)
        {
            InitializeComponent();
            DataContext = _viewModel;

            ClientContentControl.Content = clientControl;
            ServerContentControl.Content = serverControl;
        }
コード例 #13
0
 private void materialRaisedButton1_Click_1(object sender, EventArgs e)
 {
     client = new ClientControl();
     client.Connet(ipTb.Text, int.Parse(portTb.Text));
     threadAccept = new Thread(Accept);
     threadAccept.IsBackground = true;
     threadAccept.Start();
     loginAccountTb.Focus();
 }
コード例 #14
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     client = new ClientControl();
     client.Connet(ipTb.Text, int.Parse(portTb.Text));
     threadAccept = new Thread(Accept);
     threadAccept.IsBackground = true;
     threadAccept.Start();
     loginAccountTb.Focus();
     //materialLabel3.Text = "本地IP地址:" + DSAPI.网络.本机外网IP和所在地().IP;
 }
コード例 #15
0
        public override void HandleInput()
        {
            if (tank == null)
            {
                return;
            }

            ClientControl control = (ClientControl)tank.Control;

            control.Mouse = camera.UnProject(Input.GetMousePosition());
        }
コード例 #16
0
        public Home(ClientControl clientControl)
        {
            _clientControl = clientControl;

            LostFocus += Home_LostFocus;
            GotFocus  += Home_GotFocus;
            Loaded    += Home_Loaded;
            Unloaded  += Home_Unloaded;

            InitializeComponent();
        }
コード例 #17
0
 public void SetCompletionReport(string executionNodeID, CompletionReport report, HubCallerContext context)
 {
     Application.Current.Dispatcher.Invoke(delegate {
         if (clientTabControls.ContainsKey(context.ConnectionId))
         {
             ClientTabControl client = clientTabControls[context.ConnectionId];
             client.SetCompletionReportText(report);
             ClientControl client2    = clientControls[context.ConnectionId];
             client2.iterationRecords = report;
         }
     });
 }
コード例 #18
0
 public void Connection() //连接服务器
 {
     client = new ClientControl();
     try
     {
         client.ConnectionServer("192.168.1.171", 16383, GetSelfData()); //连接服务器,初始化数据
     }
     catch
     {
         Debug.Log("该服务器未运行");
     }
 }
コード例 #19
0
        public AddPipeline(ClientControl clientControl)
        {
            _clientControl = clientControl;

            InitializeComponent();

            cboCollectionURL.ItemsSource = ClientConfiguration.Current.Sources;
            cboTemplate.ItemsSource      = ClientConfiguration.Current.ClientInfo.Templates;

            cboTemplate.SelectedValue = "Blank";

            this.Loaded += AddEditSource_Loaded;
        }
コード例 #20
0
 public ClientControl GetClientControl(int clientId, string dstHost, int dstPort)
 {
     ClientControl clientControl = ClientTable[clientId];
     if (clientControl == null)
     {
         clientControl = new ClientControl(MyRoute, clientId, dstHost, dstPort);
         
         lock (SynClientTable)
         {
             ClientTable.Add(clientId, clientControl);
         }
     }
     return clientControl;
 }
コード例 #21
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var ipAddress = ConfigurationManager.AppSettings["ipaddress"];
            var port      = int.Parse(ConfigurationManager.AppSettings["port"]);

            var clientControl = new ClientControl(new TheClient(ipAddress, port), new ClientControlViewModel {
                IpAddress = ipAddress, Port = port
            });
            var serverControl = new ServerControl(new Server(ipAddress, port), new ServerControlViewModel {
                IpAddress = ipAddress, Port = port
            });
            var mainWindow = new MainWindow(clientControl, serverControl);

            MainWindow.ShowDialog();
        }
コード例 #22
0
 public void Disconnect(HubCallerContext context)
 {
     if (clientControls.ContainsKey(context.ConnectionId))
     {
         ClientControl client = clientControls[context.ConnectionId];
         clientControls.Remove(context.ConnectionId);
         Application.Current.Dispatcher.Invoke(delegate {
             try {
                 View.RemoveClientControl(client);
                 View.RemoveClientTab(client.ConnectionID);
             } catch (Exception ex) {
                 Debug.WriteLine("Removing Client Error. " + ex.Message);
             }
         });
     }
 }
コード例 #23
0
 internal bool FindMatchingRange(string application, string platform, ClientControl control, UserAgentParser.UserAgentVersion minVersion, out int firstMatch, out int lastMatch)
 {
     firstMatch = 0;
     lastMatch  = this.Count - 1;
     if (this.Count == 0)
     {
         return(false);
     }
     ClientMappingList.MatchingParameters parameters = new ClientMappingList.MatchingParameters(application, platform, control, minVersion);
     for (ClientMappingList.ClientAttribute clientAttribute = ClientMappingList.ClientAttribute.First; clientAttribute < ClientMappingList.ClientAttribute.Last; clientAttribute++)
     {
         if (!this.MatchClientAttribute(ref firstMatch, ref lastMatch, clientAttribute, parameters))
         {
             return(false);
         }
     }
     return(this.MatchClientMinimumVersion(firstMatch, ref lastMatch, parameters));
 }
コード例 #24
0
ファイル: UserReport.ascx.cs プロジェクト: alex765022/IBN
        private void BindClients()
        {
            ClientControl.DataValueField = "ClientId";
            ClientControl.DataTextField  = "ClientName";
            ClientControl.DataSource     = BusReport.GetClientsByUser(GetFromDate(), GetToDate(), UserControl.Value);
            ClientControl.DataBind();

            if (ClientControl.Items.Count > 0)
            {
                ClientControl.Value = new string[] { "0" }
            }
            ;                                                                   // any
            else
            {
                ClientControl.Value = new string[] { }
            };                                                          // not set

            BindProjectGroups();
        }
コード例 #25
0
        public AddEditSource(ClientControl clientControl, ClientCollectionSource source)
        {
            _clientControl = clientControl;

            DataContext = source;

            InitializeComponent();

            if (ClientConfiguration.Current.Sources.Contains(source))
            {
                btnRemove.Visibility = Visibility.Visible;
            }

            this.KeyUp += AddEditSource_KeyUp;

            this.Loaded += AddEditSource_Loaded;

            txtCollectionURL.SelectAll();
        }
コード例 #26
0
        public void SetExecutionNodeStatus(string executionNodeID, string message, HubCallerContext context)
        {
            if (message != ClientState.UpdateAfterCompletion.Value)
            {
                Application.Current.Dispatcher.Invoke(delegate {
                    if (clientControls.ContainsKey(context.ConnectionId))
                    {
                        ClientControl client = clientControls[context.ConnectionId];
                        client.SetStatusText(message);
                    }
                });
            }

            if (message == ClientState.Assigned.Value && View.AutoExecute)
            {
                clientControls[context.ConnectionId].PercentComplete = 0;
                MessageHub.Hub.Clients.Client(context.ConnectionId).ClearAndPrepare();
            }

            if (message == ClientState.Ready.Value && View.AutoExecute)
            {
                SetRefreshRate(gridRefreshRate);
                clientControls[context.ConnectionId].PercentComplete = 0;
                MessageHub.Hub.Clients.Client(context.ConnectionId).Execute();
            }

            if (message == ClientState.Executing.Value)
            {
                clientControls[context.ConnectionId].StartUpdateTimer();
            }

            if (message == ClientState.UnAssigned.Value)
            {
                clientControls[context.ConnectionId].PercentComplete = 0;
            }

            if (message == ClientState.ExecutionComplete.Value || message == ClientState.Stopped.Value || message == ClientState.UpdateAfterCompletion.Value)
            {
                clientControls[context.ConnectionId].Stop();
                MessageHub.Hub.Clients.Client(context.ConnectionId).CompletionReport();
            }
        }
コード例 #27
0
        public void LoadControl()
        {
            try
            {
                ClientControl control = new ClientControl(this);
                control.Dock = System.Windows.Forms.DockStyle.Fill;


                Dock      = new DockContent();
                Dock.Text = AccountName;
                Dock.Controls.Add(control);
                Control = control;

                ((MainForm)WindowManager.MainWindow).Invoke((MethodInvoker) delegate { Dock.Show(((MainForm)WindowManager.MainWindow).DockPanel_Main, DockState.Document); });
            }
            catch (Exception ex)
            {
                WindowManager.MainWindow.Logger.Error("[LoadControl] " + ex.Message);
            }
        }
コード例 #28
0
        public IEnumerable <ScriptDescriptor> GetScriptDescriptors()
        {
            var control = new ClientControl();
            var res     = new List <ScriptDescriptor>();

            foreach (var extenderControl in _extenderControls)
            {
                if (extenderControl.Third != null && (!extenderControl.Third.Visible || IsExcluded(extenderControl.Third)))
                {
                    continue;
                }

                if (extenderControl.Second == null)
                {
                    /*if (!string.IsNullOrEmpty(extenderControl.First.TargetControlID))
                     * {
                     *  var enumerable = ((IExtenderControl)extenderControl.First).GetScriptDescriptors(control);
                     *  if (enumerable != null) res.AddRange(enumerable);
                     *  continue;
                     * }*/
                    var clientArgs = new ClientArgs();
                    OnRetriveClientID(clientArgs);
                    extenderControl.Second = clientArgs.ClientIDs;
                }
                var id = extenderControl.First.ID;
                extenderControl.First.Page = Page;
                extenderControl.First.SetTargetControl(this);
                foreach (var clientID in extenderControl.Second)
                {
                    control.SetClientID(clientID);
                    extenderControl.First.ID = id + clientID;
                    var enumerable = ((IExtenderControl)extenderControl.First).GetScriptDescriptors(control);
                    if (enumerable != null)
                    {
                        res.AddRange(enumerable);
                    }
                }
            }
            return(res);
        }
コード例 #29
0
        internal void DisconnectAll()
        {
            MessageBoxResult res = MessageBox.Show($"Do you really want to disconnect and shutdown all the connected clients?", "Disconnet Client", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (res != MessageBoxResult.Yes)
            {
                return;
            }

            ClearTabs();
            ClearGridData();

            MessageHub.Hub.Clients.All.Disconnect();
            try {
                Application.Current.Dispatcher.Invoke((Action) delegate {
                    SelectedClient = null;
                    View.RecordsCollection.Clear();
                });
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #30
0
        private void updateServer(ClientControl clControl)
        {
            if (clControl != null)
            {
                LogUtil.Debug("启动心跳检测");
                while (enable)
                {
                    if (clControl.IsConnected())
                    {
                        serverHeart.activeTime = DateTime.Now;
                        if ((int)serverHeart.getTimeinterval() >= lossTime)
                        {
                            serverHeart.lostCount++;
                            LogUtil.DebugFormat("服务端 [{0}] 丢包次数:{1} 尝试重新连接", serverHeart.ipEndPoint, serverHeart.lostCount);
                            clControl.connect();
                        }

                        if (serverHeart.lostCount >= lostCount)
                        {
                            clControl.removeServer();
                            LogUtil.InfoFormat("服务器 [{0}] 已断开!!", serverHeart.ipEndPoint);
                            if (clControl.msgCallback != null)
                            {
                                clControl.msgCallback(string.Format("服务器 [{0}] 已断开!!", serverHeart.ipEndPoint));
                            }
                        }
                    }
                    else
                    {
                        clControl.connect();
                    }

                    clControl.SendToServer(OrderCode.HeartBeat);

                    Thread.Sleep(waitTime);
                }
            }
        }
コード例 #31
0
 public ApprovalControl(ClientControl client)
     : base(client)
 {
 }
コード例 #32
0
        // Token: 0x06000988 RID: 2440 RVA: 0x0004348C File Offset: 0x0004168C
        public Experience[] LookupExperiences(string application, UserAgentParser.UserAgentVersion version, string platform, ClientControl control)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug((long)this.GetHashCode(), "FormsRegistry.LookupExperiences application = {0}, version = {1}, platform = {2}, control = {3}", new object[]
            {
                application,
                version,
                platform,
                control
            });
            Hashtable hashtable = new Hashtable(1);
            ArrayList arrayList = new ArrayList(1);

            FormsRegistry.LookupExperienceState lookupExperienceState = FormsRegistry.LookupExperienceState.ExactMatch;
            while (FormsRegistry.LookupExperienceState.Done != lookupExperienceState)
            {
                switch (lookupExperienceState)
                {
                case FormsRegistry.LookupExperienceState.ExactMatch:
                    lookupExperienceState = FormsRegistry.LookupExperienceState.Control;
                    break;

                case FormsRegistry.LookupExperienceState.Control:
                    lookupExperienceState = FormsRegistry.LookupExperienceState.Platform;
                    if (control == ClientControl.None)
                    {
                        continue;
                    }
                    control = ClientControl.None;
                    break;

                case FormsRegistry.LookupExperienceState.Platform:
                    lookupExperienceState = FormsRegistry.LookupExperienceState.Application;
                    platform = string.Empty;
                    break;

                case FormsRegistry.LookupExperienceState.Application:
                    lookupExperienceState = FormsRegistry.LookupExperienceState.Done;
                    application           = string.Empty;
                    break;
                }
                int i;
                int num;
                if (this.clientMappingList.FindMatchingRange(application, platform, control, version, out i, out num))
                {
                    while (i <= num)
                    {
                        ClientMapping clientMapping = this.clientMappingList[num];
                        Experience    experience    = clientMapping.Experience;
                        if (!hashtable.ContainsKey(experience))
                        {
                            ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <string, ClientMapping>((long)this.GetHashCode(), "Matched experience. name = {0}, client mapping = ({1})", experience.Name, clientMapping);
                            hashtable.Add(experience, string.Empty);
                            arrayList.Add(experience);
                        }
                        num--;
                    }
                }
            }
            ExTraceGlobals.FormsRegistryTracer.TraceDebug <int>((long)this.GetHashCode(), "FormsRegistry.LookupExperiences - Exit.  Matched {0} Experiences", arrayList.Count);
            return((Experience[])arrayList.ToArray(typeof(Experience)));
        }
コード例 #33
0
ファイル: ClientModel.cs プロジェクト: cjohnsbrown/FTP-Client
	public ClientModel(Proxy p) {
		proxy = p;
		controller = new ClientControl(this);
    		
	}