コード例 #1
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            var settingsStore = new Lazy <WritableSettingsStore>(() =>
            {
                return(new ShellSettingsManager(this).
                       GetWritableSettingsStore(SettingsScope.UserSettings));
            });

            Settings     = new BuildHelperSettings(settingsStore);
            m_VsInstance = (DTE2)GetService(typeof(DTE));
            var solutionBuildManager = (IVsSolutionBuildManager2)GetService(typeof(SVsSolutionBuildManager));
            var statusBar            = (IVsStatusbar)GetService(typeof(SVsStatusbar));
            var logger = new ExtensionLogger(() => GetService(typeof(SVsActivityLog)) as IVsActivityLog, statusBar);
            //never cache the activity log reference
            var serviceHelper = new ServiceHelper(logger);
            var processHelper = new ProcessHelper(logger);

            m_BuildTracker = new BuildTracker(
                m_VsInstance,
                solutionBuildManager,
                Settings,
                serviceHelper,
                processHelper);
        }
コード例 #2
0
        public static void LogProcessError(Logger logger, string message, string errorDataReceived)
        {
            string output = FormatProcessErrorOutput(message, errorDataReceived);

            ExtensionLogger.LogToFile(logger, output, LogLevel.Error);

            OutputLogger.WriteToOutputWindow(output, MessageType.Error);
        }
コード例 #3
0
        public static void LogCrmConnectionError(Logger logger, string message, CrmConnectionManager crmConnectionManager)
        {
            string output = FormatCrmConnectionErrorOutput(crmConnectionManager);

            ExtensionLogger.LogToFile(logger, output, LogLevel.Error);

            OutputLogger.WriteToOutputWindow(output, MessageType.Error);
        }
コード例 #4
0
        public static void LogException(Logger logger, string message, Exception ex)
        {
            string output = FormatExceptionOutput(message, ex);

            ExtensionLogger.LogToFile(logger, output, LogLevel.Error);

            OutputLogger.WriteToOutputWindow(output, MessageType.Error);
        }
コード例 #5
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this));
            base.Initialize();
            Logger = new ExtensionLogger("ExceptionBreaker", paneCaption => GetOutputPane(GuidList.OutputPane, paneCaption));

            _dte = (DTE)GetService(typeof(DTE));
            SetupExceptionBreakManager();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            SetupCommandController();
        }
コード例 #6
0
 public static void Start()
 {
     try
     {
         ExtensionLogger.Info("Mail Job started.");
         thread = new Thread(MailJob.Start);
         thread.IsBackground = true;
         thread.Start();
     }
     catch (Exception ex)
     {
         ExtensionLogger.Error("An unhandled exception occured on start mail job", ex);
     }
 }
コード例 #7
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this));
            base.Initialize();

            var logger = new ExtensionLogger("SolutionIcon", title => GetOutputPane(Guids.OutputPane, title));

            _manager = new SolutionIconManager(
                (DTE)GetService(typeof(DTE)),
                new IconFinder(new FileSystem()),
                new IconConverter(),
                new IconGenerator(new TinyIdGenerator()),
                logger
                );
        }
コード例 #8
0
        public void SendMailNonStatic()
        {
            IEnumerable <Product> newProducts = sendProduct.GetProductForSend();

            foreach (Product product in newProducts)
            {
                string      tagsList = GetNameTagList(product.Tags);
                MailMessage message  = new MailMessage();
                message.To.Add(new MailAddress("*****@*****.**")); //replace with valid value
                message.Subject = "Details of the created or edited product";
                string body = "<p>Product Details:<p> Name : {0}</p> <p> Quantity : {1}</p>  <p> Category : {2}</p> <p> Tags : {3}</p> Price : {4} EUR</p>";
                message.Body       = string.Format(body, product.Name, product.Quantity.ToString(), product.CategoryId, tagsList, product.Price.ToString());
                message.IsBodyHtml = true;

                try {
                    using (var smtp = new SmtpClient())
                    {
                        if (product.Image != null && product.Image.Count() > 0)
                        {
                            using (MemoryStream ms = new System.IO.MemoryStream(product.Image))
                            {
                                ms.Write(product.Image, 0, product.Image.Length);
                                ms.Position = 0;
                                Attachment attachment = new Attachment(ms, "image.jpg", "image/jpeg");
                                message.Attachments.Add(attachment);
                                message.Attachments[0].ContentId = "image.jpg";
                                message.Attachments[0].ContentDisposition.Inline   = true;
                                message.Attachments[0].ContentDisposition.FileName = "image.jpg";
                                message.Body += string.Format("Show Image in List of Products: {0}", YesNoShowInList(product.ShowInList));
                                message.Body += "<img src='cid:image'>" + Environment.NewLine;
                                smtp.Send(message);
                            }
                        }
                        else
                        {
                            smtp.Send(message);
                        }
                    }
                    product.IsSendByEmail = true;
                    sendProduct.UpdateProduct(product);
                }
                catch (Exception ex)
                {
                    ExtensionLogger.Error("Error at sending  mail", ex);
                }
            }
        }
コード例 #9
0
        private void SetupLogger(Lazy <OptionsPageData> optionsPage)
        {
            var showDiagnostics = new Lazy <IObservableResult <bool> >(() => optionsPage.Value.ShowDiagnosticsObservable);

            Logger = new ExtensionLogger("ExceptionBreaker", this, GuidList.OutputPane, showDiagnostics);
        }
コード例 #10
0
 private static void SetupLogging(DTE dte)
 {
     ExtensionLogger exLogger = new ExtensionLogger(dte);
 }
コード例 #11
0
 private static void SetupLogging()
 {
     var logger = new ExtensionLogger();
 }
コード例 #12
0
 /// <summary>
 /// Initialization of the package; this method is called right after the package is sited, so this is the place
 /// where you can put all the initialization code that rely on services provided by VisualStudio.
 /// </summary>
 protected override void Initialize()
 {
     ExtensionLogger.Initialize(this);
     MrrGitAutomergeCommand.Initialize(this);
     base.Initialize();
 }