Example #1
0
        static void Main(string[] args)
        {
            IFileReaderServiceCallback callback = new FileReaderServiceCallback();
            InstanceContext            context  = new InstanceContext(callback);

            string request  = string.Empty;
            string response = string.Empty;

            FileReaderService.FileReaderService sc = new FileReaderService.FileReaderService();


            #region ParallelTasks
            Parallel.Invoke(
                () =>
            {
                using (FileReaderServiceProxy.FileReaderServiceProxy proxy = new FileReaderServiceProxy.FileReaderServiceProxy(context))
                {
                    ConsoleLogger logger = new ConsoleLogger();

                    try
                    {
                        logger.print_To_Client_FileReaderService();

                        logger.print_File_Info();

                        logger.print_Session_Info();
                    }

                    catch (FaultException <ApplicationException> e)
                    {
                        Console.WriteLine("FaultException<>: " + e.Detail.GetType().Name + " - " + e.Detail.Message);
                    }
                    catch (FaultException e)
                    {
                        Console.WriteLine("FaultException: " + e.GetType().Name + " - " + e.Message);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("EXCEPTION: " + e.GetType().Name + " - " + e.Message);
                    }
                }
            }

                );
            #endregion

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            IFileReaderServiceCallback callback = new FileReaderServiceCallback();
            InstanceContext            context  = new InstanceContext(callback);

            FileReaderServiceProxy.FileReaderServiceProxy proxy = new FileReaderServiceProxy.FileReaderServiceProxy(context);

            Console.WriteLine("Client is running at " + DateTime.Now.ToString());
            Console.WriteLine("Enter the filepath: ");
            string filePath = Console.ReadLine();

            Console.WriteLine(proxy.Echo(filePath));
            Console.WriteLine(proxy.GetFileAttributes(filePath));
            Console.ReadLine();
        }