void alertsure(string mess) { Action <UIAlertAction> okaction = null; Action <UIAlertAction> Cancelaction = null; switch (mess) { case "Save": { okaction = (UIAlertAction => { saveFilesGarelly(); }); Cancelaction = (UIAlertAction => { ViewDidLoad(); }); } break; case "Delete All": { okaction = (UIAlertAction => { DataSql.process(library.File(2), library.detleteAll(), null); ViewDidLoad(); _Select = false; }); //end Cancelaction = (UIAlertAction => { _Select = false; }); } break; case "Delete": { okaction = (UIAlertAction => { DeleteSection(); }); Cancelaction = (UIAlertAction => { ViewDidLoad(); }); } break; } var alert = UIAlertController.Create(string.Empty, "are you sure" + " " + mess, UIAlertControllerStyle.Alert); var ok = UIAlertAction.Create("Ok", UIAlertActionStyle.Default, okaction); var Cancel = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, Cancelaction); alert.AddAction(ok); alert.AddAction(Cancel); PresentViewController(alert, true, null); }
private void click_delete(UITableViewRowAction row, NSIndexPath indexPath) //Action Delete button { dataSql.process(library.File(2), library.DELETE(0), DataSql_Parameters(cellList[indexPath.Row])); PortList.RemoveAt(indexPath.Row); cellList.RemoveAt(indexPath.Row); // // delete the row from the table tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); // tableView.DeleteRows(new[] { indexPath[0] }, UITableViewRowAnimation.Fade); // tableView.DeleteRows(new NSIndexPath[] { NSIndexPath.FromItemSection(0, 0) }, UITableViewRowAnimation.Fade); }
private static void Save_Data(queue Finsh_queue) { DataSql _DataSql = new DataSql(); UIImage image; LibraryWords library = new LibraryWords(); var myByteArray = File.ReadAllBytes(Finsh_queue.Filename); byte[] myByteThumbnail = null; if (Finsh_queue._Type == "Video") { // byte[] myByteArray; CoreMedia.CMTime actualTime; NSError outError; using (var asset = AVAsset.FromUrl(NSUrl.FromFilename(Finsh_queue.Filename))) using (var imageGen = new AVAssetImageGenerator(asset)) using (var imageRef = imageGen.CopyCGImageAtTime(new CoreMedia.CMTime(1, 1), out actualTime, out outError)) { if (imageRef == null) { // return null; } image = UIImage.FromImage(imageRef); } using (NSData imageData = image.AsPNG()) { myByteThumbnail = new Byte[imageData.Length]; System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, myByteThumbnail, 0, Convert.ToInt32(imageData.Length)); } if (save.Savegerlly) { if (File.Exists(Finsh_queue.Filename)) { savedowloaning file = new savedowloaning(); // AMvideo.SaveToAlbum(Finsh_queue.Filename); file.Get_clipfile(Finsh_queue.ID.ToString(), myByteArray); // ALAssetsLibrary lib = new ALAssetsLibrary(); // lib.WriteVideoToSavedPhotosAlbum(NSUrl.FromFilename(Finsh_queue.Filename), (t, u) => { }); } } } else { myByteThumbnail = myByteArray; if (save.Savegerlly) { savedowloaning file = new savedowloaning(); file.Get_imagefile(Finsh_queue.ID.ToString(), myByteArray); } } _DataSql.process(library.File(2), library.INSERT(2), DataSql_Parameters(Path.GetFileName(Finsh_queue.Filename), myByteArray, myByteThumbnail, Finsh_queue._Type)); }