/// <summary> /// Starts a remove <paramref name="hook"/> if the app is already cached. /// </summary> /// <returns>The running hook; <c>null</c> if the app was not cached.</returns> private Process?StartRemoveHook(RemoveHook hook) { if (Handler.Verbosity == Verbosity.Batch) { Log.Info($"Skipped remove hook {hook.ID} for {InterfaceUri} because running in batch mode"); return(null); } Log.Debug($"Solving remove hook {hook.ID} for {InterfaceUri}"); var selections = SolveOffline(hook.Command); if (selections == null) { Log.Info($"Skipped remove hook {hook.ID} for {InterfaceUri} because the app is not cached"); return(null); } return(Executor.Inject(selections) .AddArguments(hook.Arguments.Select(x => x.Value).ToArray()) .Start()); }
public HooksModule(View chart, DrawingCanvas HooksLayer, DrawingCanvas HookPriceLayer, DrawingCanvas HookTimeLayer, Func <Pen> GetCursorPen, CenterIndicatorManger CenterIndicatorManger, List <FrameworkElement> OtherLayers) : base(chart) { this.OtherLayers = OtherLayers; this.HooksLayer = HooksLayer; this.HookPriceLayer = HookPriceLayer; this.HookTimeLayer = HookTimeLayer; this.GetCursorPen = GetCursorPen; this.CIM = CenterIndicatorManger; this.SetMenuAct = chart.Shell.SetMenu; Chart.VerticalСhanges += () => Task.Run(() => ResizeHook?.Invoke()); Chart.HorizontalСhanges += () => Task.Run(() => ResizeHook?.Invoke()); Chart.ChartGrid.MouseEnter += (s, e) => Chart.Interaction = MoveHook; Chart.ChartGrid.MouseLeave += (s, e) => { if (Chart.Interaction == MoveHook) { Chart.Interaction = null; } }; Chart.HookElement = HookElement; Chart.Shell.RemoveHooks += () => Task.Run(() => RemoveHook?.Invoke()); Chart.Shell.ToggleInteraction += b => { if (b) { RemoveHook = null; } else { Task.Run(() => { if (Manipulating) { Chart.Window.EndMoving(Dispatcher); } RemoveHook = RemoveLastHook; Dispatcher.Invoke(() => { foreach (var l in OtherLayers) { l.Visibility = Visibility.Visible; } ShadowVisual.RenderOpen().Close(); ShadowPriceVisual.RenderOpen().Close(); ShadowTimeVisual.RenderOpen().Close(); OverVisual.RenderOpen().Close(); OverPriceVisual.RenderOpen().Close(); OverTimeVisual.RenderOpen().Close(); }); }); } }; HooksLayer.AddVisual(ShadowVisual); HooksLayer.AddVisual(OverVisual); HooksLayer.AddVisual(PointVisual); HookPriceLayer.AddVisual(ShadowPriceVisual); HookPriceLayer.AddVisual(OverPriceVisual); HookTimeLayer.AddVisual(OverTimeVisual); HookTimeLayer.AddVisual(ShadowTimeVisual); }