コード例 #1
0
        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;
            }
        }
コード例 #2
0
        public void HandleState(LaunchAction state)
        {
            if (!_stateHandlers.ContainsKey(state))
                return;

            _dispatcher.Invoke(_stateHandlers[state]);
        }
コード例 #3
0
        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!");
        }
コード例 #4
0
ファイル: WindowBase.cs プロジェクト: baluubas/Magic
        public Task PerformLaunchAction(LaunchAction action)
        {
            _completionSource = new TaskCompletionSource<bool>();

            Engine.Plan(action);

            return _completionSource.Task;
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
ファイル: CompareModel.cs プロジェクト: killbug2004/WSProf
        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);
        }
コード例 #7
0
 public void Plan(LaunchAction action)
 {
     inner.Plan(action);
 }
コード例 #8
0
 public LaunchActionThreadWithState(LaunchAction launchAction, string[] args)
 {
     _args = args;
     _launchAction = launchAction;
     _returnValue = false;
 }
コード例 #9
0
 public void AddHandler(LaunchAction state, Action handler)
 {
     _stateHandlers[state] = handler;
 }
コード例 #10
0
		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);
		}
コード例 #11
0
ファイル: AppInfo.cs プロジェクト: glwu/acat
 /// <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;
 }
コード例 #12
0
        /// <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;
            }
        }
コード例 #13
0
        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);
        }
コード例 #14
0
 public static async Task PlanAsync(this Engine engine, LaunchAction action)
 {
     await Application.Current.Dispatcher.InvokeAsync(() => engine.Plan(action), DispatcherPriority.Background);
 }
コード例 #15
0
ファイル: Model.cs プロジェクト: killbug2004/WSProf
        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);
        }
コード例 #16
0
ファイル: Model.cs プロジェクト: killbug2004/WSProf
        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;
        }
コード例 #17
0
ファイル: InstallActions.cs プロジェクト: jardrake03/incert
 private InstallActions(LaunchAction value, Verbs verb, InstallationState successState)
 {
     Value = value;
     SuccessState = successState;
     Verb = verb;
 }
コード例 #18
0
        /// <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);
        }
コード例 #19
0
 protected override IEnumerable<IRelativeFilePath> GetExecutables(LaunchAction action) =>
     action == LaunchAction.LaunchAsDedicatedServer ? _serverExecutables.Value : _executables.Value;
コード例 #20
0
ファイル: WixBA.cs プロジェクト: squirmy/wix-custom-ba-issue
 /// <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);
 }
コード例 #21
0
 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;
 }
コード例 #22
0
 public OleCommandTargetImpl(LaunchAction action)
 {
     _action = action;
 }
コード例 #23
0
        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);
        }