Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            ScalarPlatformLoader.Initialize();

            using (JsonTracer tracer = new JsonTracer("Microsoft.Git.GVFS.Service.UI", "Service.UI"))
            {
                string error;
                string serviceUILogDirectory = ScalarPlatform.Instance.GetLogsDirectoryForGVFSComponent(ScalarConstants.Service.UIName);
                if (!ScalarPlatform.Instance.FileSystem.TryCreateDirectoryWithAdminAndUserModifyPermissions(serviceUILogDirectory, out error))
                {
                    EventMetadata metadata = new EventMetadata();
                    metadata.Add(nameof(serviceUILogDirectory), serviceUILogDirectory);
                    metadata.Add(nameof(error), error);
                    tracer.RelatedWarning(
                        metadata,
                        "Failed to create service UI logs directory",
                        Keywords.Telemetry);
                }
                else
                {
                    string logFilePath = ScalarEnlistment.GetNewScalarLogFileName(
                        serviceUILogDirectory,
                        ScalarConstants.LogFileTypes.ServiceUI,
                        logId: Environment.UserName);

                    tracer.AddLogFileEventListener(logFilePath, EventLevel.Informational, Keywords.Any);
                }

                WinToastNotifier          winToastNotifier    = new WinToastNotifier(tracer);
                ScalarToastRequestHandler toastRequestHandler = new ScalarToastRequestHandler(winToastNotifier, tracer);
                GVFSServiceUI             process             = new GVFSServiceUI(tracer, toastRequestHandler);

                process.Start(args);
            }
        }
Exemplo n.º 2
0
 public GVFSServiceUI(ITracer tracer, ScalarToastRequestHandler toastRequestHandler)
 {
     this.tracer = tracer;
     this.toastRequestHandler = toastRequestHandler;
 }