示例#1
0
        private uint TakeScreenShot(string targetDir, string fileName)
        {
            var commandLine = $"Uchilka.ScreenCapturer.exe \"{targetDir}\" {fileName}";

            var res = ProcessAsCurrentUser.CreateProcessAsCurrentUser(null, commandLine);

            Debug.WriteLine($"Screen Capturer launch result: {res}");

            return(res);
        }
示例#2
0
        public void SendNotification(ITracer tracer, NamedPipeMessages.Notification.Request request)
        {
            NamedPipeClient client;

            if (!this.TryOpenConnectionToUIProcess(tracer, out client))
            {
                this.TerminateExistingProcess(tracer, GVFSConstants.Service.UIName);

                if (!ProcessAsCurrentUser.Run(
                        tracer,
                        Configuration.Instance.GVFSServiceUILocation,
                        string.Empty,
                        showWindow: false))
                {
                    tracer.RelatedError("Could not start " + GVFSConstants.Service.UIName);
                    return;
                }

                this.TryOpenConnectionToUIProcess(tracer, out client);
            }

            if (client == null)
            {
                tracer.RelatedError("Failed to connect to " + GVFSConstants.Service.UIName);
                return;
            }

            try
            {
                if (!client.TrySendRequest(request.ToMessage()))
                {
                    tracer.RelatedInfo("Failed to send notification request to " + GVFSConstants.Service.UIName);
                }
            }
            finally
            {
                client.Dispose();
            }
        }