public Boolean Connect(String host, String token, String displayName, String resourceId, IConnect _iIConnect) { _mIConnect = _iIConnect; _mOnSuccess = OnSuccessDelegate; _mOnFailure = OnFailureDelegate; _mOnDisconnected = OnDisconnectedDelegate; Boolean ret = VidyoGatewayConnectNative(objPtr, host, token, displayName, resourceId, _mOnSuccess, _mOnFailure, _mOnDisconnected); return(ret); }
public LobbyHub(IConfiguration configuration, IConnect connectionInstance, ILogger <LobbyHub> logger) { _configuration = configuration; _connectionInstance = connectionInstance; _logger = logger; _connectionInstance.Disconnect += _connectionInstance_Disconnect; _connectionInstance.SuccessfullRegister += _connectionInstance_SuccessfullRegister; ConnectToHub().RunSynchronously(); }
public BaseTaskHandlerService(IConnect connectionInstance) { _connectionInstance = connectionInstance; _taskQueue = new Queue <CombinedTask>(); _currentTasks = new List <DNet_DataContracts.Processing.Task>(); _connectionInstance.TaskRecieve += TaskRecieve; _connectionInstance.ResultRecieve += ResultRecieve; //TaskRecieve += TaskRecieved; //ResultRecieve += BaseTaskHandlerService_ResultRecieve; }
protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { this.Collection = null; this.Connect = null; } this.disposed = true; } }
public ItemWithNonFakeableCtorParameters2(IConnect connection, ICommand command, IConnect connection2, int number, int number2, DateTime date, Func <int, bool> condition) { this.connection2 = connection2; this.connection = connection; this.command = command; this.number = number; this.number2 = number2; this.date = date; this.condition = condition; }
private void Backgroundproccess_DoWork(object sender, DoWorkEventArgs e) //процедура фонового процесса (обращение к прибору) { //var cn=(IConnect)e.Argument; IConnect cnct = setting.NewConnect(); //if (cn!=null) cnct.Mode = cn.Mode; //if (cn != null) cnct.Address = cn.Address; //(Connect)e.Argument; if (cnct.Connection() == "Error") { MessageBox.Show("Ошибка подключения к прибору"); } for (long i = 0; !backgroundproccess.CancellationPending; i++) { while (true) { string str_f = cnct.MeasFreq(); if (str_f == "VCH_Error_NotEnoughPhaseData") { continue; } double f = Conversion.Val(str_f.Replace(",", ".")); const int f0 = 5000000; double f_new = 0; string time_string = ""; if (cnct.Type == "ConnectVCH308") { time_string = DateTime.Now.ToString(); f_new = f; backgroundproccess.ReportProgress((int)i, f_new);//возвращаем частоту } else { //time_last = DateTime.Now; time_string = DateTime.Now.ToString(); f_new = (f0 - f) / f0; backgroundproccess.ReportProgress((int)i, f_new);//возвращаем частоту } if (backgroundproccess.CancellationPending) { cnct.CloseSession(); break; } } } }
public void AddConnection(Guid id, IConnect connectChannel, IMessage messageChannel) { lock (_connectionsLock) { var connection = new Connection() { Id = id, ConnectChannel = connectChannel, MessageChannel = messageChannel }; _connections.Add(id, connection); } }
private static string CreateLink(this IConnect connect, string operationName, IResponseSettings?responseSettings, string?parameters = null) { responseSettings ??= WhatsAppResponseSettings.Default; StringBuilder stringBuilder = new(); stringBuilder.Append( responseSettings.TypeProtocol switch { Protocol.Http => "http://", Protocol.Https => "https://", _ => throw new ArgumentOutOfRangeException() });
private static void ConnectProvider_Supply(IConnect obj) { var result = obj.Connect("127.0.0.1", 12345); result.OnValue += val => { if(val) { Console.WriteLine("連線成功"); } else { Console.WriteLine("連線失敗"); Program._Enable = false; } }; }
/// <summary/> public static IChatApiResponse <TClass?> Post <TClass>(this IConnect connect, string operationName, Func <string, TClass> deserialization, string?json = null, IResponseSettings?responseSettings = null) where TClass : class, IErrorResponse, new() { string link = connect.CreateLink(operationName, responseSettings); IChatApiResponse <TClass?> chatApiResponse = ChatApiResponse <TClass?> .CreateInstance(() => { using var client = new WebClient().CreateHeaders(); string response = client .UploadString(link, "POST", json ?? string.Empty); return(deserialization(response)); }); return(chatApiResponse); }
/// <summary/> public static Task <IChatApiResponse <TInterface?> > GetAsync <TInterface>(this IConnect connect, string operationName, Func <string, TInterface> deserialization, IResponseSettings?responseSettings = null, string?parameters = null) { string link = connect.CreateLink(operationName, responseSettings, parameters); Task <IChatApiResponse <TInterface?> > whatsAppResponseAsync = ChatApiResponse <TInterface?> .CreateInstanceAsync(() => { using var client = new WebClient().CreateHeaders(); Task <string> response = client.DownloadStringTaskAsync(link); return(response); }, deserialization); return(whatsAppResponseAsync); }
public VersionMongoRepository(IConnect connect, string collectionName = null, ISnapshotFreqPolicy snapshotFreqPolicy = null) { this.Connect = connect; if (string.IsNullOrEmpty(collectionName)) { CollectionNameAttribute mongoCollectionName = (CollectionNameAttribute)typeof(T).GetTypeInfo().GetCustomAttribute(typeof(CollectionNameAttribute)); this.CollectionName = (mongoCollectionName != null ? mongoCollectionName.Name : typeof(T).Name.ToLower()); mongoCollectionName = null; } else { this.CollectionName = collectionName; } this.OriginalCollection = this.Connect.Collection <T>(this.CollectionName); this.SnapshotFreqPolicy = snapshotFreqPolicy ?? new SnapshotFreqPolicy.MonthSnapshot(); }
/// <summary/> public static Task <IChatApiResponse <TInterface?> > PostAsync <TInterface>(this IConnect connect, string operationName, Func <string, TInterface> deserialization, string?json = null, IResponseSettings?responseSettings = null) { string link = connect.CreateLink(operationName, responseSettings); Task <IChatApiResponse <TInterface?> > whatsAppResponseAsync = ChatApiResponse <TInterface?> .CreateInstanceAsync(() => { using var client = new WebClient().CreateHeaders(); Task <string> continueWith = client.UploadStringTaskAsync(link, "POST", json ?? string.Empty); return(continueWith); }, deserialization); return(whatsAppResponseAsync); }
/// <summary/> public static IChatApiResponse <TClass?> Get <TClass>(this IConnect connect, string operationName, Func <string, TClass> deserialization, IResponseSettings?responseSettings = null, string?parameters = null) where TClass : class, IErrorResponse, new() { string link = connect.CreateLink(operationName, responseSettings, parameters); IChatApiResponse <TClass?> chatApiResponse = ChatApiResponse <TClass?> .CreateInstance(() => { using var client = new WebClient().CreateHeaders(); string response = client.DownloadString(link); return(deserialization(response)); }); return(chatApiResponse); }
private void ChooseFreqMeter_SelectedIndexChanged(object sender, EventArgs e) { if (ChooseFreqMeter.Text == "CNT-90/CNT-91") { cnct = new ConnectCNT90(); } if (ChooseFreqMeter.Text == "VCH308A") { cnct = new ConnectVCH308(); } if (ChooseFreqMeter.Text == "Виртуальный прибор") { cnct = new ConnectVCH308(); } }
protected virtual async Task <LogResponse> LogoutAsync(IConnect helper) { LogResponse res = new LogResponse(true, "注销成功"); if (helper != null) { var r = await helper.LogoutAsync(); if (!r.Succeed) { res = r; } } await RefreshAsync(helper); return(res); }
private void Form1_Load(object sender, EventArgs e) { string url = @"http://172.20.10.2:8080"; string hubName = "BroadCastHub"; size = bounds.Size; height = bounds.Height; width = bounds.Width; userID = textBox1.Text; conObj = new Connect(this); conObj.Connection(url, hubName); conn = conObj.conn; hub = conObj.hub; conObj.HubOnBool("StartBroadcast"); textBox2.Text = conn.ConnectionId; }
private void Btn_openConnect(object sender, RoutedEventArgs e) { if (IsConnected) { if (iConnectType != null) { iConnectType.CloseConnect(); } IsConnected = false; return; } string strProtocol = cmbProtocolType.Text; string strIPAddress = cmbIpAddress.Text; switch (strProtocol) { case "UDP": iConnectType = new UDPConnect(strIPAddress, Port); break; case "Ping": iConnectType = new PingTest(strIPAddress); break; default: iConnectType = new UDPConnect(strIPAddress, Port); break; } iConnectType.GetRcvBufferEvent += DisPlayDataAsync; if (iConnectType.OpenConnect()) { IsConnected = true; } else { IsConnected = false; return; } }
public Boolean Connect(String host, String token, String displayName, String resourceId, IConnect _iIConnect) { _mIConnect = _iIConnect; _mOnSuccess = OnSuccessDelegate; _mOnFailure = OnFailureDelegate; _mOnDisconnected = OnDisconnectedDelegate; IntPtr nHost = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(host ?? string.Empty); IntPtr nToken = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(token ?? string.Empty); IntPtr nDisplayName = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(displayName ?? string.Empty); IntPtr nResourceId = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(resourceId ?? string.Empty); Boolean ret = VidyoGatewayConnectNative(objPtr, nHost, nToken, nDisplayName, nResourceId, _mOnSuccess, _mOnFailure, _mOnDisconnected); Marshal.FreeHGlobal(nResourceId); Marshal.FreeHGlobal(nDisplayName); Marshal.FreeHGlobal(nToken); Marshal.FreeHGlobal(nHost); return(ret); }
protected virtual async Task <LogResponse> RefreshAsync(IConnect helper) { FluxUser user = default; if (helper != null) { user = await helper.GetFluxAsync(); } OnlineUser = user; var remainFlux = FluxHelper.GetMaxFlux(OnlineUser.Flux, OnlineUser.Balance) - OnlineUser.Flux; if (Settings.EnableFluxLimit && remainFlux < Settings.FluxLimit) { return(new LogResponse(false, $"流量仅剩余{remainFlux}")); } else { return(new LogResponse(true, string.Empty)); } }
protected virtual async Task <LogResponse> LoginAsync(IConnect helper) { LogResponse res = new LogResponse(true, "登录成功"); if (helper != null) { if (Settings.EnableRelogin) { await helper.LogoutAsync(); } var r = await helper.LoginAsync(); if (!r.Succeed) { res = r; } } await RefreshAsync(helper); return(res); }
private void button1_Click(object sender, EventArgs e) { string result = "False"; conexion conn = new conexion(); switch (driver.SelectedItem.ToString()) { case "Teradata": newConnection = new teradata(); conn = newConnection.makeConnect(usuario.Text, password.Text, "Teradata", host.Text, puerto.Text, service.Text, nombre.Text); result = newConnection.testConnection().ToString(); break; case "Oracle": newConnection = new oracle(); conn = newConnection.makeConnect(usuario.Text, password.Text, "Oracle", host.Text, puerto.Text, service.Text, nombre.Text); result = newConnection.testConnection().ToString(); break; case "SQL Server": newConnection = new mssql(); conn = newConnection.makeConnect(usuario.Text, password.Text, "MsSql", host.Text, puerto.Text, service.Text, nombre.Text); result = newConnection.testConnection().ToString(); break; } if (result == "True") { this.Close(); } else { MessageBox.Show("Se presento un error en la conexion"); } }
private void btnConnect_Click(object sender, EventArgs e) { int dbType = 0; if (rbtnMySql.Checked) { connect = new MySqlConnectHelper(); } else if (rbtnMsSql.Checked) { dbType = 1; connect = new MsSqlConnectHelper(); } else if (rbtnSqlite.Checked) { dbType = 2; connect = null; } try { this.server = this.txtServer.Text; this.name = this.txtName.Text; this.pwd = this.txtPwd.Text; this.port = int.Parse(this.txtPort.Text); var list = connect.GetDbList(this.server, this.name, this.pwd, port); SetDbList(lstDBs, list); PageCache.SetServer(this.server, this.name, this.pwd, this.port); PageCache.SetDbType(dbType); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ItemWithNonFakeableCtorParameters(IConnect connection, ICommand command, SomeOtherType other) { this.connection = connection; this.command = command; this.other = other; }
public ItemToCreate(IConnect connection, ICommand command) { this.connection = connection; this.command = command; }
public SomethingWithParameterfulConstructors(IConnect connection) : this(connection, null) { }
public item_with_dependencies_in_ctor_in_fields_and_in_properties(IConnect connection) { this.connection = connection; }
/// <summary> /// The _ connect. /// </summary> /// <param name="obj"> /// The obj. /// </param> private void _Connect(IConnect obj) { _Provider.Supply -= _Connect; obj.Connect(_Ip, _Port).OnValue += _Result; }
public SomeClassWithDependencies(IConnect connection, ICommand command) { this.connection = connection; this.command = command; }
private void _Provider_Supply(IConnect obj) { obj.Connect(_Ip, _Port).OnValue += _Result; }
public static void Inititialize(IConnect connect) { _connect = connect; }
public static void Inititialize(IConfiguration configuration) { _connect = new ConnectClient(configuration); }
private void _Connect(IConnect obj) { var result = obj.Connect(this._IpAddress, this._Port); result.OnValue += val => { this.OnDoneEvent(val); }; }
private void _Connect(IConnect obj) { _Con = obj; _ConnectResult(_Con.Connect(_IPAddress, _Port)); }
public SQLValidateConnection(IConnect otherConnection) : base(otherConnection) { this.otherConnection = otherConnection; }
public FriendRepository(IConnect connect) : base(connect) { }
protected ConectionValidate(IConnect otherConnection) { this.otherConnection = otherConnection; }
public UserRepositoryAbstract(IConnect connect) : base(connect) { }
public CustomPersistedGrantRepository(IConnect connect) : base(connect) { }
public SomethingWithParameterfulConstructors(IConnect connection, ICommand command) { this.connection = connection; this.command = command; }