private void SetPanelImage(Device device, PingReply reply) { BeginInvoke((MethodInvoker) delegate { WriteLine("Setting panel image for " + device.ToString() + " " + reply.Status.ToString()); Panel selectedPanel = ( from Control unk in Controls where (unk is Panel) && (unk.Name == device.ToString()) // ... or however you go about finding the panel... select unk as Panel ).FirstOrDefault(); if (selectedPanel != null) { switch (reply.Status) { case IPStatus.Success: // Set image for enabled break; case IPStatus.TimedOut: // Set image as disabled break; default: // Set image as disabled break; } } }); }
public void ToStringContainsTypeAndName() { var defaultDevice = new Device(EmulatorTestExtensions.CreateDefaultDeviceData()); var win8Device = new Device(EmulatorTestExtensions.CreateWindows8DeviceData()); Assert.AreEqual("Default", defaultDevice.ToString()); Assert.AreEqual("Windows - Windows 8 1080p", win8Device.ToString()); }
public IActionResult Programacion2(string imei, string lup, string luc) { string result = string.Empty; //Obtenemos el device Device device = GetInfo(imei); if (device == null) { return(NotFound($"Dispositivo no encontrado {imei}")); } //Si tiene alguna salida activa la desactivamos - Forzandolas device.ClearSalidas(); //Fijamos la hora de la ultima sincronizacion device.LastSync = System.DateTime.Now; //Chequeamos si esta pdte de sincronizar la config if (device.IsPendingConfig(luc)) { result += "\r\n" + device.ToString(); } //Chequeamos si esta pdte de sincronizar la programación if (device.IsPendingProgram(lup)) { result += "\r\n" + device.Programas.ToString(); } return(Ok(result)); }
public bool Add(Device item) { bool flag = true; item.OnChangeName += (s) => { if (NamesEqualityChecking(s) && NamesLengthChecking(s, 40)) { flag = true; return(true); } else { flag = false; return(false); } }; if (flag) { devices.Add(item); lB_devices.Items.Add(item.ToString()); return(true); } else { return(false); } }//Добавляет item в списки
/// <summary> /// Gets the xml file representation of the object as a string with no added indentation. /// </summary> /// <returns> /// The xml object data as a string. /// </returns> public override string ToString() { StringBuilder sb = new(); string spacer = Type == InputType.Button ? " " : " "; sb.Append(Type == InputType.Button ? "<Button " : "<Axis ") .Append(nameof(Device)).Append("=\"").Append(Device.ToString()).AppendLine("\""); if (Type is InputType.Axis) { sb.Append(spacer).Append(nameof(Value)).Append("=\"") .Append(string.IsNullOrWhiteSpace(Value) ? string.Empty : Value).AppendLine("\""); } else if (Type is InputType.Button) { sb.Append(spacer).Append("Positive").Append("=\"") .Append(string.IsNullOrWhiteSpace(Value) ? string.Empty : Value).AppendLine("\""); sb.Append(spacer).Append(nameof(Negative)).Append("=\"") .Append(string.IsNullOrWhiteSpace(Negative) ? string.Empty : Negative).AppendLine("\""); } sb.Append(spacer).Append(nameof(Invert)).Append("=\"").Append(Invert).Append("\"/>"); return(sb.ToString()); }
public void addEquipedDevice(Device device) { Logger.Log("addEquipedDevice(" + device.ToString() + ")", Logger.Level.TRACE); if (device == null) { Logger.Log("DevicesDisplayer::addEquipedDevice device == null", Logger.Level.WARN); } bool newEquiped = (!_equipedDevices.Exists(equiped => equiped._device == device)); if (newEquiped) { Vector3 localPosition = getNewPosition(DeviceType.Equiped); UnityEngine.Transform parent = equipPanel.transform; DisplayedDevice newDevice = EquipedDisplayedDevice.Create( parent, localPosition, null, device, this, DevicesDisplayer.DeviceType.Equiped ); _equipedDevices.Add(newDevice); graphMoleculeList.addDeviceAndMoleculesComponent(newDevice); } else { Logger.Log("addDevice failed: alreadyEquiped=" + newEquiped, Logger.Level.TRACE); } }
/// <summary> /// Create a human readable string out of this object. /// </summary> /// <returns></returns> public override string ToString() { if (!IsValid) { return("HID: Invalid HidEvent"); } // string res = "==== HidEvent ====\n"; res += Device.ToString(); if (IsGeneric) { res += "Generic\n"; } if (IsKeyboard) { res += "Keyboard\n"; } if (IsMouse) { res += "Mouse\n"; } res += "Foreground: " + IsForeground + "\n"; res += "UsagePage: 0x" + UsagePage.ToString("X4") + "\n"; res += "UsageCollection: 0x" + UsageCollection.ToString("X4") + "\n"; foreach (var usage in Usages) { res += "Usage: 0x" + usage.ToString("X4") + "\n"; } res += "==================\n"; return(res); }
public String deviceInfo() { Device activeDevice = strategyMgr.getSpecifiedDisplayStrategy().getActiveDevice(); Console.WriteLine("Device: {0}", activeDevice); return("Aktives Gerät: " + activeDevice.ToString()); }
static public JToken GetDeviceBlob(FullID fullID) { Device dev = deviceBlobs [fullID]; deviceBlobs.Remove(fullID); return(dev.ToString()); // implicit conversion }
public string PutSwitchFunc(int id, string command) { Device device = db.Devices.Find(id); if (device != null) { switch (command) { case "on": device.SwtchOn(); break; case "off": device.SwtchOff(); break; case "IncTemp": ((ITemperatureAble)device).IncreaseTemperature(); break; case "DecTemp": ((ITemperatureAble)device).DecreaseTemperature(); break; } db.Entry(device).State = EntityState.Modified; } db.SaveChanges(); return("Device: " + device.Name + "<br/>" + device.ToString()); }
public override string ToString() { string address; if (_is_logical) { if (_group_type == GROUP_LEVEL_FORMAT.GROUP_2_LEVEL_FORMAT) { address = MainGroup.ToString(); address += "/"; address += SubGroup11.ToString(); } else { address = MainGroup.ToString(); address += "/"; address += MiddleGroup.ToString(); address += "/"; address += SubGroup8.ToString(); } return(address); } address = Zone.ToString(); address += "."; address += Line.ToString(); address += "."; address += Device.ToString(); return(address); }
/// <summary> /// Updates the data in the control from its item. /// </summary> protected override void UpdateData() { StringBuilder lsbInfo = new StringBuilder(); cgMain.Device = null; if (miItem != null) { UPnPDeviceTreeItem ldiItem = (UPnPDeviceTreeItem)miItem; Device ldDevice = ((Device)(miItem.LinkedObject)); DeviceDescription lddDescription = ldDevice.GetDescription(ldDevice.RootDeviceDescription()); lsbInfo.AppendLine(AdapterAddressInformation(ldDevice)); lsbInfo.AppendLine(lddDescription.ToString()); lsbInfo.AppendLine(); lsbInfo.AppendLine(ldDevice.ToString()); foreach (var lsPropertyName in lddDescription.GetUsedPropertyNames()) { dgProperties.Rows.Add(csYes, lsPropertyName, lddDescription.GetPropertyString(lsPropertyName)); } foreach (var lkvProperty in lddDescription.GetUnusedProperties()) { dgProperties.Rows.Add(csNo, lkvProperty.Key, lkvProperty.Value); } cgMain.Device = ldDevice; } rtbInfo.Text = lsbInfo.ToString(); }
string GetCoverFile(Device device, int releaseId) { string relativePath = Path.Combine("covers", device.ToString()); string filename = releaseId.ToString() + ".png"; string fullPath = Path.Combine(FileDir, relativePath, filename); return(fullPath); }
void DeviceManager_DeviceDisconnecting(object sender, Device device) { this.SafeInvoke(() => { this.CancelShellCommand(device.Serial); this.Output($"Disconnected: '{device.ToString(Properties.Resources.DeviceLabelFormat)}'"); }); }
public void DeviceRemovedEventHandler(object sender, Device dev) { WriteLog("Device removed: " + dev.ToString(), false); if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("DeviceListTxt")); PropertyChanged(this, new PropertyChangedEventArgs("ActivityLogTxt")); } }
private void CheckForInput() { // TODO - Checking for input once per frame seems a bit sketchy while (SDL2.SDL_PollEvent(out var e) != 0) { switch (e.type) { case SDL2.SDL_EventType.SDL_QUIT: _quit = true; break; case SDL2.SDL_EventType.SDL_KEYUP: if (e.key.keysym.sym == SDL2.SDL_Keycode.SDLK_F2) { var(vramBank0, vramBank1, oamRam, tileBuffer, cgbBgPalette, cgbSpritePalette, frameBuffer) = _device.DumpLcdDebugInformation(); using var fbFile = File.OpenWrite("framebuffer"); using var vramBank0File = File.OpenWrite("VRAMBank0.csv"); using var vramBank1File = File.OpenWrite("VRAMBank1.csv"); using var oamFile = File.OpenWrite("OAMRAM.csv"); using var tileBufferFile = File.OpenWrite("TileBuffer.csv"); using var cgbBgPaletteFile = File.OpenWrite("CGB_BG_PALETTE.csv"); using var cgbSpritePaletteFile = File.OpenWrite("CGB_SPRITE_PALETTE.csv"); vramBank0File.Write(System.Text.Encoding.ASCII.GetBytes(string.Join("\r\n", vramBank0))); vramBank1File.Write(System.Text.Encoding.ASCII.GetBytes(string.Join("\r\n", vramBank1))); oamFile.Write(System.Text.Encoding.ASCII.GetBytes(string.Join("\r\n", oamRam))); for (var row = 0; row < Device.ScreenHeight; row++) { for (var col = 0; col < Device.ScreenWidth; col++) { tileBufferFile.Write(System.Text.Encoding.ASCII.GetBytes(tileBuffer[row * Device.ScreenWidth + col] + ",")); } tileBufferFile.Write(System.Text.Encoding.ASCII.GetBytes("\r\n")); } cgbBgPaletteFile.Write(System.Text.Encoding.ASCII.GetBytes(string.Join("\r\n", cgbBgPalette))); cgbSpritePaletteFile.Write(System.Text.Encoding.ASCII.GetBytes(string.Join("\r\n", cgbSpritePalette))); fbFile.Write(System.Text.Encoding.ASCII.GetBytes(string.Join("\r\n", frameBuffer))); Console.WriteLine(_device.ToString()); } else if (e.key.keysym.sym == SDL2.SDL_Keycode.SDLK_F3) { _device.SetDebugMode(); } else if (_keyMap.ContainsKey(e.key.keysym.sym)) { _device.HandleKeyUp(_keyMap[e.key.keysym.sym]); } break; case SDL2.SDL_EventType.SDL_KEYDOWN: if (_keyMap.ContainsKey(e.key.keysym.sym)) { _device.HandleKeyDown(_keyMap[e.key.keysym.sym]); } break; } } }
public void ToStringTest() { Device target = new Device(); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; actual = target.ToString(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public static async Task<Response<Settings>> account_update_delivery_device(this Api api, Device device, bool include_entities = false) { var uri = "https://api.twitter.com/1.1/account/update_delivery_device.json"; var parameters = new Dictionary<string, object>(); parameters.Add("device", device.ToString().ToLower()); if (include_entities) parameters.Add("include_entities", include_entities); // TODO: find out is there is a json response for "account_update_delivery_device" return await api.SendAsync<Settings>(HttpMethod.Post, uri, parameters); }
public static void CallWebClient(string uri) { WebClient client = new WebClient(); string response = client.DownloadString(uri); Console.WriteLine(response); Device d = JsonConvert.DeserializeObject <Device>(response); Console.WriteLine("response: " + response); Console.WriteLine(d.ToString()); }
public bool IsConnected() { try { _gamepad.ToString(); return(true); } catch { return(false); } }
private void addToReactionEngine(Device device) { Logger.Log("Equipment::addToReactionEngine reactions from device "+device.getInternalName()+" ("+device.ToString ()+")", Logger.Level.TRACE); LinkedList<IReaction> reactions = device.getReactions(); Logger.Log("Equipment::addToReactionEngine reactions="+Logger.ToString<IReaction>(reactions)+" from "+device, Logger.Level.INFO); foreach (IReaction reaction in reactions) { Logger.Log("Equipment::addToReactionEngine adding reaction="+reaction, Logger.Level.TRACE); _reactionEngine.addReactionToMedium(_celliaMediumID, reaction); } }
public static async void CallHttpClient(string uri) { Device d = null; HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync(uri); if (response.IsSuccessStatusCode) { d = await response.Content.ReadAsAsync <Device>(); } Console.WriteLine(d.ToString()); }
public static void ShowLoanerReceipt() { LendingReceiptRepository.Instance.LoadData(); foreach (var LendingReceipt in LendingReceiptRepository.Instance.lendingReceiptList) { Console.WriteLine(LendingReceipt.ToString()); Console.WriteLine("Devices borrowed"); LendingReceipt.Loan.Devices.ForEach(Device => Console.WriteLine(Device.ToString())); Console.WriteLine(); } Console.ReadLine(); }
private void PopulateDevices(List <DeviceEntry> List, Color Color, string Header) { TextBox.SelectionColor = Color; TextBox.SelectionFont = new Font(TextBox.Font, FontStyle.Bold); TextBox.AppendText("--- " + Header + " ---\n"); TextBox.SelectionFont = new Font(TextBox.Font, FontStyle.Regular); foreach (DeviceEntry Device in List) { TextBox.SelectionColor = Color; TextBox.AppendText(Device.ToString() + "\n"); } TextBox.AppendText("\n"); }
private async Task <Device> GetRandomConnectedDevice(METHODS?supportedMethod = null) { List <Device> devices = (await DeviceLocator.Discover()).FindAll(d => !supportedMethod.HasValue || d.SupportedOperations.Contains(supportedMethod.Value)); Assert.NotEmpty(devices); int randomIndex = new Random().Next(0, devices.Count); Device d = devices.ElementAt(randomIndex); _output.WriteLine($"Used device : {d.ToString()}"); await d.Connect(); return(d); }
private void Create_Click(object sender, RoutedEventArgs e) { Device newDevice = new Device(); DeviceWPF lumberModal = new DeviceWPF(newDevice); if (lumberModal.ShowDialog() == true) { channelWP.AddDevice(newDevice); List.Items.Add(newDevice.ToString()); } else { MessageBox.Show("Changes are not saved"); } }
public static string MacAddress(this Device value) { var enumMember = value.GetType().GetMember(value.ToString()).FirstOrDefault(); if (enumMember == null) { throw new Exception($"Cannot find Device {value}"); } if (!(enumMember.GetCustomAttributes(typeof(MacAddressAttribute), false).FirstOrDefault() is MacAddressAttribute attribute)) { throw new Exception($"Cannot find \"MacAddress\" attribute on {value}"); } return (attribute.MacAddress); }
internal void setBrailleDis() { Device device = getDeviceByName("BrailleDis"); if (!device.Equals(new Device())) { strategyMgr.getSpecifiedDisplayStrategy().setActiveDevice(device); Console.WriteLine("Ausgabegerät auf {0} geändert.", device.ToString()); } else { // strategyMgr.getSpecifiedDisplayStrategy().setActiveDevice(new Device(64, 30, OrientationEnum.Front, "BrailleDisSimulator", this.GetType())); Settings s = new Settings(); strategyMgr.setSpecifiedDisplayStrategy(s.getPosibleDisplayStrategies()[2].className); Console.WriteLine("Ausgabegerät auf 'Simulator-BrailleIO' geändert."); } }
public void setMVBDDevice() { Device device = getDeviceByName("MVDB_2"); if (!device.Equals(new Device())) { strategyMgr.getSpecifiedDisplayStrategy().setActiveDevice(device); Console.WriteLine("Ausgabegerät auf {0} geändert.", device.ToString()); } else { //strategyMgr.getSpecifiedDisplayStrategy().setActiveDevice(new Device(64, 30, OrientationEnum.Front, "MVDB_2", this.GetType())); Settings s = new Settings(); strategyMgr.setSpecifiedDisplayStrategy(s.getPosibleDisplayStrategies()[0].className); Console.WriteLine("Ausgabegerät auf 'MVBD' geändert."); } }
public async void AddDetection_WebApi_Include_Api(Device device, string agent, string path) { using var server = MockServer.Server(options => { options.Responsive.DefaultMobile = device; options.Responsive.DefaultTablet = device; options.Responsive.DefaultDesktop = device; options.Responsive.IncludeWebApi = true; }); var client = server.CreateClient(); var request = MockClient.CreateRequest(agent, path); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Assert.Contains(device.ToString(), await response.Content.ReadAsStringAsync(), StringComparison.OrdinalIgnoreCase); }
// take a reading (called by the connected device) public void StateChanged() { DeviceState = Device.ToString(); if (Device is Meter m) { // TODO: this should be handled in a standardized way if (Device is IonGauge ig) { DeviceOn = ig.IonGaugeEnable.IsOn; } else if (Tag is LnManifold t) { DeviceOn = t.LNSupply.IsReallyOn; } else if (Tag is TextBox tb) // typically a setpoint linking to the actual device { if (tb.Tag is MassFlowController mfc) { DeviceOn = mfc.OutputVoltage > 0; } } else { DeviceOn = true; } DisplayValue = checkMeter(m); } else if (Device is Heater h) { Error = h.Errors; DeviceOn = h.IsOn; DisplayValue = clipMinMax(h.Temperature); } else if (Device is TempSensor ts) { DeviceState = ts.ToString(); DisplayValue = clipMinMax(ts.Temperature); } else if (Device is TubeFurnace tf) { DeviceOn = tf.IsOn; DisplayValue = clipMinMax(tf.Temperature); } }
public static void Setup() { ErrorCode err; Platform[] platforms = Cl.GetPlatformIDs(out err); List <Device> CLDevices = new List <Device>(); CheckErr(err, "Cl.GetPlatformIDs"); foreach (Platform p in platforms) { string platformName = Cl.GetPlatformInfo(p, PlatformInfo.Name, out err).ToString(); Console.WriteLine($"Platform: {platformName}"); CheckErr(err, "Cl.GetPlatformInfo"); //Limit platforms to GPU-based platforms foreach (Device d in Cl.GetDeviceIDs(p, DeviceType.Gpu, out err)) { CheckErr(err, "Cl.GetDeviceIDs"); Console.WriteLine("Device: " + d.ToString()); CLDevices.Add(d); } } if (CLDevices.Count <= 0) { Console.Error.WriteLine("No suitable OpenCL devices found."); return; } _device = CLDevices[0]; if (Cl.GetDeviceInfo(_device, DeviceInfo.ImageSupport, out err).CastTo <Bool>() == Bool.False) { Console.Error.WriteLine($"Selected CL device {_device.ToString()} does not have image support."); return; } _context = Cl.CreateContext(null, 1, new Device[] { _device }, ContextNotify, IntPtr.Zero, out err); CheckErr(err, "Cl.CreateContext"); }
public RobotController(LeapListener leapListener, Device device) { Console.WriteLine(device.ToString()); _leapListener = leapListener; switch (device) { case Device.Platform: deviceController = new PlatformController(); break; case Device.ArmBigger: deviceController = new ArmBiggerController(); break; case Device.ArmSmaller: deviceController = new ArmSmallerController(); break; } _controlThread = new Thread(controlRobot); _controlThread.Start(); }
private string GetDeviceString(Device device, int iAddress) { string sDevice; if (device == Device.B || device == Device.W || device == Device.X || device == Device.Y) sDevice = "[" + device.ToString() + " " + iAddress.ToString("X6") + "]"; else sDevice = "[" + device.ToString() + " " + iAddress.ToString("d6") + "]"; return sDevice; }
public void addEquipedDevice(Device device) { Logger.Log("addEquipedDevice("+device.ToString()+")", Logger.Level.TRACE); if(device == null) { Logger.Log ("DevicesDisplayer::addEquipedDevice device == null", Logger.Level.WARN); } bool newEquiped = (!_equipedDevices.Exists(equiped => equiped._device == device)); if(newEquiped) { Vector3 localPosition = getNewPosition(DeviceType.Equiped); UnityEngine.Transform parent = equipPanel.transform; DisplayedDevice newDevice = EquipedDisplayedDevice.Create( parent, localPosition, null, device, this, DevicesDisplayer.DeviceType.Equiped ); _equipedDevices.Add(newDevice); graphMoleculeList.addDeviceAndMoleculesComponent(newDevice); } else { Logger.Log("addDevice failed: alreadyEquiped="+newEquiped, Logger.Level.TRACE); } }
public void RegisterDevice(Device dev) { devicesList.Add(dev); dev.evDeviceStateHasChanged += dev_evDeviceStateHasChanged; Logger.Log(this, String.Format("Device has been registred: {0}", dev.ToString()), 1); }
public void DisplayObjectToString(Device obj) { if (obj is Lamp) Console.WriteLine(obj.ToString()); if (obj is Conditioner) Console.WriteLine(obj.ToString()); if (obj is HeatingBoiler) Console.WriteLine(obj.ToString()); if (obj is Stove) Console.WriteLine(((Stove)obj).ToString()); if (obj is KitchenVentilation) Console.WriteLine(obj.ToString()); }