Example #1
0
        static void Main()
        {
            try
            {
                var key = ConfigurationManager.AppSettings[keyPath];
                if (System.IO.File.Exists(key))
                {
                    // myApp is already running...
                    Logger.Log("Another instanse of an application is already running");
                    return;
                }
                else
                {
                    var directoryPath = Path.Combine(Environment.CurrentDirectory, ConfigurationManager.AppSettings[filesPath]);
                    var filesFilter   = ConfigurationManager.AppSettings[filtersParamKey];

                    using (var controller = new Controller(directoryPath, filesFilter))
                    {
                        controller.Run();
                        KeyHandler.SetKey();

                        Console.ReadKey();

                        controller.Stop();
                    }
                }
            }
            catch
            {
            }
            finally
            {
                KeyHandler.DeleteKey();
            }
        }
Example #2
0
 protected override void OnPause()
 {
     KeyHandler.DeleteKey();
     base.OnPause();
 }