public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { if (deviceInfo == null) { deviceInfo = DependencyService.Get <IDeviceInfo>(); if (deviceInfo != null) { phoneSize = (deviceInfo.GetScreenSize().Width - 60) / 3; } } } catch { } switch (Device.Idiom) { case TargetIdiom.Tablet: return(phoneSize); case TargetIdiom.Phone: return(phoneSize); default: return(90); } }
public GitTrendsOnboardingPage(IDeviceInfo deviceInfo, IMainThread mainThread, IAnalyticsService analyticsService, MediaElementService mediaElementService) : base(OnboardingConstants.SkipText, deviceInfo, Color.FromHex(BaseTheme.LightTealColorHex), mainThread, 0, analyticsService, mediaElementService) { }
LdClient(Configuration configuration, User user) { Config = configuration; connectionLock = new SemaphoreSlim(1, 1); persister = Factory.CreatePersister(configuration); deviceInfo = Factory.CreateDeviceInfo(configuration); flagListenerManager = Factory.CreateFeatureFlagListenerManager(configuration); // If you pass in a null user or user with a null key, one will be assigned to them. if (user == null || user.Key == null) { User = UserWithUniqueKey(user); } else { User = user; } flagCacheManager = Factory.CreateFlagCacheManager(configuration, persister, flagListenerManager, User); connectionManager = Factory.CreateConnectionManager(configuration); updateProcessor = Factory.CreateUpdateProcessor(configuration, User, flagCacheManager); eventProcessor = Factory.CreateEventProcessor(configuration); SetupConnectionManager(); }
/// <summary> /// Initializes a new instance of the <see cref="JediMemoryRetrievalAgent" /> class. /// </summary> /// <param name="device">The device.</param> /// <param name="sessionId">The session ID.</param> /// <param name="memoryPools">The memory pools.</param> /// <param name="enterpriseTesting">if set to <c>true</c> [enterprise testing].</param> public JediMemoryRetrievalAgent(IDeviceInfo device, string sessionId, string memoryPools, bool enterpriseTesting) { _device = device; _sessionId = sessionId; _memoryPools = memoryPools; _enterpriseTesting = enterpriseTesting; }
private ICameraDevice GetWiaIDevice(IDeviceInfo devInfo) { // if camera already is connected do nothing if (_deviceEnumerator.GetByWiaId(devInfo.DeviceID) != null) { return(_deviceEnumerator.GetByWiaId(devInfo.DeviceID).CameraDevice); } _deviceEnumerator.RemoveDisconnected(); DeviceDescriptor descriptor = new DeviceDescriptor { WiaDeviceInfo = devInfo, WiaId = devInfo.DeviceID }; ICameraDevice cameraDevice = new WiaCameraDevice(); bool isConnected = cameraDevice.Init(descriptor); descriptor.CameraDevice = cameraDevice; _deviceEnumerator.Add(descriptor); ConnectedDevices.Add(cameraDevice); if (isConnected) { NewCameraConnected(cameraDevice); } //ServiceProvider.DeviceManager.SelectedCameraDevice.ReadDeviceProperties(0); return(SelectedCameraDevice); }
public void Setup() { _random = Substitute.For <IRandom>(); _defuserCounter = new DefuserCounter(); _deviceInfo = Substitute.For <IDeviceInfo>(); _allBombs = Substitute.For <AllBombs>(_random, new IBomb[0], _deviceInfo); }
/// <summary> /// Agrega la cabecera con los datos de la carga útil necesarios para autenticar a un usuario en el servicio Aspen. /// </summary> /// <param name="request">Solicitud a donde se agrega la cabecera.</param> /// <param name="jwtEncoder">Instancia del codificador del contenido de la carga útil.</param> /// <param name="apiSecret">Secreto de la aplicación que se utiliza para codificar el contenido del carga útil.</param> /// <param name="token">El token de autenticación emitido para el usuario.</param> /// <param name="username">La identificación del usuario autenticado.</param> /// <param name="device">La información asociada con el dispositivo del usuario.</param> public void AddSignedPayloadHeader( IRestRequest request, IJwtEncoder jwtEncoder, string apiSecret, string token, string username, IDeviceInfo device = null) { Throw.IfNull(request, nameof(request)); Throw.IfNull(jwtEncoder, nameof(jwtEncoder)); Throw.IfNullOrEmpty(apiSecret, nameof(apiSecret)); Throw.IfNullOrEmpty(token, nameof(token)); Throw.IfNullOrEmpty(username, nameof(username)); IDeviceInfo deviceInfo = device ?? CacheStore.Get <DeviceInfo>(CacheKeys.CurrentDevice) ?? DeviceInfo.Current; Dictionary <string, object> payload = new Dictionary <string, object>(); ServiceLocator.Instance.PayloadClaimsManager.AddNonceClaim(payload, ServiceLocator.Instance.NonceGenerator.GetNonce()); ServiceLocator.Instance.PayloadClaimsManager.AddEpochClaim(payload, ServiceLocator.Instance.EpochGenerator.GetSeconds()); ServiceLocator.Instance.PayloadClaimsManager.AddTokenClaim(payload, token); ServiceLocator.Instance.PayloadClaimsManager.AddUsernameClaim(payload, username); ServiceLocator.Instance.PayloadClaimsManager.AddDeviceIdClaim(payload, deviceInfo.DeviceId); string jwt = jwtEncoder.Encode(payload, apiSecret); request.AddHeader(ServiceLocator.Instance.RequestHeaderNames.PayloadHeaderName, jwt); }
public MainPage() { InitializeComponent(); IDeviceInfo deviceInfo = null; deviceId.Text = deviceInfo.GetDeviceId(); }
/// <summary> /// 更新设备树。 /// 设备树只有在登录的时候才更新 /// </summary> private void OnUpdateDeviceTree(IDeviceInfo info) { flag = true;//这里判断设备是不是登陆了 //此处界面以boardType,boardNo,channelType,channelCount来标识唯一性。 //core中bus,device等也应该包含这个几个属性,用它来标识唯一性 AbstractTreeNode parentNode = (AbstractTreeNode)_treeView.TopNode; string boardType = info.BoardType.ToString(); string boardNo = info.BoardNo.ToString(); string channelType = info.ChannelType.ToString(); string channelCount = info.ChannelCount.ToString(); //Bus级 if (!parentNode.Nodes.ContainsKey(boardType)) { AbstractTreeNode node = new TreeBusNode(boardType); parentNode.AddChildNode(node); } //Device 级 parentNode = (AbstractTreeNode)parentNode.Nodes[boardType]; if (!parentNode.Nodes.ContainsKey(boardNo)) { AbstractTreeNode node = new TreeDeviceNode(boardNo); parentNode.AddChildNode(node); } }
public IDevice Connect(IDeviceInfo deviceInfo) { MsHidDeviceInfo hidDeviceInfo = deviceInfo as MsHidDeviceInfo; if (hidDeviceInfo == null) { throw new ArgumentException("The specified DeviceInfo does not belong to this DeviceProvider.", "deviceInfo"); } ReportWiimote wiimote; if (!TryConnect(hidDeviceInfo, out wiimote)) { UseSetOutputReport = !UseSetOutputReport; if (!TryConnect(hidDeviceInfo, out wiimote)) { throw new DeviceConnectException("Both methods of connecting timed out."); } } wiimote.Disconnected += device_Disconnected; ConnectedDevices.Add(wiimote); MsHidDeviceProviderHelper.SetDevicePathConnected(hidDeviceInfo.DevicePath, true); OnDeviceConnected(new DeviceEventArgs(wiimote)); return(wiimote); }
public AllBombs(IRandom random, IBomb[] bombs, IDeviceInfo deviceInfo) { _random = random; _bombs = bombs .Where(bomb => bomb.Language == BombLanguage.None || bomb.Language == deviceInfo.GetDeviceBombLanguage()) .ToArray(); }
public override void Login(IDeviceInfo info) { if (BoardType == info.BoardType) { foreach (var component in ChildComponents) { IDeviceInfo device = (IDeviceInfo)component; if (device.BoardNo == info.BoardNo && device.BoardType == info.BoardType && device.ChannelCount == info.ChannelCount && device.ChannelType == info.ChannelType) { return; } } //建立设备前初始化 uint ret = ((Device429Operator)DriverOperate).DefaultInit(info.DevID); if (ret != 0) { RunningLog.Record(string.Format("return value is {0} when invoke ChannelSendTx", ret)); } //建立设备 Device429 dev = new Device429(); dev.InitializeParameter(info); Add(dev); dev.BuildModule(); dev.ReceiveModule.Start(); dev.SendModule.Start(); } }
public void Update(IDeviceInfo info) { if (UpdateUi != null) { UpdateUi(info); } }
/// <summary> /// Inicializa una nueva instancia de la clase <see cref="AspenRequest" />. /// </summary> /// <param name="appScope">Alcance de la aplicación solicitante.</param> /// <param name="url">URL del recurso solicitado.</param> /// <param name="method">Método o verbo HTTP para invocar el recurso.</param> /// <param name="deviceInfo">Información del dispositivo que envía la petición.</param> private AspenRequest(AppScope appScope, string url, Method method, IDeviceInfo deviceInfo) : base($"{(appScope == AppScope.Autonomous ? Routes.AutonomousRoot : Routes.DelegatedRoot)}{url}", method, DataFormat.Json) { Throw.IfNullOrEmpty(url, nameof(url)); const string ContentType = "application/json; charset=utf-8"; this.AddHeader("Accept", "application/json"); this.AddHeader("Content-Type", ContentType); this.Timeout = 15000; this.JsonSerializer = new RestSharp.Serialization.Json.JsonSerializer { ContentType = ContentType }; if (deviceInfo == null) { deviceInfo = CacheStore.GetDeviceInfo() ?? new DeviceInfo(); } switch (appScope) { case AppScope.Delegated: this.AddHeader("X-PRO-Request-DeviceInfo", deviceInfo.ToJson()); CacheStore.SetDeviceInfo(deviceInfo); break; case AppScope.Autonomous: break; default: throw new ArgumentOutOfRangeException(nameof(appScope), appScope, null); } }
public GatewayService(IDeviceInfo deviceInfo, IHttpService httpService, IRepositories repositories, IInfoService infoService, IMvxMessenger messenger) { _deviceInfo = deviceInfo; _httpService = httpService; _infoService = infoService; _messenger = messenger; string urlBase = "http://blueport.gateway.fleetwoodmobile.net:7090"; //TODO: read this from config or somewhere? _gatewayDeviceRequestUrl = urlBase + "/api/gateway/devicerequest"; _gatewayDeviceCreateUrl = urlBase + "/api/gateway/createdevice"; _gatewayConfigRequestUrl = urlBase + "/api/gateway/configrequest"; _gatewayLogMessageUrl = urlBase + "/api/gateway/logmessage"; _gatewayLicenceCheckUrl = urlBase + "/api/gateway/systemcheck"; //Local url, will need to change your own IP //_gatewayDeviceCreateUrl = "http://192.168.3.119:17337/api/gateway/createdevice"; //_gatewayDeviceRequestUrl = "http://192.168.3.119:17337/api/gateway/devicerequest"; //_gatewayLogMessageUrl = "http://192.168.3.119:17337/api/gateway/logmessage"; //_gatewayConfigRequestUrl = "http://192.168.3.119:17337/api/gateway/configrequest"; //_gatewayLicenceCheckUrl = "http://192.168.3.119:17337/api/gateway/systemcheck"; _deviceRepository = repositories.DeviceRepository; }
void ProcessWIAItem(IDeviceInfo deviceInfo, IItem item, string folder) { string name = _help.GetPropertyValue(item.Properties, WIAConst.ITEM_NAME); string ext = _help.GetPropertyValue(item.Properties, WIAConst.ITEM_FILENAME_EXT); int flags = Convert.ToInt32(_help.GetPropertyValue(item.Properties, WIAConst.ITEM_FLAGS)); if (string.IsNullOrEmpty(name)) { return; } if ((flags & 8192) == 8192) // <- item { WIAItem newItem = new WIAItem(deviceInfo, item.ItemID, folder + "\\" + name + "." + ext); this._list.Add(newItem); } if ((flags & 4) == 4) // <- folder { foreach (IItem subItem in item.Items) { ProcessWIAItem(deviceInfo, subItem, string.IsNullOrEmpty(folder) ? name : (folder + "\\" + name)); } } }
public ChartOnboardingPage(IDeviceInfo deviceInfo, IMainThread mainThread, IAnalyticsService analyticsService, MediaElementService mediaElementService) : base(OnboardingConstants.SkipText, deviceInfo, Color.FromHex(BaseTheme.CoralColorHex), mainThread, 1, analyticsService, mediaElementService) { }
HttpClientManager() { HttpClientAccessor = new DefaultHttpClientAccessor(); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain")); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/zip")); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Add("Authorization_Mobile", Conf.AUTHORIZATION_HEADER); // If running on a platform that is not supported by Xamarin.Essentials (for example if unit testing) IDeviceInfo deviceInfo = ServiceLocator.Current.GetInstance <IDeviceInfo>(); if (deviceInfo.Platform == DevicePlatform.Unknown) { HttpClientAccessor.HttpClient.DefaultRequestHeaders.Add("Manufacturer", "Unknown"); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Add("OSVersion", "Unknown"); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Add("OS", "Unknown"); } else { HttpClientAccessor.HttpClient.DefaultRequestHeaders.Add("Manufacturer", deviceInfo.Manufacturer); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Add("OSVersion", deviceInfo.VersionString); HttpClientAccessor.HttpClient.DefaultRequestHeaders.Add("OS", DeviceUtils.DeviceType); } HttpClientAccessor.HttpClient.MaxResponseContentBufferSize = 3000000; HttpClientAccessor.HttpClient.Timeout = TimeSpan.FromSeconds(Conf.DEFAULT_TIMEOUT_SERVICECALLS_SECONDS); }
public ItemsStack() { Content = _content = new StackLayout { Spacing = 0, Orientation = StackOrientation.Vertical }; _deviceInfo = DependencyService.Get <IDeviceInfo>(); }
/* open hid device */ public bool Open(IDeviceInfo dev) { /* safe file handle */ try { SafeFileHandle sHandle; /* opens hid device file */ handle = Native.CreateFile(dev.Path, Native.GENERIC_WRITE | Native.GENERIC_READ, Native.FILE_SHARE_READ | Native.FILE_SHARE_WRITE, IntPtr.Zero, Native.OPEN_EXISTING, Native.FILE_FLAG_OVERLAPPED, IntPtr.Zero); /* whops */ if (handle == Native.INVALID_HANDLE_VALUE) { return(false); } /* build up safe file handle */ sHandle = new SafeFileHandle(handle, false); /* prepare stream - async */ _fileStream = new FileStream(sHandle, FileAccess.ReadWrite, 32, true); /* report status */ return(true); } catch (Exception ex) { return(false); } }
public SignUpPageViewModel(IAccountService accountService, Func <int, ConfirmationCodeEntryViewModel> createConfirmationCodeEntryViewModel, IDataFlow dataFlow, IViewService viewService, Func <IPhoneService> phoneService, IDeviceInfo deviceInfo, IConnectivity connectivity, IAppInfo appInfo) { this.accountService = accountService; this.createConfirmationCodeEntryViewModel = createConfirmationCodeEntryViewModel; this.dataFlow = dataFlow; this.viewService = viewService; this.phoneService = phoneService; this.deviceInfo = deviceInfo; this.connectivity = connectivity; this.appInfo = appInfo; SignUpCommand = new XCommand(async() => await SignUp(), CanSignUp); BusinessName = new Property <string>("Buiness Name").RequiredString("Business Name is required"); FirstName = new Property <string>("First Name").RequiredString("First Name is required"); LastName = new Property <string>("Last Name").RequiredString("Last Name is required"); Country = new Property <CountryDetails>("Country").Required("Choose a country"); MobileNumber = new Property <string>("Mobile Number").RequiredString("Mobile Number is required").RequiredFormat(@"^(\d|\s|-)*$", "Please just enter digits"); EmailAddress = new Property <string>("Email Address").RequiredString("Email address is required"); SignUpCommand.SetDependency(this, FirstName, LastName, MobileNumber, EmailAddress); AllCountries = CountriesData.List.OrderBy(c => c.CountryName).ToArray(); var countryCode = GetCountryCode(); var country = AllCountries.SingleOrDefault(c => c.DialingCode == countryCode) ?? AllCountries.SingleOrDefault(c => c.CountryCode == "AU"); Country.InitializeValue(country); }
static void deviceProvider_DeviceFound(object sender, DeviceInfoEventArgs e) { IDeviceProvider deviceProvider = (IDeviceProvider)sender; Console.WriteLine("A device has been found."); IDeviceInfo foundDeviceInfo = e.DeviceInfo; IDevice device = deviceProvider.Connect(foundDeviceInfo); Console.WriteLine("Connected to the device."); device.Disconnected += device_Disconnected; if (device is IWiimote) { IWiimote wiimote = (IWiimote)device; Console.WriteLine("We have connected to a Wiimote device."); // Here we have access to all the operations that we can perform on a Wiimote. OnWiimoteConnected(wiimote); } // If we don't want to be connected to the device, we can disconnect like this: device.Disconnect(); }
public AppManager(ConnectionManager connectionManager, IDeviceInfo deviceInfo, AccountManager accountManager) : base(connectionManager) { _deviceInfo = deviceInfo; _accountManager = accountManager; }
public ClientInfoHeaderHandler(IAppInfo appInfo, IDeviceInfo deviceInfo, string installId, HttpMessageHandler innerHandler) : base(innerHandler) { AppInfo = appInfo; DeviceInfo = deviceInfo; InstallId = installId ?? string.Empty; }
public GatewayPollingService( IDeviceInfo deviceInfo, IHttpService httpService, IReachability reachability, IRepositories repositories, IMvxMessenger messenger, IGatewayService gatewayService, IGatewayQueuedService gatewayQueuedService, IInfoService infoService, IDataChunkService dataChunkService, ICustomPresenter customPresenter, ILoggingService loggingService ) { _deviceInfo = deviceInfo; _httpService = httpService; _reachability = reachability; _repositories = repositories; _messenger = messenger; _gatewayService = gatewayService; _gatewayQueuedService = gatewayQueuedService; _infoService = infoService; _dataChunkService = dataChunkService; _customPresenter = customPresenter; _deviceRepository = repositories.DeviceRepository; _loggingService = loggingService; }
public GatewayQueuedService( IDeviceInfo deviceInfo, IHttpService httpService, Portable.IReachability reachability, IRepositories repositories, ILoggingService loggingService, IMvxMessenger messenger) { _deviceInfo = deviceInfo; _httpService = httpService; _queueItemRepository = repositories.GatewayQueueItemRepository; _reachability = reachability; _loggingService = loggingService; _messenger = messenger; //TODO: read this from config or somewhere? _gatewayDeviceRequestUrl = "http://blueport.gateway.fleetwoodmobile.net:7090/api/gateway/devicerequest"; //Local url will need to change the station number //_gatewayDeviceRequestUrl = "http://192.168.3.133:17337/api/gateway/devicerequest"; _deviceRepository = repositories.DeviceRepository; }
/// <summary> /// Processes the activity given to the plugin. /// </summary> /// <param name="executionData"></param> public PluginExecutionResult Execute(PluginExecutionData executionData) { PluginExecutionResult result = new PluginExecutionResult(PluginResult.Passed); _activityData = _pluginExecutionData.GetMetadata <JetAdvantageScanActivityData>(); _device = (IDeviceInfo)executionData.Assets.First(); UpdateStatus("Starting JetAdvantage " + "Scan to Cloud Repository"); SetDataLogger(_device); if (CheckJetAdvantageAvailability()) { ScanOptions scanOptions = new ScanOptions() { LockTimeouts = _activityData.LockTimeouts, PageCount = _activityData.PageCount, UseAdf = _activityData.UseAdf, }; _controller = new JetAdvantageScanAutoController(executionData, scanOptions); _controller.ActivityStatusChanged += UpdateStatus; _controller.DeviceSelected += UpdateDevice; UpdateDataLogger(result); return(_controller.RunScanActivity()); } else { result = new PluginExecutionResult(PluginResult.Failed); UpdateDataLogger(result); return(result); } }
/// <summary> /// Agrega la cabecera con los datos de la carga útil necesarios para autenticar a un usuario en el servicio Aspen. /// </summary> /// <param name="request">Solicitud a donde se agrega la cabecera.</param> /// <param name="jwtEncoder">Instancia del codificador del contenido de la carga útil.</param> /// <param name="apiSecret">Secreto de la aplicación que se utiliza para codificar el contenido del carga útil.</param> /// <param name="userIdentity">La información que se utiliza para autenticar la solicitud en función de un usuario.</param> public void AddSigninPayloadHeader( IRestRequest request, IJwtEncoder jwtEncoder, string apiSecret, IUserIdentity userIdentity) { Throw.IfNull(request, nameof(request)); Throw.IfNull(jwtEncoder, nameof(jwtEncoder)); Throw.IfNullOrEmpty(apiSecret, nameof(apiSecret)); Throw.IfNull(userIdentity, nameof(userIdentity)); IDeviceInfo deviceInfo = userIdentity.Device ?? CacheStore.Get <DeviceInfo>(CacheKeys.CurrentDevice) ?? DeviceInfo.Current; request.AddHeader(ServiceLocator.Instance.RequestHeaderNames.DeviceInfoHeaderName, deviceInfo.ToJson()); CacheStore.Add(CacheKeys.CurrentDevice, deviceInfo); Dictionary <string, object> payload = new Dictionary <string, object>(); ServiceLocator.Instance.PayloadClaimsManager.AddNonceClaim(payload, ServiceLocator.Instance.NonceGenerator.GetNonce()); ServiceLocator.Instance.PayloadClaimsManager.AddEpochClaim(payload, ServiceLocator.Instance.EpochGenerator.GetSeconds()); ServiceLocator.Instance.PayloadClaimsManager.AddDocTypeClaim(payload, userIdentity.DocType); ServiceLocator.Instance.PayloadClaimsManager.AddDocNumberClaim(payload, userIdentity.DocNumber); ServiceLocator.Instance.PayloadClaimsManager.AddPasswordClaim(payload, userIdentity.Password); ServiceLocator.Instance.PayloadClaimsManager.AddDeviceIdClaim(payload, deviceInfo.DeviceId); string jwt = jwtEncoder.Encode(payload, apiSecret); request.AddHeader(ServiceLocator.Instance.RequestHeaderNames.PayloadHeaderName, jwt); }
private void DumpDevice(IDeviceInfo device) { var blueDress = device.BluetoothAddress.ToBluetoothAddress(); Console.WriteLine($"Device name: {device.Name}"); Console.WriteLine($"Device ID: {device.Id}"); Console.WriteLine($"Device address: {blueDress}"); }
private GAServiceManager(IDeviceInfo deviceInfo) { PostData = true; dispatchingTasks = new List <Task>(); payloads = new Queue <Payload>(); DispatchPeriod = TimeSpan.Zero; this.deviceInfo = deviceInfo; }
/// <summary> /// Collect device Job profile /// </summary> /// <param name="device"></param> private void CollectDeviceJobProfile(IDeviceInfo device) { DeviceUsageCollector collector = new DeviceUsageCollector(device.Address); RecordEvent(DeviceWorkflowMarker.ActivityBegin, device.AssetId); ProcessUsageCounts(device, collector); RecordEvent(DeviceWorkflowMarker.ActivityEnd, device.AssetId); }
public ApplicationManager( ITransportResource transportResource, IStorage storage, IDeviceInfo deviceInfo) { _transport = transportResource; _storage = storage; DeviceInfo = deviceInfo; Initialize (); }
public AccountManager(ConnectionManager connectionManager, IDeviceInfo deviceInfo, ProfileServiceProxy profileServiceProxy, AuthenticationServiceProxy authenticationServiceProxy, RegistrationServiceProxy registrationServiceProxy, IStorage storage) : base(connectionManager) { _deviceInfo = deviceInfo; _profileServiceProxy = profileServiceProxy; _authenticationServiceProxy = authenticationServiceProxy; _registrationServiceProxy = registrationServiceProxy; _storage = storage; }
/// <summary> /// Performs a coldboot restart on the deive /// </summary> /// <param name="device">The device that should be restarted</param> public static void RestartColdboot(IDeviceInfo device) { string uid = device.UniqueIdentifier; IDevice d = DeviceManagerSingleton.Manager.AcquireDevice(uid); try { d.Reboot(OSType.COLDBOOT); DeviceManagerSingleton.Manager.ReleaseDevice(d); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); DeviceManagerSingleton.Manager.ReleaseDevice(d); } }
public ApplicationManager( ITransportResource transportResource, IDtoSerializer dtoSerializer, IStorage storage, IDeviceInfo deviceInfo) { //we don't have autofac so let's build the tree var commandParser = new CommandParser(); var connectionManager = new ConnectionManager(transportResource, new CommandBuffer(commandParser), commandParser, new RequestsHandler(), dtoSerializer); AccountManager = new AccountManager(storage, deviceInfo, connectionManager, new ProfileServiceProxy(connectionManager), new RegistrationServiceProxy(connectionManager), new AuthenticationServiceProxy(connectionManager)); ChatManager = new ChatManager(connectionManager, new ChatServiceProxy(connectionManager), AccountManager); FriendsManager = new FriendsManager(connectionManager, new FriendsServiceProxy(connectionManager)); SearchManager = new SearchManager(connectionManager, new UsersSearchServiceProxy(connectionManager)); ConnectionManager = connectionManager; }
public UIDevice Add(IDeviceInfo deviceInfo) { UIDevice uiDevice; if (!deviceinfoLookup.TryGetValue(deviceInfo, out uiDevice)) { uiDevice = new UIDevice(); uiDevice.DeviceInfo = deviceInfo; deviceinfoLookup.Add(deviceInfo, uiDevice); devices.Add(uiDevice); Invoke(new Action<UIDevice>(delegate(UIDevice ud) { devicesBox.Items.Add(ud); devicesBox.SelectedIndex = devicesBox.Items.Count - 1; }), uiDevice); } else uiDevice.DeviceInfo = deviceInfo; devicesBox.Invalidate(); return uiDevice; }
protected AbstractCueDevice(IDeviceInfo info) { this.DeviceInfo = info; CheckUpdateLoop(); }
/// <summary> /// Updates the device with the given CAB /// </summary> /// <param name="device">The device to update</param> /// <param name="update">The filename of the CAB</param> /// <param name="withBackup">Whether a backup schould be created</param> public void UpdateImageUpdate(IDeviceInfo device, string update, bool withBackup) { List<string> updates = new List<string>() { update }; UpdateImageUpdate(device, updates, withBackup); }
public static IEnumerable<Item> GetImgItems(IDeviceInfo deviceInfo) { var device = deviceInfo.Connect(); return device.Items.Cast<Item>().Where(i => i.Properties["Item Name"].get_Value().ToString().StartsWith("IMG")); }
private void OnActivate(IDeviceInfo moniker) { activeDevice = moniker as MfDevice; var format = string.Empty; var hr = camProcess.SetDevice(activeDevice, ref format); if (!string.IsNullOrEmpty(format)) eventAggregator.GetEvent<NoticeFormatEvent>().Publish(format); MFError.ThrowExceptionForHR(hr); }
public IDevice Connect(IDeviceInfo deviceInfo) { int result; MsBluetoothDeviceInfo bluetoothDeviceInfo = deviceInfo as MsBluetoothDeviceInfo; if (bluetoothDeviceInfo == null) throw new ArgumentException("The specified IDeviceInfo does not belong to this DeviceProvider.", "deviceInfo"); NativeMethods.BluetoothDeviceInfo bluetoothDevice = bluetoothDeviceInfo.Device; result = NativeMethods.BluetoothUpdateDeviceRecord(ref bluetoothDevice); NativeMethods.HandleError(result); if (bluetoothDevice.connected) throw new NotImplementedException("The device is already connected."); if (bluetoothDevice.remembered) { // Remove non-connected devices from MsBluetooth's device list. // This has to be done because: // MsBluetooth can't connect to Hid devices without also pairing to them. // If you think that sounds crazy, you're on the right track. NativeMethods.RemoveDevice(bluetoothDevice.address); } Guid hidGuid = BluetoothServices.HumanInterfaceDeviceServiceClass_UUID; result = NativeMethods.BluetoothSetServiceState(IntPtr.Zero, ref bluetoothDevice, ref hidGuid, 0x0001); NativeMethods.HandleError(result); if (WaitTillConnected(bluetoothDevice.address, TimeSpan.FromSeconds(30))) { Thread.Sleep(2000); ReportDevice device = null; foreach (KeyValuePair<string, SafeFileHandle> pair in MsHidDeviceProviderHelper.GetWiiDeviceHandles()) { string devicePath = pair.Key; SafeFileHandle fileHandle = pair.Value; Stream communicationStream = new MsHidSetOutputReportStream(fileHandle); // determine the device type if (bluetoothDeviceInfo.Name == "Nintendo RVL-WBC-01") device = new ReportBalanceBoard(deviceInfo, communicationStream); else if (bluetoothDeviceInfo.Name == "Nintendo RVL-CNT-01") device = new ReportWiimote(deviceInfo, communicationStream); else throw new ArgumentException("The specified deviceInfo with name '" + bluetoothDeviceInfo.Name + "' is not supported.", "deviceInfo"); if (MsHidDeviceProviderHelper.TryConnect(device, communicationStream, devicePath, fileHandle)) break; device = null; } if (device != null) { lookupFoundDevices.Remove(bluetoothDeviceInfo.Address); foundDevices.Remove(bluetoothDeviceInfo); OnDeviceLost(new DeviceInfoEventArgs(bluetoothDeviceInfo)); device.Disconnected += device_Disconnected; ConnectedDevices.Add(device); lookupConnectedDevices.Add(bluetoothDeviceInfo, device); OnDeviceConnected(new DeviceEventArgs(device)); return device; } else throw new DeviceConnectException("No working HID device found."); } else { throw new TimeoutException("Timeout while trying to connect to the bluetooth device."); } }
public ReportBalanceBoard(IDeviceInfo deviceInfo, Stream communicationStream) : base(deviceInfo, communicationStream) { }
public IDevice Connect(IDeviceInfo deviceInfo) { MsHidDeviceInfo hidDeviceInfo = deviceInfo as MsHidDeviceInfo; if (hidDeviceInfo == null) throw new ArgumentException("The specified DeviceInfo does not belong to this DeviceProvider.", "deviceInfo"); ReportWiimote wiimote; if (!TryConnect(hidDeviceInfo, out wiimote)) { UseSetOutputReport = !UseSetOutputReport; if (!TryConnect(hidDeviceInfo, out wiimote)) { throw new DeviceConnectException("Both methods of connecting timed out."); } } wiimote.Disconnected += device_Disconnected; ConnectedDevices.Add(wiimote); MsHidDeviceProviderHelper.SetDevicePathConnected(hidDeviceInfo.DevicePath, true); OnDeviceConnected(new DeviceEventArgs(wiimote)); return wiimote; }
public ApplicationInsights(IDeviceInfo deviceInfo, INavigationReadOnlyState navigationState) { _deviceInfo = deviceInfo; _navigationState = navigationState; }
protected ReportDevice(IDeviceInfo deviceInfo, Stream communicationStream) { _DeviceInfo = deviceInfo; InitializeCommunication(communicationStream); }
public DeviceInfoEventArgs(IDeviceInfo deviceInfo) { _DeviceInfo = deviceInfo; }
public LoginViewModel(AuthenticationServiceProxy authenticationService) { _authenticationService = authenticationService; _deviceInfo = null; }
private ICameraDevice GetWiaIDevice(IDeviceInfo devInfo) { // if camera already is connected do nothing if (_deviceEnumerator.GetByWiaId(devInfo.DeviceID) != null) return _deviceEnumerator.GetByWiaId(devInfo.DeviceID).CameraDevice; _deviceEnumerator.RemoveDisconnected(); DeviceDescriptor descriptor = new DeviceDescriptor {WiaDeviceInfo = devInfo, WiaId = devInfo.DeviceID}; ICameraDevice cameraDevice = new WiaCameraDevice(); bool isConnected = cameraDevice.Init(descriptor); descriptor.CameraDevice = cameraDevice; _deviceEnumerator.Add(descriptor); ConnectedDevices.Add(cameraDevice); if (isConnected) { NewCameraConnected(cameraDevice); } //ServiceProvider.DeviceManager.SelectedCameraDevice.ReadDeviceProperties(0); return SelectedCameraDevice; }
public DeviceInfoViewModel(IDeviceInfo deviceInfo) { this.Device = deviceInfo; }
protected AbstractCueDevice(IDeviceInfo info) { this.DeviceInfo = info; }
public ReportWiimote(IDeviceInfo deviceInfo, Stream communicationStream) : base(deviceInfo, communicationStream) { }
public IDevice Connect(IDeviceInfo deviceInfo) { BluesoleilDeviceInfo bluetoothDeviceInfo = (BluesoleilDeviceInfo)deviceInfo; Thread.Sleep(100); BluetoothConnection connection = BluesoleilService.Instance.ConnectService(bluetoothDeviceInfo.Service); ReportDevice device = null; foreach (KeyValuePair<string, SafeFileHandle> pair in MsHidDeviceProviderHelper.GetWiiDeviceHandles()) { string devicePath = pair.Key; SafeFileHandle fileHandle = pair.Value; Stream communicationStream = new MsHidStream(fileHandle); // determine the device type if (bluetoothDeviceInfo.Name == "Nintendo RVL-WBC-01") device = new ReportBalanceBoard(deviceInfo, communicationStream); else if (bluetoothDeviceInfo.Name == "Nintendo RVL-CNT-01") device = new ReportWiimote(deviceInfo, communicationStream); else throw new ArgumentException("The specified deviceInfo with name '" + bluetoothDeviceInfo.Name + "' is not supported.", "deviceInfo"); if (MsHidDeviceProviderHelper.TryConnect(device, communicationStream, devicePath, fileHandle)) break; device = null; } if (device == null) { bluesoleil.DisconnectService(connection); throw new DeviceConnectException("The connected bluetooth device was not found in the HID-list."); } device.Disconnected += new EventHandler(device_Disconnected); lookupConnection.Add(bluetoothDeviceInfo.Address, connection); OnDeviceConnected(device); return device; }
/// <summary> /// Updates the given device with the specified Images (CAB) /// </summary> /// <param name="device">The device that will be updated</param> /// <param name="updates">A list of the updates</param> /// <param name="withBackup">True when a backup should be created, otherwise false</param> public void UpdateImageUpdate(IDeviceInfo device, List<string> updates, bool withBackup) { if (updateThread != null && updateThread.IsAlive) { raiseMessageSent("Update thread is still alive. We will now wait for it to finish. The operation will abort after 2 minutes", UpdateMessageEventArgs.MessageType.Log); updateThread.Join(new TimeSpan(0,2,0)); } if (updateThread == null || !updateThread.IsAlive) { updateThread = new Thread(new ParameterizedThreadStart(doUpdate)); updateThread.SetApartmentState(ApartmentState.MTA); updateThread.Start(new doUpdateArgs(){ device = device, updates = updates, withBackup = withBackup}); } else { raiseMessageSent("There is already an update in progress. Please wait for it to finish.", UpdateMessageEventArgs.MessageType.Log); } }
public AccountStorage(INotificationCenter notificationCenter, ICurrentUser currentUser, IDeviceInfo deviceInfo) { _notificationCenter = notificationCenter; _currentUser = currentUser; _deviceInfo = deviceInfo; }
public void Remove(IDeviceInfo deviceInfo) { UIDevice uiDevice; if (deviceinfoLookup.TryGetValue(deviceInfo, out uiDevice)) { if (uiDevice.Device == null) { devices.Remove(uiDevice); deviceinfoLookup.Remove(deviceInfo); Invoke(new Action<UIDevice>(delegate(UIDevice ud) { devicesBox.Items.Remove(ud); }), uiDevice); } } devicesBox.Invalidate(); }