コード例 #1
0
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                Console.WriteLine("RemoteInfoClient: Row selected {0}", indexPath.Row);

                var dirResult = tvc.Items[indexPath.Row] as DirectoryResult;

                if (dirResult != null)
                {
                    var nextPath = string.Format("{0}/{1}", tvc.CurrentPath, dirResult.Name);
                    tvc.NavigationController.PushViewController(new RemoteFilesTableViewController(nextPath), true);
                }
                else
                {
                    var fileResult = (FileResult)tvc.Items[indexPath.Row];
                    if (!fileResult.IsTextFile)
                    {
                        return;
                    }

                    var request = new GetTextFile {
                        AtPath = string.Format("{0}/{1}", tvc.CurrentPath, fileResult.Name)
                    };
                    var response = AppConfig.ServiceClient.Send <GetTextFileResponse>(request);

                    Console.WriteLine("response for: " + request.AtPath + ", len: " + response.Contents.Length);

                    var controller = new ViewTextFileController(fileResult.Name, response.Contents);
                    tvc.NavigationController.PushViewController(controller, true);
                }
            }
コード例 #2
0
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                Console.WriteLine ("RemoteInfoClient: Row selected {0}", indexPath.Row);

                var dirResult = tvc.Items[indexPath.Row] as DirectoryResult;
                if (dirResult != null)
                {
                    var nextPath = string.Format("{0}/{1}", tvc.CurrentPath, dirResult.Name);
                    tvc.NavigationController.PushViewController(new RemoteFilesTableViewController(nextPath), true);
                }
                else
                {
                    var fileResult = (FileResult) tvc.Items[indexPath.Row];
                    if (!fileResult.IsTextFile) return;

                    var request = new GetTextFile { AtPath = string.Format("{0}/{1}", tvc.CurrentPath, fileResult.Name) };
                    var response = AppConfig.ServiceClient.Send<GetTextFileResponse>(request);

                    Console.WriteLine("response for: " + request.AtPath + ", len: " + response.Contents.Length);

                    var controller = new ViewTextFileController(fileResult.Name, response.Contents);
                    tvc.NavigationController.PushViewController(controller, true);
                }
            }