/// <summary> /// Raises the MouseDown event. /// </summary> /// <param name="e">A MouseEventArgs that contains the event data.</param> protected override void OnMouseDown(MouseEventArgs e) { // Cannot process a message for a disposed control if (!IsDisposed && !Disposing && !RootInstance.IsDisposed) { // Do we have a manager for processing mouse messages? if (GetViewManager() != null) { // Convert from control to parent control coordinates Point rootPoint = RootInstance.PointToClient(PointToScreen(new Point(e.X, e.Y))); // Use the root controls view manager to process the event GetViewManager().MouseDown(new MouseEventArgs(e.Button, e.Clicks, rootPoint.X, rootPoint.Y, e.Delta), new Point(e.X, e.Y)); } // If the root control does not have focus, then give it the focus now if (!RootInstance.ContainsFocus && RootInstance.CanSelect) { // Do not change focus at design time because if (!InDesignMode) { RootInstance.Focus(); } } } // Let base class fire events base.OnMouseDown(e); }
/// <summary> /// Gets the instance by identifier. /// </summary> /// <param name="requiredNamespace">The required namespace.</param> /// <param name="locale">The locale.</param> /// <param name="instanceId">The creature identifier.</param> /// <returns></returns> public static async Task <RootInstance> GetInstanceById(string requiredNamespace, string locale, int instanceId) { Console.WriteLine("Début de la recherche d'une instance via son ID"); UriBuilder uriBuilder = new UriBuilder(baseURL); uriBuilder.Path = $"data/wow/journal-instance/" + instanceId.ToString(); var query = HttpUtility.ParseQueryString(uriBuilder.Query); query["namespace"] = requiredNamespace; query["locale"] = locale; uriBuilder.Query = query.ToString(); var request = AuthentificationRepoAPI.CreateHttpRequest(HttpMethod.Get, uriBuilder.Uri); var response = httpClient.SendAsync(request).Result; var content = await response.Content.ReadAsStringAsync(); if (content != null) { RootInstance result = JsonConvert.DeserializeObject <RootInstance>(content); if (result != null) { Console.WriteLine("Récupération de l'instance OK"); return(result); } } Console.WriteLine("Récupération de l'instance KO"); return(null); }
public EitherAsync <Error, TResponse> Handle(TRequest request) { var logger = Log.ForContext(RootInstance.GetType()); logger.Debug("Handling request {@Request}", request); var result = Decoratee.Handle(request) .Do(_ => logger.Debug("Request handling complete.")); return(result); }
public EitherAsync <Error, TResponse> Execute(TParam param) { var logger = Log.ForContext(RootInstance.GetType()); logger.Debug("Executing query {@QueryParam}", param); var result = Decoratee.Execute(param) .Do(_ => logger.Debug("Query execution complete.")); return(result); }
private void CreateItem(DragEventArgs args, Type type, LogicalInstance logicalInstance) { GraphicInstance graphicInstance = null; if (InstancesManager.Instance.CanvasRootElement == null) { graphicInstance = new RootInstance { LogicalInstance = logicalInstance }; } else { graphicInstance = CreateGraphicVisualizedInstance(type, logicalInstance, args); } InstancesManager.Instance.InstancesContext.GraphicInstances.Add(graphicInstance); InstancesManager.Instance.AddInstance(graphicInstance); InstancesManager.Instance.InstancesContext.SubmitChanges(); }
protected override void OnDropOverride(Microsoft.Windows.DragEventArgs args) { ItemDragEventArgs rawObject = args.Data.GetData(args.Data.GetFormats()[0]) as ItemDragEventArgs; Type type = (rawObject.Data as System.Collections.ObjectModel.SelectionCollection).First().Item as Type; if (CanAddItem(null, type)) { LogicalInstance logicalInstance = new LogicalInstance { Name = "anonymous " + (Activator.CreateInstance(type) as ObjectType).TypeName, Type = type.FullName }; InstancesManager.Instance.InstancesContext.LogicalInstances.Add(logicalInstance); GraphicInstance graphicInstance = new RootInstance { LogicalInstance = logicalInstance }; InstancesManager.Instance.InstancesContext.GraphicInstances.Add(graphicInstance); InstancesManager.Instance.AddInstance(graphicInstance); InstancesManager.Instance.InstancesContext.SubmitChanges(); } }
/// <summary> /// Raises the MouseUp event. /// </summary> /// <param name="e">A MouseEventArgs that contains the event data.</param> protected override void OnMouseUp(MouseEventArgs e) { // Cannot process a message for a disposed control if (!IsDisposed && !Disposing && !RootInstance.IsDisposed) { // Do we have a manager for processing mouse messages? if (GetViewManager() != null) { // Convert from control to parent control coordinates Point rootPoint = RootInstance.PointToClient(PointToScreen(new Point(e.X, e.Y))); // Use the root controls view manager to process the event GetViewManager().MouseUp(new MouseEventArgs(e.Button, e.Clicks, rootPoint.X, rootPoint.Y, e.Delta), new Point(e.X, e.Y)); } } // Let base class fire events base.OnMouseUp(e); }