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); } }
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); } }
public friendsForm(string _key, string _username, ClientControl _client) { client = _client; key = _key; username = _username; InitializeComponent(); }
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(); } }
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(); }
private void frmRDPWindow_FormClosed(object sender, FormClosedEventArgs e) { if (ClientControl.Connected > 0) { ClientControl.Disconnect(); } }
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); } }
public MatchingParameters(string application, string platform, ClientControl control, UserAgentParser.UserAgentVersion version) { this.Application = application; this.Platform = platform; this.Control = control; this.Version = version; }
public void init(ClientControl cs) { enable = true; Thread t = new Thread(() => { updateServer(cs); }); t.IsBackground = true; t.Start(); }
public MainForm(string key, string _username, ClientControl _client) { InitializeComponent(); client = _client; username = _username; this.Text = key; this.key = key; }
public Sources(ClientControl clientControl) { _clientControl = clientControl; InitializeComponent(); itmsSource.ItemsSource = ClientConfiguration.Current.Sources; }
public MainWindow(ClientControl clientControl, ServerControl serverControl) { InitializeComponent(); DataContext = _viewModel; ClientContentControl.Content = clientControl; ServerContentControl.Content = serverControl; }
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(); }
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; }
public override void HandleInput() { if (tank == null) { return; } ClientControl control = (ClientControl)tank.Control; control.Mouse = camera.UnProject(Input.GetMousePosition()); }
public Home(ClientControl clientControl) { _clientControl = clientControl; LostFocus += Home_LostFocus; GotFocus += Home_GotFocus; Loaded += Home_Loaded; Unloaded += Home_Unloaded; InitializeComponent(); }
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; } }); }
public void Connection() //连接服务器 { client = new ClientControl(); try { client.ConnectionServer("192.168.1.171", 16383, GetSelfData()); //连接服务器,初始化数据 } catch { Debug.Log("该服务器未运行"); } }
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; }
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; }
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(); }
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); } }); } }
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)); }
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(); }
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(); }
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(); } }
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); } }
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); }
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); } }
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); } } }
public ApprovalControl(ClientControl client) : base(client) { }
// 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))); }
public ClientModel(Proxy p) { proxy = p; controller = new ClientControl(this); }