static void Main(string[] args)
        {
            Console.WriteLine("Client running at..." + DateTime.Now.ToString());

            Console.WriteLine();

            Console.WriteLine("Enter filepath");
            string filePath = Console.ReadLine();

            #region ParallelTasks
            Parallel.Invoke(


                () =>
            {
                FileReaderServiceProxy.FileReaderServiceProxy proxy = new FileReaderServiceProxy.FileReaderServiceProxy("httpEP");
                //  FileReaderServiceProxy.FileReaderServiceProxy proxy = new FileReaderServiceProxy.FileReaderServiceProxy(context);

                Console.WriteLine("File Attributes :");
                Console.WriteLine(proxy.GetAttributes(filePath));
            }

                );
            #endregion

            Console.WriteLine("Press enter to exit...");
            Console.ReadKey();
        }
Пример #2
0
        private void OnGetContentsClick(object sender, EventArgs e)
        {
            FileReaderServiceProxy.FileReaderServiceProxy proxy = new FileReaderServiceProxy.FileReaderServiceProxy("httpEP");
            string   filePath = FilePath.Text;
            FileInfo fileInfo = new FileInfo(filePath);

            StringBuilder stringBuilder = new StringBuilder();

            #region ParallelTasks
            Parallel.Invoke(


                () =>
            {
                FileAttributes.Text = proxy.GetAttributes(filePath);
            },

                () =>
            {
                stringBuilder.Append("Type : " + fileInfo.Extension + "\n");
            },
                () =>
            {
                stringBuilder.Append("Is ReadOnly : " + fileInfo.IsReadOnly + "\n");
            },
                () =>
            {
                stringBuilder.Append("Creation time : " + fileInfo.CreationTime + "\n");
            },

                () =>
            {
                stringBuilder.Append("Last access time : " + fileInfo.LastAccessTime + "\n");
            },

                () =>
            {
                stringBuilder.Append("Last write time : " + fileInfo.LastWriteTime + "\n");
            },

                () =>
            {
                stringBuilder.Append("Directory Name : " + fileInfo.DirectoryName + "\n");
            }

                );
            #endregion

            System.Windows.MessageBox.Show(stringBuilder.ToString(), "File Details");
        }