public FT_HistoryDetailViewController(FlagHistory history,int key)
            : base(UITableViewStyle.Grouped, null)
        {
            // = FT_MapViewController.HistoryInfo.FirstOrDefault (x=>x.Value == history).Key;
            string path  = history.path;
            CLLocationCoordinate2D location = history.location;

            this.Pushing = true;
            Root = new RootElement ("Details");
            var photoSection = new Section ("Photos");
            var recordingSection = new Section ("Recording");

            var photoDir = Directory.EnumerateFiles (path+"/photos");
            var recodringDir = Directory.EnumerateFiles (path+"/recordings");

            foreach (var p in photoDir){
                photoSection.Add (new StringElement ("Photo",()=>{
                    this.NavigationController.PushViewController(new FT_ImageView(p,"Photo",true),true);
                }));
            }

            foreach (var r in recodringDir){
                recordingSection.Add (new StringElement ("Recording",()=>{

                    playRecordVoice(r);
                }));
            }

            Root.Add (photoSection);
            Root.Add (recordingSection);

            // option btn
            var optionBtn = new UIBarButtonItem ();
            optionBtn.Title = "Options";
            optionBtn.Clicked += (object sender, EventArgs e) => {

                var actionSheet = new UIActionSheet ("Report options");
                actionSheet.AddButton("Delete");
                actionSheet.AddButton("Send Email");
                actionSheet.AddButton("Cancel");
                actionSheet.Clicked += (object ss, UIButtonEventArgs ee) => {

                    switch (ee.ButtonIndex) {
                    case 0:
                        //Console.Out.WriteLine ("Delete");
                        deleteDocumentFolder(key,path);
                        if(deleted != null){
                            deleted(this,EventArgs.Empty);
                        }
                        this.NavigationController.PopViewControllerAnimated(true);
                        break;
                    case 1:
                        //Console.Out.WriteLine ("Send Email");
                        sendReportByEmail(path,location);
                        break;
                    case 2:
                        //Console.Out.WriteLine ("Cancel");
                        break;
                    }
                };
                actionSheet.ShowInView (View);
            };

            this.NavigationItem.RightBarButtonItem = optionBtn;
        }
Ejemplo n.º 2
0
 public void saveMessage(CLLocationCoordinate2D location)
 {
     var value = new FlagHistory ();
     value.location = location;
     value.path = _directoyPath;
     FT_MapViewController.HistoryInfo.Add (FT_MapViewController.KEY++,value);
 }