private async Task ShowDeviceWindow() { DeviceWindow window = new DeviceWindow(); window.Show(); await Task.CompletedTask; }
private DeviceWindow AddDeviceWindow(Device device) { DeviceWindow deviceWindow = new DeviceWindow(); PageDevice page = new PageDevice(); page.SetDevice(device); deviceWindow.SetPage(page); _deviceWindowList.Add(deviceWindow); return deviceWindow; }
/// <summary> /// 设备管理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmiDevice_Click(object sender, EventArgs e) { if (null == deviceWindow || deviceWindow.IsDisposed) { deviceWindow = new DeviceWindow(); deviceWindow.MdiParent = this; deviceWindow.StartLoad += (obj, ev) => { StartLoad(obj); }; deviceWindow.StopLoad += (obj, ev) => { StopLoad(obj); }; deviceWindow.Show(); } SetSelect(null, tsmiDevice); deviceWindow.Activate(); }
public async Task <IActionResult> OnPostSendAsync() //public ActionResult OnPostSend() { var deviceWindow = new DeviceWindow(); var Tifodisplay = new TifoPartScreen(); var devices = new List <DeviceWindow>(); string sPostValue0 = ""; string sPostValue1 = ""; string sPostValue2 = ""; string sPostValue3 = ""; string sPostValue4 = ""; { MemoryStream stream = new MemoryStream(); Request.Body.CopyTo(stream); stream.Position = 0; using (StreamReader reader = new StreamReader(stream)) { string requestBody = reader.ReadToEnd(); if (requestBody.Length > 0) { var obj = JsonConvert.DeserializeObject <DeviceWindow>(requestBody); if (obj != null) { sPostValue0 = obj.DeviceId; sPostValue1 = obj.Width; sPostValue2 = obj.Height; sPostValue3 = obj.DevicePixelRatio; sPostValue4 = obj.DotsPerInch; deviceWindow = obj; Tifodisplay.DotsPerPixel = Convert.ToDecimal(obj.DevicePixelRatio); Tifodisplay.TifoPartScreenHeight = (int)(Convert.ToDecimal(obj.Height) * Tifodisplay.DotsPerPixel); Tifodisplay.TifoPartScreenWidth = (int)(Convert.ToDecimal(obj.Width) * Tifodisplay.DotsPerPixel); Tifodisplay.DotsPerInch = Convert.ToInt32(obj.DotsPerInch); Tifodisplay.AbsScreenHeight = Convert.ToInt32(obj.Height) / Tifodisplay.DotsPerInch * 254 / 10; Tifodisplay.AbsScreenWidth = Convert.ToInt32(obj.Width) / Tifodisplay.DotsPerInch * 254 / 10; //_context.TifoPartScreen.Add(Tifodisplay); Flyttat //await _context.SaveChangesAsync(); } } } var devicesroot = Path.Combine(hostingEnvironment.WebRootPath, "devices"); JsonSerializer serializer = new JsonSerializer(); serializer.NullValueHandling = NullValueHandling.Ignore; using (StreamReader sw1 = new StreamReader(devicesroot + "/devices1.txt")) using (JsonReader reader = new JsonTextReader(sw1)) { devices = serializer.Deserialize <List <DeviceWindow> >(reader); if (devices != null) { if (devices.Where(deviceWindowinList => deviceWindowinList.DeviceId == deviceWindow.DeviceId).Any() == false) { var newdeviceWindow1 = new DeviceWindow() { DeviceId = deviceWindow.DeviceId, Width = deviceWindow.Width, Height = deviceWindow.Height, DevicePixelRatio = deviceWindow.DevicePixelRatio, DotsPerInch = deviceWindow.DotsPerInch }; devices.Add(newdeviceWindow1); // {"ExpiryDate":new Date(1230375600000),"Price":0} _context.TifoPartScreen.Add(Tifodisplay); await _context.SaveChangesAsync(); } } else { var newdeviceWindow1 = new DeviceWindow() { DeviceId = deviceWindow.DeviceId, Width = deviceWindow.Width, Height = deviceWindow.Height, DevicePixelRatio = deviceWindow.DevicePixelRatio, DotsPerInch = deviceWindow.DotsPerInch }; devices = new List <DeviceWindow> { newdeviceWindow1 }; _context.TifoPartScreen.Add(Tifodisplay); await _context.SaveChangesAsync(); } } serializer.NullValueHandling = NullValueHandling.Ignore; using (StreamWriter sw = new StreamWriter(devicesroot + "/devices1.txt")) using (JsonWriter writer = new JsonTextWriter(sw)) { serializer.Serialize(writer, devices); // {"ExpiryDate":new Date(1230375600000),"Price":0} } } List <string> lstString = new List <string> { sPostValue0, sPostValue1, sPostValue2, sPostValue3, sPostValue4 }; return(new JsonResult(lstString)); }
private void DeviceConfig() { var window = new DeviceWindow(); window.ShowDialog(); }
//Debug //private PointerNode _pointer = new PointerNode(PointerRole.Controller); #endregion #region Constructor /// <summary> /// Disables the UI and runs the Login procedure /// </summary> public ActivityBar() { _startupDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); InitializeComponent(); _activityWindow = new ActivityWindow(this); _popUpWindows.Add(_activityWindow); _managerWindow = new ManagerWindow(this); _popUpWindows.Add(_managerWindow); _startMenu = new StartMenu(this); _popUpWindows.Add(_startMenu); _deviceWindow = new DeviceWindow(this); _popUpWindows.Add(_deviceWindow); //MouseHook.Register(); //MouseHook.MouseDown += MouseHookMouseClick; //MouseHook.MouseMove += MouseHookMouseMove; DisableUi(); _login = new LoginWindow(); _login.LoggedIn += LoginLoggedIn; _login.Show(); }