Example #1
0
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
            // Get the value of the watch Dir from the registry
            try
            {
                m_watchDirName = RegistryUtil.GetGlobalSightRegistryValue("PdfConvDir") + @"\pdf";
                DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName);
                watchDir.Create();
                Logger.Initialize(m_watchDirName + @"\pdfConverter.log");
                m_log = Logger.GetLogger();
                m_log.Log("GlobalSight PDF Converter starting up.");
                m_log.Log("Creating and starting thread to watch directory " + m_watchDirName);

                m_converterRunner = new ConverterRunner(new PdfConverterImpl(), m_watchDirName);
                m_converterRunner.Start();
            }
            catch (Exception e)
            {
                string msg = "PdfConverter failed to initialize because of: " + e.Message + "\r\n" + e.StackTrace;
                EventLog.WriteEntry(msg, EventLogEntryType.Error);
                Logger.LogWithoutException(msg);
                throw e;
            }
        }
Example #2
0
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            if (m_alreadyStarted == true)
            {
                return;
            }

            m_alreadyStarted = true;

            try
            {
                m_watchDirName = RegistryUtil.GetGlobalSightRegistryValue(
                    "InDesignConvDir") + @"\indd";
                DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName);
                watchDir.Create();
                Logger.Initialize(m_watchDirName + @"\InDesignConverter.log");

                m_log = Logger.GetLogger();
                m_log.Log("GlobalSight InDesign Converter starting up.");
                m_log.Log("Creating and starting threads to watch directory " +
                          m_watchDirName);

                m_importConverterRunner = new ConverterRunner(
                    new InDesignConverterImpl(InDesignConverterImpl.ConversionType.IMPORT),
                    m_watchDirName);
                m_exportConverterRunner = new ConverterRunner(
                    new InDesignConverterImpl(InDesignConverterImpl.ConversionType.EXPORT),
                    m_watchDirName);

                m_importConverterRunner.Start();
                m_exportConverterRunner.Start();

                if (AllowInteractWithDesktop())
                {
                    m_InDesignApp = InDesignApplication.getInstance();
                }
                else
                {
                    throw new Exception("InDesign Converter Service needs to interact with desktop."
                                        + " The properties of InDesign Converter Service needs to "
                                        + "be changed to allow sevice to interact with desktop.");
                }
            }
            catch (Exception e)
            {
                string msg = "GlobalSight InDesign Converter failed to initialize because of: " +
                             e.Message + "\r\n" + e.StackTrace;
                EventLog.WriteEntry(msg, EventLogEntryType.Error);
                Logger.LogWithoutException(msg);
                throw e;
            }
        }
Example #3
0
        protected override void OnStart(string[] args)
        {
            m_watchDirName = RegistryUtil.GetGlobalSightRegistryValue(
                "IllustratorConvDir") + @"\Illustrator";
            DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName);

            watchDir.Create();
            Logger.Initialize(m_watchDirName + @"\IllustratorConverter.log");
            m_log = Logger.GetLogger();
            m_log.Log("Illustrator Converter is started");
            start = true;
            Thread thread = new Thread(new ThreadStart(Run));

            thread.Start();
        }
Example #4
0
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            if (m_alreadyStarted == true)
            {
                return;
            }
            else
            {
                m_alreadyStarted = true;
            }
            try
            {
                m_watchDirName = RegistryUtil.GetGlobalSightRegistryValue(
                    "MsOfficeConvDir") + @"\word";
                DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName);
                watchDir.Create();

                Logger.Initialize(m_watchDirName + @"\wordxpConverter.log");

                m_log = Logger.GetLogger();
                m_log.Log("GlobalSight Word XP Converter starting up.");
                m_log.Log("Creating and starting threads to watch directory " +
                          m_watchDirName);

                m_importConverterRunner = new ConverterRunner(
                    new WordXPConverterImpl(WordXPConverterImpl.ConversionType.IMPORT),
                    m_watchDirName);
                m_exportConverterRunner = new ConverterRunner(
                    new WordXPConverterImpl(WordXPConverterImpl.ConversionType.EXPORT),
                    m_watchDirName);

                m_importConverterRunner.Start();
                m_exportConverterRunner.Start();
            }
            catch (Exception e)
            {
                string msg = "GlobalSight Word XP Converter failed to initialize because of: " +
                             e.Message + "\r\n" + e.StackTrace;
                EventLog.WriteEntry(msg, EventLogEntryType.Error);
                Logger.LogWithoutException(msg);
                throw e;
            }
        }
Example #5
0
 private void InitData()
 {
     try
     {
         string dir = AppConfig.GetAppConfig("Dir");
         if (dir.Equals(""))
         {
             dir = RegistryUtil.GetGlobalSightRegistryValue("MsOfficeConvDir");
             if (dir == null)
             {
                 dir = "";
             }
             else
             {
                 dir = dir.Replace("\\\\", "\\");
             }
         }
         this.textBox1.Text          = dir;
         this.cbAutoStartAll.Checked = AppConfig.AutoStartAll;
     }
     catch { }
 }