public void Start() { try { mRTStylus = new RealTimeStylus(mParent); mPlugin = new SimpleStylusPlugin(this); mRTStylus.SyncPluginCollection.Add(mPlugin); Guid[] g = new Guid[] { PacketProperty.X, PacketProperty.Y, PacketProperty.NormalPressure, PacketProperty.XTiltOrientation, PacketProperty.YTiltOrientation }; mRTStylus.SetDesiredPacketDescription(g); Tablets theTablets = new Tablets(); string theReport = Environment.NewLine; foreach (Tablet theTablet in theTablets) { if (theTablet.IsPacketPropertySupported(PacketProperty.NormalPressure)) { TabletPropertyMetrics theMetrics = theTablet.GetPropertyMetrics(PacketProperty.NormalPressure); mMaxPressure = theMetrics.Maximum; } } mRTStylus.Enabled = true; } catch (System.Exception ex) { CoreGlobals.getErrorManager().OnSimpleWarning(ex.ToString()); } }
public ActionResult Tablets() { Logger.InitLogger(); ArrayList allData = new ArrayList(); try { Tablets load_tab = new Tablets(); load_tab.PingAndLoadTablets(); allData.Add(load_tab); Ping myPing = new Ping(); PingReply reply = null; foreach (var data in load_tab.Data3) { reply = myPing.Send(data.IP, 5000); if (reply.Status.ToString() != "TimedOut") { data.Tablets_Status = "В сети"; } else { data.Tablets_Status = "Не в сети"; } } } catch { } Logger.Log.Info("Выполнен AJAX-запрос, планшеты опрошены"); return(PartialView(allData)); }
public ActionResult Create(Tablets tablets) { if (ModelState.IsValid) { string imagename = Path.GetFileNameWithoutExtension(tablets.Image3.FileName); string extension = Path.GetExtension(tablets.Image3.FileName); HttpPostedFileBase serverimage = tablets.Image3; int size = serverimage.ContentLength; if (extension.ToLower() == ".jpg" || extension.ToLower() == ".jpeg" || extension.ToLower() == ".png") { if (size <= 2000000) { imagename = imagename + extension; tablets.photo = "~/tabletfiles/" + imagename; imagename = Path.Combine(Server.MapPath("~/tabletfiles/"), imagename); tablets.Image3.SaveAs(imagename); db.Tablets.Add(tablets); db.SaveChanges(); ModelState.Clear(); } else { ViewBag.msg = "<script>alert('invalid error')</script>"; } } else { ViewBag.msg = "<script>alert('Wrong Extension')</script>"; } } return(View()); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Model,Processor,RAM,GPU,Resolution,Battery")] Tablets tablets) { if (id != tablets.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tablets); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TabletsExists(tablets.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tablets)); }
public ActionResult DeleteConfirmed(int id) { Tablets tablets = db.Tablets.Find(id); db.Tablets.Remove(tablets); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Model,Dies,Max_pressure,Max_diameter,Max_depth,Production_capacity,machine_size,net_weight,power,Price_")] Tablets tablets) { if (ModelState.IsValid) { db.Entry(tablets).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tablets)); }
public async Task <IActionResult> Create([Bind("Id,Name,Model,Processor,RAM,GPU,Resolution,Battery")] Tablets tablets) { if (ModelState.IsValid) { _context.Add(tablets); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tablets)); }
// GET: Tablets/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tablets tablets = db.Tablets.Find(id); if (tablets == null) { return(HttpNotFound()); } return(View(tablets)); }
public ActionResult Index(string inputID, string inputName, string inputPlaceN, string inputLine, string inputTurno) { Logger.InitLogger(); if (inputID == "" || inputName == "" || inputPlaceN == "" || inputLine == "" || inputTurno == "") { return(Content("<script language='javascript' type='text/javascript'>alert('Одно из полей пусто!');window.location.href = 'Index';</script>")); } else { try { using (SqlConnection cn = new SqlConnection()) { cn.ConnectionString = @"Data Source=patrin.ddns.net,1433;Initial Catalog=OIProject;Persist Security Info=True;User ID=sa;Password=18swlgnm"; cn.Open(); using (SqlCommand command = cn.CreateCommand()) { command.CommandText = string.Format("INSERT INTO Employee (ID, PlaceN, Line, Name, Turno) VALUES ('{0}','{1}','{2}','{3}','{4}')", inputID, inputPlaceN, inputLine, inputName, inputTurno); command.ExecuteNonQuery(); command.CommandText = string.Format("INSERT INTO Auth (ID, Password, Powers) VALUES ('{0}','{1}','{2}')", inputID, "0000", "Работник"); command.ExecuteNonQuery(); } cn.Close(); Employess load = new Employess(); Tablets load_tab = new Tablets(); Defects load_def = new Defects(); ArrayList allData = new ArrayList(); load.LoadData(); load_tab.PingAndLoadTablets(); load_def.LoadDefects(); allData.Add(load); allData.Add(load_def); allData.Add(load_tab); Logger.Log.Info("Добавление работника в БД"); return(View(allData)); } } catch (Exception ex) { Logger.Log.Error(ex.Message); return(Content("<script language='javascript' type='text/javascript'>alert('Ошибка в ходе добавления!" + ex.Message + "');window.location.href = 'Index';</script>")); } } }
public TabletDriver([NotNull] ICompositeDeviceHub deviceHub, [NotNull] IReportParserProvider reportParserProvider, [NotNull] IDeviceConfigurationProvider configurationProvider) : base(deviceHub, reportParserProvider, configurationProvider) { Log.Output += (sender, logMessage) => Logger.Log($"{logMessage.Group}: {logMessage.Message}", level: (LogLevel)logMessage.Level); deviceHub.DevicesChanged += (sender, args) => { // it's worth noting that this event fires on *any* device change system-wide, including non-tablet devices. if (!Tablets.Any() && args.Additions.Any()) { cancellationSource?.Cancel(); cancellationSource = new CancellationTokenSource(); Task.Run(() => detectAsync(cancellationSource.Token), cancellationSource.Token); } }; }
public void AddToBasketTwoProducts() { HuaweiMainPage page = new HuaweiMainPage(driver); Smartphones smartPhonespage = page.OpenHomePage() .OpenSmartphones() .AddToBasketPhoneMate30Pro(); Tablets tabletsPage = page.OpenTablets() .AddToBasketMatePad(); int basketPage = page.OpenBasketPage() .GetPrice() .GetTotalPriceOfTwoProducts(); Assert.AreEqual(basketPage, FirstTestExpectedResult); }
public static List <Tablets> OutDGVToTabletsList(DataGridView dgv) { List <Tablets> tablets = new List <Tablets>(); foreach (DataGridViewRow row in dgv.Rows) { string name = row.Cells["OutputGDVName"].Value.ToString(); int memory = (int)Convert.ChangeType(row.Cells["OutputGDVAmmountOfMemory"].Value, typeof(int)); int raiting = (int)Convert.ChangeType(row.Cells["OutputGDVRaiting"].Value, typeof(int)); int coast = (int)Convert.ChangeType(row.Cells["OutputGDVCount"].Value, typeof(int)); Tablets tablet = new Tablets { Model = name, AmoutOfMemory = memory, Raiting = raiting, Coast = coast }; tablets.Add(tablet); } return(tablets); }
public void OnGet() { var chuildPhoneCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 1); foreach (var item in chuildPhoneCategory) { var phone = _itemRepository.GetByCategory(item.Id); foreach (var _phone in phone) { Phones.Add(_phone); } } var chuildLaptopCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 2); foreach (var item in chuildLaptopCategory) { var laptop = _itemRepository.GetByCategory(item.Id); foreach (var _laptop in laptop) { Laptops.Add(_laptop); } } var chuildTabletCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 3); foreach (var item in chuildTabletCategory) { var tablet = _itemRepository.GetByCategory(item.Id); foreach (var _tablet in tablet) { Tablets.Add(_tablet); } } var chuildAccessorieCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 4); foreach (var item in chuildAccessorieCategory) { var accessorie = _itemRepository.GetByCategory(item.Id); foreach (var _accessorie in accessorie) { Accessories.Add(_accessorie); } } var cus = _userManager.GetUserAsync(HttpContext.User).Result; }
public ActionResult Index() { try { Logger.InitLogger(); ClaimsIdentity user = (ClaimsIdentity)(User.Identity); string type = string.Empty; string right = string.Empty; IEnumerable <Claim> claims = user.Claims; try { type = claims.ElementAt(4).Type; right = claims.ElementAt(4).Value; } catch (Exception ex) { Logger.Log.Error("Попытка несанкционированного доступа!" + ex.Message); return(Redirect("/Account/Login")); } if (type == "Rights" && right == "Администратор" || right == "Работник ОК") { string browser = HttpContext.Request.Browser.Browser; string user_agent = HttpContext.Request.UserAgent; Employess load = new Employess(); Tablets load_tab = new Tablets(); Defects load_def = new Defects(); ArrayList allData = new ArrayList(); load.LoadData(); load_tab.PingAndLoadTablets(); load_def.LoadDefects(); allData.Add(load); allData.Add(load_def); allData.Add(load_tab); if (user_agent.Contains("Chrome") || (user_agent.Contains("Mozilla"))) { Logger.Log.Info("Загружена главная страница"); return(View(allData)); } else { return(Content("<script language='javascript' type='text/javascript'>alert('Сайт в данном браузере работает некорректно! Дальнейшая работа невозможна!');window.location.href = 'Index';</script>")); } } else { return(View("ErrorRight")); } } catch (Exception ex) { return(Content("<script language='javascript' type='text/javascript'>alert('Ошибка загрузки главной страницы!" + ex.Message + "');window.location.href = 'Index';</script>")); } }
public TabletForm() : base() { this.Closed += new System.EventHandler(TabletFormClosed); Tablets tablets = new Tablets(); Console.WriteLine("[" + tablets.Count + "] pointing devices found"); Tablet tablet = tablets.DefaultTablet; Console.WriteLine("Default tablet name [" + tablet.Name + "]"); Console.WriteLine("Hardware capabilities [" + tablet.HardwareCapabilities + "]"); tabletSettings.MaxX = tablet.GetPropertyMetrics(PacketProperty.X).Maximum; tabletSettings.MaxY = tablet.GetPropertyMetrics(PacketProperty.Y).Maximum; tabletSettings.MaxNPressure = tablet.GetPropertyMetrics(PacketProperty.NormalPressure).Maximum; rts = new RealTimeStylus(this.Handle, tablet); rts.AsyncPluginCollection.Add(new TabletAsyncPlugin(this)); rts.Enabled = true; //TODO call dispose on dispose Log("Tablet initialized"); }
public string TabletSelector() { tablet = (Tablets)EditorGUILayout.EnumPopup("Device:", tablet); return(tablet.ToString()); }