public void Execute(Arguments arguments) { string path = arguments.Path.Value; PowerPointWrapper powerPointWrapper = PowerPointManager.AddPowerPoint(); powerPointWrapper.Open(path); Scripter.Variables.SetVariableValue(arguments.Result.Value, new Language.IntegerStructure(powerPointWrapper.Id)); }
public void Close() { try { if (pres != null) { pres.Close(); Marshal.ReleaseComObject(pres); } application.WindowDeactivate -= Application_WindowDeactivate; PowerPointManager.Remove(this); bool allowQuit = true; if (presentationList != null) { allowQuit = presentationList.Count == 0; Marshal.ReleaseComObject(pres); } if (allowQuit) { application.Quit(); } Process[] pros = Process.GetProcesses(); for (int i = 0; i < pros.Count(); i++) { if (pros[i].ProcessName.ToLower().Contains("powerpnt")) { pros[i].Kill(); } } Marshal.ReleaseComObject(application); GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception) { throw; } }
internal PowerPointWrapper() { id = PowerPointManager.GetNextId(); }