/// <summary> /// Update the mouse manager. /// </summary> public override void Update(bool isActive) { //clear out the taps & touches Clicks.Clear(); Highlights.Clear(); Drags.Clear(); Drops.Clear(); Flicks.Clear(); Pinches.Clear(); if (null != Pinch) { //reset the pinch delta Pinch.Delta = 0f; } if (isActive) { TouchCollection = TouchPanel.GetState(); //get the new taps & touches GetGestures(); GetTouches(); } //Add the pinch event if there is an ongoing gesture if (null != Pinch) { Pinches.Add(new PinchEventArgs(Pinch.Delta)); } }
public Template(String name, String appPath = null, bool init = false) { Name = name ?? DEFAULT_TEMPLATE_NAME; AppPath = appPath; if (init) { Clicks.Add(new Click()); } }
private void AddVerticle() { var line = (SelectedObject as Line); Point newVerticlePoint = Clicks.Last(); var newLine = (line.ParentGraphicObject as Poligon).InsertLine(line, newVerticlePoint); GraphicObjects.Add(newLine.Guid, newLine); GraphicObjects.Add(newLine.StartVerticle.Guid, newLine.StartVerticle); Redraw(); }
//private readonly Action _graphicObjectSelected; //private readonly Action _verticleSelected; //private readonly Func<int, bool> _lineSelected; //private readonly Action _nullSelected; //private readonly Action _circleSelected; private void DrawCircle() { var circle = new Circle(Clicks.Last(), Radius, Drawing, GuidMapLogic, Width); GraphicObjects.Add(circle.Guid, circle); circle.DrawItself(); circle.DrawOnGuidMap(); //GuidMapLogic.SetOnMap(circle); Clicks.Clear(); }
/// <summary> /// Calculates the keys per second every frame. /// </summary> private void CalculateKeysPerSecond() { for (var i = 0; i < Clicks.Count; i++) { if (Clicks[i] <= Time - 1000) { Clicks.RemoveAt(i); } } }
public void SetAction(FormAction action) { if (_formAction == FormAction.SelectLine && action != FormAction.SelectLine) { Redraw(); } if (NewObjectsActions.Contains(action)) { SelectedObject = null; //_clicksOther.Clear(); } _formAction = action; if (action == FormAction.StartDrawPolygon) { _buttonControl.StartDrawingPoligon(); Clicks.Clear(); } if (action == FormAction.StopDrawPolygon) { StopDrawPolygon(); } else if (action == FormAction.ClearBitmap) { ClearMap(); } else if (action == FormAction.DeleteObject) { DeleteObject(); } else if (action == FormAction.DrawCircleOptimized) { _buttonControl.CircleSelected(Radius); } else if (action == FormAction.AddVerticle) { AddVerticle(); } else if (action == FormAction.SetHorizontal) { SetHorizontal(); } else if (action == FormAction.SetVertical) { SetVertical(); } else if (action == FormAction.SetConcrentic) { Clicks.Clear(); ConnectedCircles.Clear(); } //else if(action == FormAction.RedrawBitmap) // Redraw(); }
private void MoveObject() { var line = (SelectedObject as Line); var pointOnLine = Clicks[Clicks.Count - 2]; int diffOnX = Clicks.Last().X - pointOnLine.X; int diffOnY = Clicks.Last().Y - pointOnLine.Y; SelectedObject.Move(diffOnX, diffOnY); Redraw(); }
private void DrawLine() { if (Clicks.Count == 2) { var line = new Line(Clicks[0], Clicks[1], Width, Drawing, GuidMapLogic); line.DrawItself(); GraphicObjects.Add(line.Guid, line); GraphicObjects.Add(line.StartVerticle.Guid, line.StartVerticle); GraphicObjects.Add(line.EndVerticle.Guid, line.EndVerticle); line.DrawOnGuidMap(); Clicks.Clear(); } }
private void MoveVerticle() { if (SelectedObject?.GraphicObjectType != GraphicObjectType.Verticle) { return; } Verticle verticle = (SelectedObject as Verticle); verticle.Point = Clicks.Last(); SelectedObject = null; Redraw(); }
private void StartDrawingPolygon() { if (Clicks.Count == 1) { Poligon poligon = new Poligon(Drawing, GuidMapLogic); CurrentPolygon = poligon; GraphicObjects.Add(poligon.Guid, poligon); return; } var line = new Line(Clicks[Clicks.Count - 2], Clicks.Last(), Width, Drawing, GuidMapLogic, CurrentPolygon); CurrentPolygon.AddLine(line); line.DrawItself(); }
public void Merge(MouseActData additionLog) { LastPoint = additionLog.LastPoint; Delta += additionLog.Delta; Path += additionLog.Path; foreach (MouseButtons mb in additionLog.Clicks.Keys) { if (!Clicks.ContainsKey(mb)) { Clicks.Add(mb, 0); } Clicks[mb] += additionLog.Clicks[mb]; } }
public void Click(Point point) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Clicks.Add(point); switch (_formAction) { case FormAction.SetPixel: CreatePoint(); break; case FormAction.DrawLine: DrawLine(); break; case FormAction.StartDrawPolygon: StartDrawingPolygon(); break; case FormAction.SelectLine: SelectObject(); break; case FormAction.DrawCircleOptimized: DrawCircle(); break; case FormAction.RedrawBitmap: Redraw(); break; case FormAction.MoveObject: MoveObject(); break; case FormAction.MoveVerticle: MoveVerticle(); break; case FormAction.SetConcrentic: SetConcrentic(); break; } stopWatch.Stop(); _timeTextBox.Text = stopWatch.Elapsed.TotalSeconds.ToString(); }
public async Task <GraphInfo> GetLastYearClicksAsync(string linkId, string userId, DateTime first) { bool isLinkIdNull = (linkId == null); List <ClicksCount> clicks = await Clicks .Where(c => c.Link.OwnerId == userId) .Where(c => isLinkIdNull ? true : c.LinkId == linkId) .Where(c => c.DateTime > first) .GroupBy(c => (int)c.DateTime.Subtract(first).TotalDays) .Select(group => new ClicksCount { Time = group.Key, Count = group.Count() }) .ToListAsync(); return(GetGraphInfo(366, clicks, first, 2)); }
/// <summary> /// Update the mouse manager. /// </summary> public override void Update(bool isActive) { //clear out the taps & touches Clicks.Clear(); Highlights.Clear(); Drags.Clear(); Drops.Clear(); Flicks.Clear(); Pinches.Clear(); Holds.Clear(); if (null != Pinch) { //reset the pinch delta Pinch.Delta = 0f; } if (isActive && IsEnabled) { TouchCollection = TouchPanel.GetState(); //get the new taps & touches GetGestures(); GetTouches(); } //Add the pinch event if there is an ongoing gesture if (null != Pinch) { if (Pinch.Finished) { Pinches.Add(new PinchEventArgs(Pinch.First, Pinch.Second, Pinch.Delta) { Release = true }); Pinch = null; } else { Pinches.Add(new PinchEventArgs(Pinch.First, Pinch.Second, Pinch.Delta)); } } }
private void SetConcrentic() { Guid mapGuid = GuidMapLogic.GuidMap[Clicks.Last().X + Clicks.Last().Y *Drawing.Width]; GraphicObject graphicObject = null; //Guid mapGuiFirstCircle = GuidMapLogic.GuidMap[Clicks.First().X + Clicks.First().Y * Drawing.Width]; if (mapGuid != Guid.Empty) { ConnectedCircle connectedCircle; graphicObject = GraphicObjects[mapGuid]; if (GraphicObjects[mapGuid].GraphicObjectType == GraphicObjectType.Circle) { ConnectedCircles.Add(GraphicObjects[mapGuid] as Circle); } if (graphicObject.GraphicObjectType == GraphicObjectType.Circle) { var firstCircle = ConnectedCircles.FirstOrDefault(); var circle = ConnectedCircles.LastOrDefault(); if (ConnectedCircles.Count > 1) { if (firstCircle.ParentGraphicObject == null) { connectedCircle = new ConnectedCircle(firstCircle, circle, Drawing, GuidMapLogic); firstCircle.ParentGraphicObject = connectedCircle; circle.ParentGraphicObject = connectedCircle; circle.Center = firstCircle.Center; GraphicObjects.Add(connectedCircle.Guid, connectedCircle); } else { circle.Center = firstCircle.Center; (firstCircle.ParentGraphicObject as ConnectedCircle).AddCircle(circle); } } } } Redraw(); }
private void MainBotForm_Load(object sender, EventArgs e) { DebugPictureBox = DebugImageBox; BotLogTextbox = BotLog; SelectedEmuInstance = EmulatorInstComboBox; Adb = new ADB(); Clicks = new Clicks(); ImageSearch = new ImageSearchClass(); CaptureImage = new CaptureImage(); Nox = new Nox(); foreach (var item in Nox.ListNoxInstances()) { Log(item); SelectedEmuInstance.Items.Add(item); SelectedEmuInstance.SelectedIndex = 0; } }
//Click on any Template public static void SelectTemplate() { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(POS_On_Demand)); try { AnyTemplate.Click(); Clicks.ScrollToViewElement(CreateYourDesign); Wait.WaitVisible(CreateYourDesign, 10); CreateYourDesign.Click(); } catch (Exception e) { logger.Error("Pos on demand failed due to : " + e); //**Closing browser Driver.Quit(); throw e; } }
private void StopDrawPolygon() { if (Clicks.Count > 2) { var line = new Line(Clicks.Last(), Clicks.First(), Width, Drawing, GuidMapLogic, CurrentPolygon); CurrentPolygon.AddLastLine(line); line.DrawItself(); CurrentPolygon .Lines.ForEach(poligonLine => GraphicObjects.Add(poligonLine.Guid, poligonLine)); CurrentPolygon .Verticies.ForEach(poligonVerticle => GraphicObjects.Add(poligonVerticle.Guid, poligonVerticle)); CurrentPolygon.DrawOnGuidMap(); //GuidMapLogic.SetOnMap(CurrentPolygon); } _buttonControl.StopDrawingPoligon(); Clicks.Clear(); }
//Click on Cancel in Create Deisgn page public static void ClickOnCancel() { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(CreateDesignPage)); try { Clicks.ScrollToViewElement(CreateDesignCancel); Wait.WaitVisible(CreateDesignCancel, 10); CreateDesignCancel.Click(); test.Pass("Click on Cancel passed."); } catch (Exception e) { Console.Write("Click On Cancel failed."); //**Closing browser Driver.Quit(); throw e; } }
private void SelectObject() { GraphicObject graphicObject = null; Guid mapGuid = GuidMapLogic.GuidMap[Clicks.Last().X + Clicks.Last().Y *Drawing.Width]; if (mapGuid == Guid.Empty) { //Clicks.Clear(); return; } if (mapGuid != Guid.Empty) { graphicObject = GraphicObjects[mapGuid]; SelectedObject = graphicObject; Redraw(); HighlightObject(); } //Clicks.Clear(); //return graphicObject; }
public ActionResult Clicks(CompanyViewModel companyViewModel) { using (var context = new ApplicationDbContext()) { var currentUser = System.Web.HttpContext.Current.GetOwinContext() .GetUserManager <ApplicationUserManager>() .FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); var clicks = context.Clicks .Where(p => p.UserId == currentUser.Id && p.CompanyId == companyViewModel.Id).ToList(); Session["CompanyToGo"] = companyViewModel.Link; var company = context.Companies.Find(companyViewModel.Id); //'Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.' if (clicks.Count == 0) { var click = new Clicks(); click.UserId = currentUser.Id; click.CompanyId = companyViewModel.Id; context.Clicks.Add(click); company.Count = company.Count + 1; company.UniqueCount = company.UniqueCount + 1; context.SaveChanges(); } else { company.Count = company.Count + 1; context.SaveChanges(); } } return(RedirectToAction("Payments", companyViewModel)); }
//Share Template public static void ShareTemplate(string sendermailid) { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(ShareTemplatePage)); try { Wait.WaitForPageToLoad(); Wait.WaitVisible(SenderMail, 30); SenderMail.Type(sendermailid); Wait.WaitVisible(Send, 10); Clicks.ScrollToViewElement(Send); Send.Click(); string msg = ConfirmationMsgPopup.GetText(); Console.WriteLine("Message is " + msg); } catch (Exception e) { logger.Error("Share Template is failed due to: " + e); //**Closing browser Driver.Quit(); throw e; } }
/// <summary> /// Adds a click to the KPS times. /// </summary> public void AddClick() => Clicks.Add(Time);
/// <summary> /// Adds a click to the KPS times. /// </summary> public void AddClick() { Clicks.Add(Time); Value = Kps.ToString(); }
private void CreatePoint() { Drawing.SetPixel(Clicks.Last(), Width); Clicks.Clear(); }
/// <summary> /// get all the current tap gestures /// </summary> private void GetGestures() { //go through the taps and get all the new ones while (TouchPanel.IsGestureAvailable) { GestureSample gesture = TouchPanel.ReadGesture(); switch (gesture.GestureType) { case GestureType.Tap: { var position = ConvertCoordinate(gesture.Position); Clicks.Add(new ClickEventArgs() { Position = position, Button = MouseButton.Left }); } break; case GestureType.DoubleTap: { var position = ConvertCoordinate(gesture.Position); Clicks.Add(new ClickEventArgs() { Position = position, Button = MouseButton.Left, DoubleClick = true, }); } break; case GestureType.Flick: { AddFlickEvent(gesture.Delta); } break; case GestureType.Pinch: { var position1 = ConvertCoordinate(gesture.Position); var position2 = ConvertCoordinate(gesture.Position2); if (null == Pinch) { Pinch = new PinchManager(position1, position2); } else { Pinch.Update(position1, position2); } } break; case GestureType.PinchComplete: { Pinch = null; } break; } } }
public string[] GetData() { return(new string[] { name, type, price.ToString() + "$", count.ToString(), unit, CR.ToString(), CTR.ToString(), Users.ToString(), Clicks.ToString(), Views.ToString(), UserPrice.ToString() + "$" }); }
private void ThreadLaunch(Timeline timeline, TimelineHandler handler) { try { _log.Trace($"Attempting new thread for: {handler.HandlerType}"); Thread t = null; ThreadJob threadJob = new ThreadJob { Id = Guid.NewGuid().ToString(), Handler = handler }; switch (handler.HandlerType) { case HandlerType.NpcSystem: NpcSystem npc = new NpcSystem(handler); break; case HandlerType.Command: t = new Thread(() => { Cmd o = new Cmd(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); threadJob.ProcessName = ProcessManager.ProcessNames.Command; break; case HandlerType.Word: _log.Trace("Launching thread for word"); if (_isWordInstalled) { var pids = ProcessManager.GetPids(ProcessManager.ProcessNames.Word).ToList(); if (pids.Count > timeline.TimeLineHandlers.Count(o => o.HandlerType == HandlerType.Word)) { return; } t = new Thread(() => { WordHandler o = new WordHandler(timeline, handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); threadJob.ProcessName = ProcessManager.ProcessNames.Word; } break; case HandlerType.Excel: _log.Trace("Launching thread for excel"); if (_isExcelInstalled) { var pids = ProcessManager.GetPids(ProcessManager.ProcessNames.Excel).ToList(); if (pids.Count > timeline.TimeLineHandlers.Count(o => o.HandlerType == HandlerType.Excel)) { return; } t = new Thread(() => { ExcelHandler o = new ExcelHandler(timeline, handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); threadJob.ProcessName = ProcessManager.ProcessNames.Excel; } break; case HandlerType.Clicks: _log.Trace("Launching thread to handle clicks"); t = new Thread(() => { Clicks o = new Clicks(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); break; case HandlerType.Reboot: _log.Trace("Launching thread to handle reboot"); t = new Thread(() => { Reboot o = new Reboot(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); break; case HandlerType.PowerPoint: _log.Trace("Launching thread for powerpoint"); if (_isPowerPointInstalled) { var pids = ProcessManager.GetPids(ProcessManager.ProcessNames.PowerPoint).ToList(); if (pids.Count > timeline.TimeLineHandlers.Count(o => o.HandlerType == HandlerType.PowerPoint)) { return; } t = new Thread(() => { PowerPointHandler o = new PowerPointHandler(timeline, handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); threadJob.ProcessName = ProcessManager.ProcessNames.PowerPoint; } break; case HandlerType.Outlook: _log.Trace("Launching thread for outlook - note we're not checking if outlook installed, just going for it"); //if (this.IsOutlookInstalled) //{ t = new Thread(() => { Outlook o = new Outlook(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); threadJob.ProcessName = ProcessManager.ProcessNames.Outlook; //} break; case HandlerType.BrowserIE: //IE demands COM apartmentstate be STA so diff thread creation required t = new Thread(() => { BrowserIE o = new BrowserIE(handler); }); t.SetApartmentState(ApartmentState.STA); t.IsBackground = true; t.Name = threadJob.Id; t.Start(); break; case HandlerType.Notepad: //TODO t = new Thread(() => { Notepad o = new Notepad(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); break; case HandlerType.BrowserChrome: t = new Thread(() => { BrowserChrome o = new BrowserChrome(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); threadJob.ProcessName = ProcessManager.ProcessNames.Chrome; break; case HandlerType.BrowserFirefox: t = new Thread(() => { BrowserFirefox o = new BrowserFirefox(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); threadJob.ProcessName = ProcessManager.ProcessNames.Firefox; break; case HandlerType.Watcher: t = new Thread(() => { Watcher o = new Watcher(handler); }) { IsBackground = true, Name = threadJob.Id }; t.Start(); //threadJob.ProcessName = ProcessManager.ProcessNames.Watcher; break; } if (threadJob.ProcessName != null) { _threadJobs.Add(threadJob); } if (t != null) { _threads.Add(t); } } catch (Exception e) { _log.Error(e); } }
private void ButtonClick(object sender, EventArgs e) { int count = 0; Button buttonone = sender as Button; buttonone.Image = ((Button)sender).Image; switch (clickbtn) { case Clicks.one: newButton = new Button(); newButton = sender as Button; ChangeImage = buttonone.Image; for (int i = 0; i < pictures.Length; i++) { if (ChangeImage.Equals(pictures[i])) { butonOne = i; } } clickbtn = Clicks.two; break; case Clicks.two: ChangeImage2 = buttonone.Image; for (int i = 0; i < pictures.Length; i++) { if (ChangeImage2.Equals(pictures[i])) { butonTwo = i; } } buttonone.Image = pictures[butonOne]; newButton.Image = pictures[butonTwo]; storedImage = pictures[butonOne]; pictures[butonOne] = pictures[butonTwo]; pictures[butonTwo] = storedImage; count = listBox1.Items.Count; listBox1.Items.Clear(); control(); totalMove++; if (listBox1.Items.Count >= count) { if ((listBox1.Items.Count - count) == 0) { falseMove = falseMove + 2; } if ((listBox1.Items.Count - count) == 1) { trueMove = trueMove + 1; falseMove = falseMove + 1; } if ((listBox1.Items.Count - count) == 2) { trueMove = trueMove + 2; } } if (listBox1.Items.Count == 5) { MessageBox.Show("Puzzle Tamamlandı!"); MessageBox.Show("ToplamHamle:" + totalMove); MessageBox.Show("yanlis Sayisi:" + falseMove); MessageBox.Show("doğruSayisi" + trueMove); skorHesapla(); button0.Enabled = false; button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; button5.Enabled = false; button6.Enabled = false; button7.Enabled = false; button8.Enabled = false; button9.Enabled = false; button10.Enabled = false; button11.Enabled = false; button12.Enabled = false; button13.Enabled = false; button14.Enabled = false; button15.Enabled = false; } ChangeImage = null; ChangeImage2 = null; clickbtn = Clicks.one; break; } }