private void bolus_start_Click(object sender, EventArgs e) { if (bolusSpeed.Value != 0 && bolusInj.Value != 0) { Thread.Sleep(500); validateVolumeUpDown(bolusInj); MODE = InjectionMode.BOLUS; lastPosition = currentPosition; syringe.setSpeed((double)bolusSpeed.Value); rbtn_1x.Checked = true; this.Invoke(new Action(() => this.buttons_enabled(false))); t.Start(); if (ModeManager.Bolus.startInjection(syringe, (double)bolusInj.Value, lastPosition)) { sw.Start(); } } }
private void start_btn_Click(object sender, EventArgs e) { if (validateSyringe() && speed_val != 0) { Thread.Sleep(500); if (progressValue < 100) { rbtn_1x.Checked = true; this.Invoke(new Action(() => this.buttons_enabled(false))); t.Start(); start_btn.BackColor = Color.FromArgb(150, colors.text_color.R, colors.text_color.G, colors.text_color.B); if (ModeManager.ConstantMode.startInjection(syringe)) { MODE = InjectionMode.CONSTANT; sw.Start(); } } } else { MessageBox.Show("Select a syringe and speed value!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void stop_btn_result() { switch (MODE) { case InjectionMode.HOMMING: progressPanel.Invoke(new Action(() => progressPanel.setInjectedText("Homming stopped"))); MODE = InjectionMode.WAITING; break; case InjectionMode.START_POS: progressPanel.Invoke(new Action(() => progressPanel.setInjectedText("Setting start position stopped"))); MODE = InjectionMode.WAITING; break; case InjectionMode.BOLUS: bolus_start.Enabled = true; exit_bolus.Enabled = true; progressPanel.Invoke(new Action(() => progressPanel.setInjectedText("Bolus stopped"))); MODE = InjectionMode.WAITING; break; default: MODE = InjectionMode.WAITING; break; } }
private static void ScanAndRegister(this IServiceCollection services, Assembly[] assemblies, InjectionMode injectionMode, bool asSelf) { services.Scan(scan => { var serviceTypeSelector = scan.FromAssemblies(assemblies) .AddClasses(classes => classes.Where(type => { var injectionAttributeType = typeof(InjectableAttribute); var customAttribute = type.GetCustomAttributes() .FirstOrDefault(attribute => { var attributeType = attribute.GetType(); return(attributeType == injectionAttributeType || attributeType.IsSubclassOf(injectionAttributeType)); }); if (customAttribute is null) { return(false); } var injectableAttribute = (InjectableAttribute)customAttribute; return(injectableAttribute.AsSelf == asSelf && injectableAttribute.Mode == injectionMode); })); var lifeTimeSelector = asSelf ? serviceTypeSelector.AsSelf() : serviceTypeSelector.AsImplementedInterfaces(); switch (injectionMode) { case InjectionMode.Singleton: { lifeTimeSelector.WithSingletonLifetime(); break; } case InjectionMode.Scoped: { lifeTimeSelector.WithScopedLifetime(); break; } case InjectionMode.Transient: { lifeTimeSelector.WithTransientLifetime(); break; } default: throw new ArgumentOutOfRangeException(nameof(injectionMode), injectionMode, null); } }); }
public int decodeMessage(string message) { try { if (message.Contains("1:")) { int l = message.Length; step = Int32.Parse(message.Substring(2, l - 2)); mode = InjectionMode.CONSTANT; if (syringe.length != 0) { progress = (step - syringe.start_pos) * 100 / (double)syringe.length; pumped = (syringe.volume * (step - syringe.start_pos)) / (double)syringe.length; injected = (syringe.volume * (step - acctualPosition)) / (double)syringe.length; } onNewPositionArrived(); } else if (message.Contains("12:")) { mode = InjectionMode.HOME_DONE; step = 0; onHomingDoneArrived(); mode = InjectionMode.WAITING; } else if (message.Contains("14:")) { int l = message.Length; mode = InjectionMode.START_POS_DONE; acctualPosition = step; onStartPosArrived(); mode = InjectionMode.WAITING; } else if (message.Contains("16:")) { mode = InjectionMode.BOLUS_DONE; onBolusDoneArrived(); mode = InjectionMode.WAITING; } else if (message.Contains("18:")) { mode = InjectionMode.WAITING; onSyringeStoppedArrived(); } else { mode = InjectionMode.WAITING; onSyringeStoppedArrived(); } return(1); } catch { mode = InjectionMode.WAITING; onSyringeStoppedArrived(); return(0); } }
private void back_btn_MouseDown(object sender, MouseEventArgs e) { if (MODE == InjectionMode.START_POS_DONE || MODE == InjectionMode.HOME_DONE) { progressPanel.Invoke(new Action(() => progressPanel.setInjectedText(""))); } MODE = InjectionMode.MOVING_BACK; t.Start(); ModeManager.Move.startInjection(MODE); }
internal ServiceInfo(Type serviceType, Type implementationType, ServiceScope scope, object instance, Func <IDependencyResolver, object> creationFunction, InjectionMode injectionMode) { ServiceType = serviceType; if (implementationType != null) { ImplementationTypeInfo = ServiceTypeInfo.Get(implementationType); } Scope = scope; Instance = instance; CreationFunction = creationFunction; InjectionMode = injectionMode; }
private void Inject(Type instanceType, object instance, InjectionMode mode, bool persistent = false) { if (mode == InjectionMode.InjectAndResolve || mode == InjectionMode.ResolveOnly) { ResolveDepedencies(instanceType, instance); } if (mode == InjectionMode.InjectAndResolve || mode == InjectionMode.InjectOnly) { _injected.Add(instanceType, new Injection { instance = instance, persistent = persistent }); } }
private void home_1_Click(object sender, EventArgs e) { buttons_enabled(false); rbtn_4x.Checked = true; ModeManager.Move.homming(); MODE = InjectionMode.HOMMING; t.Start(); reset(sw); progressPanel.Invoke(new Action(() => progressPanel.setElapsedTime(TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds)))); progressPanel.Invoke(new Action(() => progressPanel.setProgressValue(0))); progressPanel.Invoke(new Action(() => progressPanel.setInjectedText("Homming..."))); }
private void pos_start_btn_Click(object sender, EventArgs e) { if (validateSyringe()) { buttons_enabled(false); rbtn_4x.Checked = true; ModeManager.Move.startPosition(syringe); MODE = InjectionMode.START_POS; t.Start(); progressValue = 0; progressPanel.Invoke(new Action(() => progressPanel.setInjectedText("Moving to start position..."))); } }
/// <summary> /// インジェクションを追加します。 /// </summary> /// <param name="injectionAction">インジェクション関数を指定します。</param> /// <param name="mode">インジェクションの方針を決定します。</param> public void Injection(InjectDelegate <T> injectAction, InjectionMode mode) { switch (mode) { case InjectionMode.InjectionFirst: this.callFirst.AddFirst(injectAction); break; case InjectionMode.InjectionLast: this.callLast.AddLast(injectAction); break; case InjectionMode.NoConsider: default: this.callMiddle.AddLast(injectAction); break; } }
private void forth_btn_MouseDown(object sender, MouseEventArgs e) { if (MODE == InjectionMode.START_POS_DONE || MODE == InjectionMode.HOME_DONE) { progressPanel.Invoke(new Action(() => progressPanel.setInjectedText(""))); } //if (pumped.Visible != true) // pumped.Visible = true; if (progressValue < 100) { MODE = InjectionMode.MOVING_FORTH; t.Start(); ModeManager.Move.startInjection(MODE); } else { MODE = InjectionMode.WAITING; } }
public static bool startInjection(InjectionMode mode) { string message = ""; if (mode == InjectionMode.MOVING_FORTH) { message = Commands.FORWARD.ToString("D"); } else if (mode == InjectionMode.MOVING_BACK) { message = Commands.BACKWARD.ToString("D"); } try { communication.sendCommand(message); return(SUCCESS); } catch { return(ERROR); } }
private void StartCapture(InjectionMode mode) { if (GetInjectionMode() == InjectionMode.Disabled) { return; } if (GetInjectionMode() != mode) { StopCapturing(); } if (!userInterfaceState.IsCapturing()) { StoreConfiguration(); SetInjectionMode(mode); if (mode == InjectionMode.Single) { startSingleApplicationButton.Content = "Stop overlay"; overlayTracker.StartCaptureExe(targetExePath.Text, commandArgsExePath.Text); userInterfaceState.IsCapturingSingle = true; } else if (mode == InjectionMode.All) { overlayTracker.StartCaptureAll(); userInterfaceState.IsCapturingGlobal = true; startOverlayGlobalButton.Content = "Stop overlay"; RegistryUpdater.EnableImplicitlayer(); } } else { if (mode == InjectionMode.All) { // Check if all processes with GameOverlay.dll are terminated, otherwise // warn the user to finish all processes. if (overlayTracker.GetHookedProcesses().Count() > 0) { var processIds = overlayTracker.GetHookedProcesses(); string processes = ""; foreach (int id in processIds) { try { Process process = Process.GetProcessById(id); if (process.ProcessName != "ApplicationFrameHost") { processes += "\n" + process.ProcessName; } } catch { // skip - process does not exist anymore } } if (processes.Length > 0) { var result = MessageBox.Show( "Continue stop capturing? Following processes are still running: " + processes, "Running processes", MessageBoxButton.YesNo); if (result == MessageBoxResult.No) { return; } } } } StopCapturing(); } }
private void processDone(InjectionMode mode) { MODE = mode; this.Invoke(new Action(() => stop_btn.PerformClick())); t.Stop(); }
public void Inject(object instance, InjectionMode mode, bool persistent = false) { Type instanceType = instance.GetType(); Inject(instanceType, instance, mode, persistent); }
/// <summary> /// Injects Singleton, Scoped or Transient mappings based on the supplied parameters /// </summary> /// <param name="services"></param> /// <param name="rootNamespace">Root namespace to poll for interfaces</param> /// <param name="interfaceSuffixList">Suffixes for injectable interfaces</param> /// <param name="interfacePrefix">Prefix for injectable interfaces</param> /// <param name="enforceStrictNaming">If true, will only inject concrete types whos class names are {interfacePrefix}{ConcreteClassName}{InterfaceSuffix}</param> /// <param name="restrictImplementationsToInterfaceNamespaces">If true, will only map interfaces to concrete classes in the same root namespace</param> private static IServiceCollection InjectFrom(this IServiceCollection services, InjectionMode mode, string rootNamespace, List <string> interfaceSuffixList, string interfacePrefix = "I", bool enforceStrictNaming = true, bool restrictImplementationsToInterfaceNamespaces = false) { var settings = new InjectionSettings { EnforceStrictNaming = enforceStrictNaming, InjectionMode = mode, InterfaceRootNamespaces = new List <string> { rootNamespace }, InterfacePrefix = interfacePrefix, InterfaceSuffixList = interfaceSuffixList, RestrictImplementationsToInterfaceNamespaces = restrictImplementationsToInterfaceNamespaces }; return(services.InjectByConvention(settings)); }
/// <summary> /// Create new instance by entry mode. /// </summary> /// <param name="mode"></param> public InjectableAttribute(InjectionMode mode) { Mode = mode; }
IInjectionRootNamespaceConfiguration IInjectionModeConfiguration.WithInjectionMode(InjectionMode mode) { InjectionMode = mode; return(this); }
public void Deconstruct(out string name, out InjectionMode injectionMode) { injectionMode = this.InjectionMode; name = this.Namespace; }
private void SetInjectionMode(InjectionMode captureMode) { userInterfaceState.ApplicationInjectionMode = captureMode; }
public void Deconstruct(out InjectionMode injectionMode) { injectionMode = this.InjectionMode; }
public static IInjectionRootNamespaceConfiguration WithInjectionMode(InjectionMode mode) { var settings = new InjectionSettings(); return(((IInjectionModeConfiguration)settings).WithInjectionMode(mode)); }
public void Deconstruct(out string name, out InjectionMode injectionMode, out string defaultPrefix) { injectionMode = this.InjectionMode; name = this.Namespace; defaultPrefix = this.DefaultPrefix; }