private void DetectComplete(object sender, DetectCompleteEventArgs e) { if (_ba.Command.Action == LaunchAction.Uninstall) { _ba.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall"); Execute.OnUIThread(() => { _plannedAction = LaunchAction.Uninstall; this.Plan(LaunchAction.Uninstall); }); } else if (HResultSucceeded(e.Status)) { if (this.Downgrade) { // Downgrades are not allowed we just display and error and let the user exit. this.State = InstallationState.DetectedNewer; } // If we're not waiting for the user to click install, dispatch plan with the default action. if (_ba.Command.Display != Display.Full) { _ba.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for non-interactive mode."); Execute.OnUIThread(() => { this.Plan(_ba.Command.Action); }); } } else { this.State = InstallationState.Failed; } }
public void HandleState(LaunchAction state) { if (!_stateHandlers.ContainsKey(state)) return; _dispatcher.Invoke(_stateHandlers[state]); }
public static void Run(string appId, LaunchAction action, string[] args) { Mutex m_mutex = new Mutex(false, @"Local\" + appId); RunningObjectTable rot = new RunningObjectTable(); for (int i = 0; i < 120; i++) // wait for ~60 seconds { if (m_mutex.WaitOne(1, false)) { // we are the first instance try { using (rot.Register(appId, new OleCommandTargetImpl(action))) { action(args, true); } return; } finally { m_mutex.ReleaseMutex(); } } else { // we are not the first instance IOleCommandTargetWithExecParams instance = rot.GetObject(appId) as IOleCommandTargetWithExecParams; if (instance != null) { try { object dummy = null; object processId = null; instance.Exec(Guid.Empty, 0, OLECMDEXECOPT.DODEFAULT, ref dummy, ref processId); User32.AllowSetForegroundWindow((int)processId); object objArgs = args; object result = null; instance.Exec(Guid.Empty, 1, OLECMDEXECOPT.DODEFAULT, ref objArgs, ref result); if (result is bool && (bool)result) return; } catch (Exception e) { Trace.WriteLine(e.ToString()); } finally { Marshal.ReleaseComObject(instance); } } } Thread.Sleep(500); } Trace.WriteLine(appId + " could not start!"); }
public Task PerformLaunchAction(LaunchAction action) { _completionSource = new TaskCompletionSource<bool>(); Engine.Plan(action); return _completionSource.Task; }
/// <summary> /// Starts planning the appropriate action. /// </summary> /// <param name="action">Action to plan.</param> private void Plan(LaunchAction action) { this.planAttempted = true; this.plannedAction = action; this.hwnd = (WixBA.View == null) ? IntPtr.Zero : new WindowInteropHelper(WixBA.View).Handle; this.root.Canceled = false; WixBA.Model.Engine.Plan(this.plannedAction); }
public override RequestState PlanPackage(string packageId, LaunchAction launchAction) { if (launchAction == LaunchAction.Repair) { switch (packageId) { case Modules.PowerPointCompareInstall: case Modules.CompareInstall: { return RequestState.Repair; } } } if (launchAction == LaunchAction.Install) { switch (packageId) { case Modules.PowerPointCompareInstall: case Modules.CompareInstall: { return RequestState.Present; } } } if (launchAction == LaunchAction.Uninstall) { switch (packageId) { case Modules.PowerPointCompareInstall: case Modules.CompareInstall: { return RequestState.ForceAbsent; } } } return base.PlanPackage(packageId, launchAction); }
public void Plan(LaunchAction action) { inner.Plan(action); }
public LaunchActionThreadWithState(LaunchAction launchAction, string[] args) { _args = args; _launchAction = launchAction; _returnValue = false; }
public void AddHandler(LaunchAction state, Action handler) { _stateHandlers[state] = handler; }
void Plan(LaunchAction action) { _planAttempted = true; _plannedAction = action; _hwnd = (FiresecUX.View == null) ? IntPtr.Zero : new WindowInteropHelper(FiresecUX.View).Handle; _root.Canceled = false; FiresecUX.Model.Engine.Plan(_plannedAction); }
/// <summary> /// Initializes a new instance of the class. /// </summary> /// <param name="appName">Friendly name of the app</param> /// <param name="path">full path to the exe</param> /// <param name="commandLine">optional command line arg</param> /// <param name="action">start a new instance or switch to existing</param> public AppInfo(String appName, String path, String commandLine = Missing, LaunchAction action = LaunchAction.StartNew) { Name = appName; Path = path; CommandLine = commandLine; Action = action; }
/// <summary> /// Starts planning the appropriate action. /// </summary> /// <param name="action">Action to plan.</param> private void Plan(LaunchAction action) { _planAttempted = true; _plannedAction = action; _hwnd = (Bootstrapper.View == null) ? IntPtr.Zero : new WindowInteropHelper(Bootstrapper.View).Handle; _root.Canceled = false; Bootstrapper.Model.Engine.Plan(_plannedAction); _progressViewModel.IsInstall = false; _progressViewModel.IsRepair = false; _progressViewModel.IsUninstall = false; switch (action) { case LaunchAction.Install: _progressViewModel.IsInstall = true; break; case LaunchAction.Repair: _progressViewModel.IsRepair = true; break; case LaunchAction.Uninstall: _progressViewModel.IsUninstall = true; break; default: _progressViewModel.CurrentAction = "Unknown"; break; } }
public override RequestState PlanPackage(string packageId, LaunchAction launchAction) { if (launchAction == LaunchAction.Repair) { switch (packageId) { case Modules.DesktopInstall: { return Features.Sync ? RequestState.Repair : RequestState.ForceAbsent; } case Modules.PowerPointCompareInstall: { return Features.Compare ? RequestState.Repair : RequestState.ForceAbsent; } case Modules.ProfessionalInstall: { return RequestState.Repair; } } } if (launchAction == LaunchAction.Install) { switch (packageId) { case Modules.ProfessionalInstall: { if (Features.Compare || Features.Protect) return RequestState.Present; return RequestState.None; } case Modules.PowerPointCompareInstall: { if (Features.Compare) return RequestState.Present; return RequestState.None; } case Modules.DesktopInstall: { return Features.Sync ? RequestState.Present : RequestState.None; } } } if (launchAction == LaunchAction.Uninstall) { switch (packageId) { case Modules.DesktopInstall: case Modules.ProfessionalInstall: case Modules.PowerPointCompareInstall: { return RequestState.ForceAbsent; } } } return base.PlanPackage(packageId, launchAction); }
public static async Task PlanAsync(this Engine engine, LaunchAction action) { await Application.Current.Dispatcher.InvokeAsync(() => engine.Plan(action), DispatcherPriority.Background); }
public void Plan(LaunchAction action) { PlannedAction = action; switch (action) { case LaunchAction.Modify: case LaunchAction.Repair: case LaunchAction.Install: PlanInstall(); break; case LaunchAction.Uninstall: PlanUninstall(); break; } Bootstrapper.Engine.Plan(action); Bootstrapper.Engine.Apply(IntPtr.Zero); }
public virtual RequestState PlanPackage(string packageId, LaunchAction launchAction) { if (launchAction == LaunchAction.Install) { switch (packageId) { case "NetFx45Redist": { return Detector.IsNetFx45Installed() ? RequestState.None : RequestState.Present; } case "Vc2012x86Redist": { return Detector.IsVcRedist2012X86Installed() ? RequestState.None : RequestState.Present; } case "Vc2012x64Redist": { if (!Environment.Is64BitOperatingSystem) return RequestState.None; return Detector.IsVcRedist2012X64Installed() ? RequestState.None : RequestState.Present; } case "Vsto2010Redist": { return Detector.IsVstoInstalled() ? RequestState.None : RequestState.Present; } } } if (launchAction == LaunchAction.Layout) { return RequestState.Present; } return RequestState.None; }
private InstallActions(LaunchAction value, Verbs verb, InstallationState successState) { Value = value; SuccessState = successState; Verb = verb; }
protected override IEnumerable<IRelativeFilePath> GetExecutables(LaunchAction action) => action == LaunchAction.LaunchAsDedicatedServer ? _serverExecutables.Value : _executables.Value;
/// <summary> /// Starts planning the appropriate action. /// </summary> /// <param name="action">Action to plan.</param> public static void Plan(LaunchAction action) { WixBA.Model.PlannedAction = action; WixBA.Model.Engine.Plan(WixBA.Model.PlannedAction); }
CollectionServer GetServer(IEnumerable<ILaunchableContent> content, LaunchAction launchAction) { if (launchAction == LaunchAction.Default) return content.OfType<IHaveServers>().FirstOrDefault()?.Servers.FirstOrDefault(); return launchAction == LaunchAction.Join ? content.OfType<IHaveServers>().First().Servers.First() : null; }
public OleCommandTargetImpl(LaunchAction action) { _action = action; }
private void Plan(LaunchAction action) { this.plannedAction = action; this.hwnd = (Application.Current.MainWindow == null) ? IntPtr.Zero : new WindowInteropHelper(Application.Current.MainWindow).Handle; this.Cancelled = false; ba.Engine.Plan(action); }