public bool Print(List <String> photos, int angle)
 {
     try
     {
         photos.ForEach(p => WinConsole.WriteLine("Print :" + p));
         Printer.Print(photos, angle);
         return(true);
     }
     catch (Exception ex)
     {
         WinConsole.WriteLine(ex);
         return(false);
     }
 }
        protected void Flash()
        {
            switch (flashing)
            {
            case WinConsoleFlashMode.FlashOnce:
                WinConsole.Flash(true);
                break;

            case WinConsoleFlashMode.FlashUntilResponse:
                WinConsole.Flash(false);
                break;
            }

            if (beep)
            {
                WinConsole.Beep();
            }
        }
        public void StartWCFServices()
        {
            var serviceAddress = Properties.Settings.Default.ServicesAddress.Replace("localhost", Environment.MachineName);

            WinConsole.WriteLine("Adresse printer server: " + serviceAddress);
            try
            {
                _serviceHost = new ServiceHost(typeof(FacesPrinterx86Server));
                NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                _serviceHost.AddServiceEndpoint(typeof(IFacesPrinterx86Interfaces), binding, serviceAddress);
                _serviceHost.Open();
            }

            catch (Exception ex)
            {
                WinConsole.WriteLine(ex);
                throw;
            }
        }
Beispiel #4
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            // force current working directory to executable folder
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));

            try
            {
                ProjectInstaller projectInstaller = new ProjectInstaller();
                Assembly         self             = Assembly.GetExecutingAssembly();
                String           ServiceName      = projectInstaller.Service.ServiceName;
                using (ServiceController serviceController = new ServiceController(ServiceName))
                {
                    WinConsole.Visible = true;

                    using (var services = new WindowsService())
                    {
                        services.StartWCFServices();

                        WinConsole.WriteLine(Properties.Resources.Quit);
                        WinConsole.Read();

                        services.StopWCFServices();
                    }
                }
            }
            catch (Exception ex)
            {
                if (Debugger.IsAttached == true)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(Properties.Resources.PressKey);
                    Console.ReadKey();
                }
            }

            Environment.Exit(0);
        }