public BotAppLogic(DeviceControl deviceControl) { this.deviceControl = deviceControl; this.tableOpener = new TableOpener(deviceControl, new HumanMouse(deviceControl, HumanMouse.Speed.Fast), new Keyboard(deviceControl), tableIdentifier); }
/// <summary> /// As the name implies... /// </summary> protected virtual void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile) { string filename = appReg.GetInstallDir() + "/User/Config/" + appReg.getAutoKeyFileName(); if (File.Exists(filename)) { File.SetAttributes(filename, File.GetAttributes(filename) & ~FileAttributes.ReadOnly); } StreamWriter sw = new StreamWriter (filename, false, Encoding.GetEncoding("utf-8")); for (int i = 0; i < keyFile.keyAssign.Length; i++) { sw.Write(keyFile.keyAssign[i].GetKeyLine()); } for (int i = 0; i < deviceControl.joyAssign.Length; i++) { sw.Write(deviceControl.joyAssign[i].GetKeyLineDX(i, deviceControl.joyAssign.Length)); // PRIMARY DEVICE POV if (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == i) { sw.Write(deviceControl.joyAssign[i].GetKeyLinePOV()); } } sw.Close(); }
public void btnOpen_NetworkSource(object sender, EventArgs e) { try { Source = new NetworkDeviceControl(); Source.OpenTuner(); if (!Source.Connected) { return; } SampleSource = Source.SampleSource; SampleSource.SamplingRateChanged += new EventHandler(SampleSource_SamplingRateChanged); Processing = true; ProcessThread = new Thread(ProcessMain); ProcessThread.Start(); btnOpen.Text = "Close"; } catch (BadImageFormatException ex) { MessageBox.Show("There is a wrong shmemchain.dll in your working directory.", "Error while setting up shmem"); } catch (Exception ex) { MessageBox.Show("Exception occured while trying to set up shmem: " + ex.GetType(), "Error while setting up shmem"); } }
/// <summary> /// As the name implies... /// </summary> protected void SaveJoyAssignStatus(DeviceControl deviceControl) { string fileName; XmlSerializer serializer; StreamWriter sw; for (int i = 0; i < deviceControl.joyAssign.Length; i++) { fileName = appReg.GetInstallDir() + "/User/Config/Setup.v100." + deviceControl.joyAssign[i].GetProductName().Replace("/", "-") + " {" + deviceControl.joyAssign[i].GetInstanceGUID().ToString().ToUpper() + "}.xml"; try { serializer = new XmlSerializer(typeof(JoyAssgn)); sw = new StreamWriter(fileName, false, new UTF8Encoding(false)); serializer.Serialize(sw, deviceControl.joyAssign[i]); sw.Close(); } catch (Exception ex) { Diagnostics.WriteLogFile(ex); continue; } } fileName = appReg.GetInstallDir() + "/User/Config/Setup.v100.MouseWheel.xml"; serializer = new XmlSerializer(typeof(AxAssgn)); sw = new StreamWriter(fileName, false, new UTF8Encoding(false)); serializer.Serialize(sw, deviceControl.mouse.GetMouseAxis()); sw.Close(); }
/// <summary> /// As the name implies... /// </summary> protected void SaveDeviceSorting(DeviceControl deviceControl) { string deviceSort = ""; for (int i = 0; i < deviceControl.joyAssign.Length; i++) { deviceSort += deviceControl.joyAssign[i].GetDeviceSortingLine(); } // BMS overwrites DeviceSorting.txt if was written in UTF-8. string filename = appReg.GetInstallDir() + "/User/Config/DeviceSorting.txt"; string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/DeviceSorting.txt"; if (!File.Exists(fbackupname) & File.Exists(filename)) { File.Copy(filename, fbackupname, true); } if (File.Exists(filename)) { File.SetAttributes(filename, File.GetAttributes(filename) & ~FileAttributes.ReadOnly); } StreamWriter ds = new StreamWriter (filename, false, Encoding.GetEncoding("shift_jis")); ds.Write(deviceSort); ds.Close(); }
/// <summary> /// 获取车辆类型 /// </summary> /// <param name="sql"></param> /// <returns></returns> public static List <DeviceControl> GetDeviceControl(string sql) { DataSet dataset = LinQBaseDao.Query(sql); List <DeviceControl> list = new List <DeviceControl>(); if (dataset != null) { if (dataset.Tables.Count > 0) { foreach (DataRow dr in dataset.Tables[0].Rows) { DeviceControl dcl = new DeviceControl(); dcl.DeviceControl_CardNo = dr["DeviceControl_CardNo"].ToString(); dcl.DeviceControl_CardType = dr["DeviceControl_CardType"].ToString(); dcl.DeviceControl_DrivewayAddress = dr["DeviceControl_DrivewayAddress"].ToString(); dcl.DeviceControl_DrivewayValue = dr["DeviceControl_DrivewayValue"].ToString(); dcl.DeviceControl_FanSate = dr["DeviceControl_FanSate"].ToString(); dcl.DeviceControl_FanValue = dr["DeviceControl_FanValue"].ToString(); dcl.DeviceControl_ID = int.Parse(dr["DeviceControl_ID"].ToString()); dcl.DeviceControl_ISCardRelease = Boolean.Parse(dr["DeviceControl_ISCardRelease"].ToString()); dcl.DeviceControl_OutSate = dr["DeviceControl_OutSate"].ToString(); dcl.DeviceControl_PositionValue = dr["DeviceControl_PositionValue"].ToString(); dcl.DeviceControl_ReadValue = dr["DeviceControl_ReadValue"].ToString(); dcl.DeviceControl_Remark = dr["DeviceControl_Remark"].ToString(); list.Add(dcl); } } } return(list); }
public void AddDevice(IDevice device) { if (InvokeRequired) { Invoke(new Action <Device>(AddDevice), new object[] { device }); return; } if (IsDisposed) { return; } var deviceControl = new DeviceControl(device); deviceControl.SetDeviceName(device.GetFriendlyName()); deviceControl.SetStatus(device.GetDeviceState(), null); pnlDevices.Controls.Add(deviceControl); device.SetDeviceControl(deviceControl); // Sort alphabetically. var deviceName = device.GetFriendlyName(); for (int i = 0; i < pnlDevices.Controls.Count - 1; i++) { if (pnlDevices.Controls[i] is DeviceControl) { var name = ((DeviceControl)pnlDevices.Controls[i]).GetDeviceName(); if (string.CompareOrdinal(deviceName, name) < 0) { pnlDevices.Controls.SetChildIndex(deviceControl, i); return; } } } }
public void loadData(DeviceControl control) { gameObject.name = control.uniqueID.ToString(); Text namefield = gameObject.GetComponentsInChildren <Text> ()[0] as Text; namefield.text = control.controlName; }
public TableSwitcher(Mouse mouse, DeviceControl device, List <Color> colors) { this.mouse = mouse; this.screen = new ScreenImageIterator(device); this.device = device; this.activeColor = colors[0].ToArgb(); this.taskbarReducer = new ColorPaletteReducer(colors.ToArray()); }
public ConsolidationDevice(DeviceControl.DeviceManagerBase deviceManager, DeviceManagerDeviceSettings settings, PeriodType periodType = PeriodType.Day) : base(deviceManager, settings) { Manufacturer = settings.Manufacturer; Model = settings.Model; //DeviceIdentifier = settings.SerialNo; SourceDevices = new List<DeviceLink>(); PeriodType = periodType; }
public ScreenImageIterator(DeviceControl control) { this.control = control; int width = control.DisplayWidth; int height = control.DisplayHeight; this.region = new Rectangle(0, 0, width, height); Log.Debug("display size {" + width + "," + height + "}"); }
/// <summary> /// Set the user interface control of the device. /// </summary> public void SetDeviceControl(DeviceControl deviceControlIn) { if (deviceControlIn == null) { return; } deviceControl = deviceControlIn; deviceControl.SetClickCallBack(OnClickPlayStop, OnClickStop); }
public mainWindow() { InitializeComponent(); ImageList nodeTreeImageList = new ImageList(); nodeTreeImageList.Images.Add(Properties.Resources.FolderNodeOpenIcon); nodeTreeImageList.Images.Add(Properties.Resources.RootNodeIcon); nodeTreeImageList.Images.Add(Properties.Resources.FolderNodeIcon); nodeTreeImageList.Images.Add(Properties.Resources.DeviceNodeIcon); nodeTreeImageList.Images.Add(Properties.Resources.DatapointNodeIcon); NodeTreeView.ImageList = nodeTreeImageList; String DatabaseType = ConfigurationManager.AppSettings["DatabaseConnector"]; String DatabaseName = ConfigurationManager.AppSettings["DatabaseName"]; String DatabaseServer = ConfigurationManager.AppSettings["DatabaseServer"]; String DatabaseUsername = ConfigurationManager.AppSettings["DatabaseUsername"]; String DatabasePassword = ConfigurationManager.AppSettings["DatabasePassword"]; // Create a DatabaseFacade instance this.database = new DatabaseFacade(); if (DatabaseType.Equals("MYSQL")) { // Tell the DatabseFacade to use the MySQLConnector this.database.SetDatabaseConnector( new MySQLConnector(String.Format("SERVER={0};DATABASE={1};UID={2};PASSWORD={3};", DatabaseServer, DatabaseName, DatabaseUsername, DatabasePassword)) ); } // Open a connection to the datbase this.database.OpenConnection(); parentIdDictionary = database.GetObjectTreeSortedByParentID(); PopulateTreeView(); NodeTreeView.Nodes[0].Expand(); this.database.CloseConnection(); this.FolderControl = new FolderControl(); this.FolderControl.Dock = DockStyle.Fill; ContentPanel.Controls.Add(this.FolderControl); this.DeviceControl = new DeviceControl(); this.DeviceControl.Dock = DockStyle.Fill; ContentPanel.Controls.Add(this.DeviceControl); this.DatapointControl = new DatapointControl(); this.DatapointControl.Dock = DockStyle.Fill; ContentPanel.Controls.Add(this.DatapointControl); ContentPanel.Controls[0].Visible = true; ContentPanel.Controls[1].Visible = false; ContentPanel.Controls[2].Visible = false; }
// Constructor public Legend(PointF center) { Control = new DeviceControl(this); MinControl = new MinimizedControl(this); SetSkin(); framesMissingNr = 0; deviceCenter = ConvertCenter(center); centersAvg = new CircularList <PointF>(centersNr); }
public TableOpener(DeviceControl deviceControl, Mouse mouse, Keyboard keyboard, TableIdentifier tableIdentifier) { this.deviceControl = deviceControl; this.mouse = mouse; this.keyboard = keyboard; this.tableIdentifier = tableIdentifier; this.controller = new Controller(keyboard, mouse, tableIdentifier, new ScreenImageIterator(deviceControl)); // seat occupied pattern seatOccupiedPattern = AssemblyTools.getAssemblyImage("error.png"); }
public BotAppLogic(DeviceControl deviceControl, Settings settings) { this.settings = settings; this.deviceControl = deviceControl; this.tableOpener = new TableOpener(deviceControl, new HumanMouse(deviceControl, settings.FastMouse ? HumanMouse.Speed.Super : HumanMouse.Speed.Fast), new Keyboard(deviceControl), tableIdentifier); // alive keeper SetupAliveKeeper(); }
/// <summary> /// Set the user interface control of the device. /// </summary> public void SetDeviceControl(DeviceControl deviceControlIn) { if (deviceControlIn == null) { return; } deviceControl = deviceControlIn; deviceControl.SetClickCallBack(OnClickPlayPause, OnClickStop); deviceControl.Visible = !IsGroup(); }
private async void CreatePWMDevice() { pwmDevice = new DeviceControl(); pwmDevice.M1 = new Motor(15, 14, 13); pwmDevice.M2 = new Motor(9, 8, 7); pwmDevice.M3 = new Motor(10, 11, 12); pwmDevice.M4 = new Motor(4, 5, 6); pwmDevice.S1 = new Servo(0); // Our Adafruit Servo Driver is at the default I2C Address 0x40. await pwmDevice.initDevice(0x40); }
private void btnOpen_IQFile(object sender, EventArgs e) { SampleSource = new FileSourceDeviceControl(); Processing = true; ProcessThread = new Thread(ProcessMain); ProcessThread.Start(); btnOpen.Text = "Close"; return; }
public SearchPlayerPage() { InitializeComponent(); if (DeviceControl.isTablet()) { btnFindPlayer.FontSize = 30; btnMyAdverts.FontSize = 30; btnFindPlayer.HeightRequest = 60; btnMyAdverts.HeightRequest = 60; } //this.BackgroundImageSource = ImageSource.FromResource("soccer_green_bg.jpg"); }
protected override void SaveConfigfile(Hashtable inGameAxis, DeviceControl deviceControl) { string filename = appReg.GetInstallDir() + "/User/Config/falcon bms.cfg"; string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/falcon bms.cfg"; if (!File.Exists(fbackupname) & File.Exists(filename)) { File.Copy(filename, fbackupname, true); } if (File.Exists(filename)) { File.SetAttributes(filename, File.GetAttributes(filename) & ~FileAttributes.ReadOnly); } StreamReader cReader = new StreamReader (filename, Encoding.Default); string stResult = ""; while (cReader.Peek() >= 0) { string stBuffer = cReader.ReadLine(); if (stBuffer.Contains("// SETUP OVERRIDE")) { continue; } stResult += stBuffer + "\r\n"; } cReader.Close(); StreamWriter cfg = new StreamWriter (filename, false, Encoding.GetEncoding("shift_jis")); cfg.Write(stResult); cfg.Write("set g_nHotasPinkyShiftMagnitude " + deviceControl.joyAssign.Length * CommonConstants.DX32 + " // SETUP OVERRIDE\r\n"); cfg.Write("set g_bHotasDgftSelfCancel " + Convert.ToInt32(mainWindow.Misc_OverrideSelfCancel.IsChecked) + " // SETUP OVERRIDE\r\n"); cfg.Write("set g_b3DClickableCursorAnchored " + Convert.ToInt32(mainWindow.Misc_MouseCursorAnchor.IsChecked) + " // SETUP OVERRIDE\r\n"); if (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == ((InGameAxAssgn)inGameAxis["Throttle"]).GetDeviceNumber()) { cfg.Close(); return; } cfg.Write("set g_nNumOfPOVs 2 // SETUP OVERRIDE\r\n"); cfg.Write("set g_nPOV1DeviceID " + (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() + 2) + " // SETUP OVERRIDE\r\n"); cfg.Write("set g_nPOV1ID 0 // SETUP OVERRIDE\r\n"); cfg.Write("set g_nPOV2DeviceID " + (((InGameAxAssgn)inGameAxis["Throttle"]).GetDeviceNumber() + 2) + " // SETUP OVERRIDE\r\n"); cfg.Write("set g_nPOV2ID 0 // SETUP OVERRIDE\r\n"); cfg.Close(); }
private void CloseDevice() { if (ProcessThread != null) { ProcessThread.Abort(); ProcessThread = null; } if (Device != null) { Device.CloseControl(); Device = null; } }
/// <summary> /// 新增设备控制数据 /// 说明:每次获取数据前先检查是否有新增的数据并进行新增 /// </summary> public static void AddDeviceControl(List <DeviceControl> dclist) { try { if (dclist.Count <= 0) { dclist = GetDeviceControl(); } string strSql = "select * from View_FVN_Driveway_Position where Position_Value='" + SystemClass.PosistionValue + "'"; List <View_FVN_Driveway_Position> vfdpList = View_FVN_Driveway_PositionDAL.GetSQLList(strSql); if (vfdpList.Count > dclist.Count) { bool isFind = false; foreach (View_FVN_Driveway_Position vfdp in vfdpList) { foreach (DeviceControl dc in dclist) { if (vfdp.FVN_Value.ToString() == dc.DeviceControl_FanValue && vfdp.Driveway_Value == dc.DeviceControl_DrivewayValue && vfdp.Driveway_ReadCardPort == dc.DeviceControl_ReadValue && vfdp.Position_Value == dc.DeviceControl_PositionValue) { isFind = true; break; } else { isFind = false; } } if (!isFind) { DeviceControl rentity = new DeviceControl(); //rentity.DeviceControl_CardNo = ""; rentity.DeviceControl_DrivewayAddress = vfdp.Driveway_Address; rentity.DeviceControl_DrivewayValue = vfdp.Driveway_Value; rentity.DeviceControl_FanValue = vfdp.FVN_Value.ToString(); rentity.DeviceControl_FanSate = "0"; //无地感 rentity.DeviceControl_ISCardRelease = false; //未刷卡放行 rentity.DeviceControl_OutSate = "无"; //输出无命令 rentity.DeviceControl_PositionValue = vfdp.Position_Value; rentity.DeviceControl_ReadValue = vfdp.Driveway_ReadCardPort; DeviceControlDAL.InsertOneDevice(rentity); } } } } catch { EMEWE.CarManagement.Commons.CommonClass.CommonalityEntity.WriteTextLog("记录设备控制表新增异常:"); } }
// Constructor public IPhone(CircleF apple, CircleF camera) { Control = new DeviceControl(this); MinControl = new MinimizedControl(this); SetSkin(); framesMissingNr = 0; Apple = apple; Camera = camera; CalculatePosition(); centersAvg = new CircularList <PointF>(centersNr); orientationsAvg = new CircularList <double>(orientationsNr); }
public ActiveDevice_Generic(DeviceControl.DeviceManager_ActiveController<Device.ActiveDevice_Generic> deviceManager, DeviceManagerDeviceSettings deviceSettings) : base(deviceManager, deviceSettings, new InverterAlgorithm(deviceSettings, deviceManager.Protocol, deviceManager.ErrorLogger)) { DeviceParams.DeviceType = deviceSettings.DeviceType; DeviceParams.QueryInterval = deviceSettings.QueryIntervalInt; DeviceParams.RecordingInterval = deviceSettings.DBIntervalInt; UseEnergyTotal = true; UseEnergyTotalSet = false; HasStartOfDayEnergyDefect = DeviceSettings.HasStartOfDayEnergyDefect; EstEnergy = new Device.EstimateEnergy(this); ResetDevice(); }
public void OpenSharedMem(int srcChan) { //SampleSource = new ShmemSampleSource("GSM Analyzer", srcChan, 1, 0); SampleSource = new SharedMemDeviceControl(srcChan); SampleSource.SampleSource.DataFormat = ByteUtil.eSampleFormat.Direct16BitIQFixedPointLE; SampleSource.SamplingRateChanged += new EventHandler(SampleSource_SamplingRateChanged); Processing = true; ProcessThread = new Thread(ProcessMain); ProcessThread.Start(); Log.AddMessage("Select your filter again to start decoding."); btnOpen.Text = "Close"; }
private void Demaximize(object sender, RoutedEventArgs e) { DeviceControl control = (DeviceControl)sender; control.Demaximized -= Demaximize; control.maximized = false; ScatterViewItem item = (ScatterViewItem)control.Parent; item.Height = 515; item.Width = 260; item.CanMove = true; item.CanScale = true; item.CanRotate = true; }
public void CloseSource() { if (ProcessThread != null) { Processing = false; ProcessThread.Join(500); ProcessThread.Abort(); ProcessThread = null; } if (SampleSource != null) { SampleSource.CloseControl(); SampleSource = null; } CloseDemod(); }
private void btnOpen_NetworkDevice(object sender, EventArgs e) { SampleSource = new NetworkDeviceControl(); if (!SampleSource.Connected) { MessageBox.Show("Failed to open the device. Reason: " + SampleSource.ErrorMessage); return; } Processing = true; ProcessThread = new Thread(ProcessMain); ProcessThread.Start(); btnOpen.Text = "Close"; return; }
public void AddDevice(IDevice device) { if (device == null || pnlDevices == null) { return; } if (InvokeRequired) { Invoke(new Action <Device>(AddDevice), new object[] { device }); return; } if (IsDisposed) { return; } var deviceControl = new DeviceControl(device); deviceControl.SetDeviceName(device.GetFriendlyName()); deviceControl.SetStatus(device.GetDeviceState(), null); pnlDevices.Controls.Add(deviceControl); device.SetDeviceControl(deviceControl); var filter = GetFilterDevices(); if (filter != null) { deviceControl.Visible = FilterDevices.ShowFilterDevices(device, filter.Value); } // Sort alphabetically. var deviceName = device.GetFriendlyName(); for (int i = 0; i < pnlDevices.Controls.Count - 1; i++) { if (pnlDevices.Controls[i] is DeviceControl recordingDevice) { var name = recordingDevice.GetDeviceName(); if (string.CompareOrdinal(deviceName, name) < 0) { pnlDevices.Controls.SetChildIndex(deviceControl, i); return; } } } }
void readDeviceControl(Dictionary <string, object> control) { DeviceControl newControl = new DeviceControl(); foreach (var item in control) { if (item.Key.Equals("controlDirection")) { newControl.controlDirection = item.Value as string; } else if (item.Key.Equals("controlID")) { newControl.controlID = item.Value as string; } else if (item.Key.Equals("controlName")) { newControl.controlName = item.Value as string; } else if (item.Key.Equals("controlType")) { newControl.controlType = item.Value as string; } else if (item.Key.Equals("deviceID")) { newControl.deviceID = item.Value as string; } else if (item.Key.Equals("groupID")) { newControl.groupID = item.Value as string; } else if (item.Key.Equals("valueCurrent")) { newControl.valueCurrent = item.Value as string; } else if (item.Key.Equals("uniqueID")) { object itemValue = item.Value as object; long itemValInt = Convert.ToInt64(itemValue); newControl.uniqueID = itemValInt; Debug.Log("As Object " + itemValue + " done.... INT: " + itemValInt + " Done..."); } } GlobalData.store.controls.Add(newControl); }
/// <summary> /// 新增一条记录 /// </summary> /// <param name="qcRecord">质检实体</param> /// <returns></returns> public static bool InsertOneDevice(DeviceControl dcl) { bool rbool = true; using (DCCarManagementDataContext db = new DCCarManagementDataContext()) { try { rbool = LinQBaseDao.InsertOne(db, dcl); } catch { rbool = false; } finally { db.Connection.Close(); } } return(rbool); }
public DeviceConfiguration(CreatedDevice[] devices, DeviceControl[] controls) { Devices = devices; Controls = controls; }
public EnergyConsolidationDevice(DeviceControl.DeviceManagerBase deviceManager, DeviceManagerDeviceSettings settings, PeriodType periodType = PeriodType.Day) : base(deviceManager, settings, periodType) { int interval; if (settings.ConsolidationType == ConsolidationType.PVOutput) { PvOutputSiteSettings pvo = GlobalSettings.ApplicationSettings.FindPVOutputBySystemId(settings.PVOutputSystem); if (pvo == null) throw new Exception("EnergyConsolidationDevice - Cannot find PVOutput system - " + settings.PVOutputSystem); interval = pvo.DataIntervalSeconds; } else interval = settings.DBIntervalInt; DeviceParams = new EnergyConsolidationParams(interval); }
public ActiveDevice_Growatt(DeviceControl.DeviceManager_ActiveController<Device.ActiveDevice_Generic> deviceManager, DeviceManagerDeviceSettings deviceSettings) : base(deviceManager, deviceSettings) { }