Exemple #1
0
        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);
        }
Exemple #2
0
    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);
    }
Exemple #3
0
        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));
        }
Exemple #4
0
        void todatabese()
        { //change
            List <byte[]> Imagebyeds = new List <byte[]>();
            List <string> strimg     = new List <string>();

            foreach (save_Plus Savefile in saveFormGrally)
            {
                DataSql = new DataSql();


                if (Savefile.Extension == "Image")
                {
                    //DataSql = new DataSql();

                    //  Byte[] myByteArray;
                    using (NSData imageData = Savefile.Image.AsPNG())
                    {
                        Savefile.ImageToBytes = new Byte[imageData.Length];
                        System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, Savefile.ImageToBytes, 0, Convert.ToInt32(imageData.Length));
                    }// tumblt

                    using (NSData Thumbnaildata = Savefile.Thumbnail.AsPNG())
                    {
                        Savefile.ThumbnailToBytes = new Byte[Thumbnaildata.Length];
                        System.Runtime.InteropServices.Marshal.Copy(Thumbnaildata.Bytes, Savefile.ThumbnailToBytes, 0, Convert.ToInt32(Thumbnaildata.Length));
                    }


                    Savefile.Title = GeneratePassword(7);
                    // Imagebyeds.Add(myByteArray);
                    //  strimg.Add(random);
                    DataSql.process(library.File(2), library.INSERT(2), DataSql_Parameters(Savefile.Title + ".jpg", Savefile.ImageToBytes, Savefile.ThumbnailToBytes, Savefile.Extension));
                }


                else
                {
                    using (NSData Thumbnaildata = Savefile.Thumbnail.AsPNG())
                    {
                        Savefile.ThumbnailToBytes = new Byte[Thumbnaildata.Length];
                        System.Runtime.InteropServices.Marshal.Copy(Thumbnaildata.Bytes, Savefile.ThumbnailToBytes, 0, Convert.ToInt32(Thumbnaildata.Length));
                    }

                    using (NSData data = NSData.FromUrl(NSUrl.FromString(Savefile.Url)))
                    {
                        Savefile.ImageToBytes = new byte[data.Length];

                        System.Runtime.InteropServices.Marshal.Copy(data.Bytes, Savefile.ImageToBytes, 0, Convert.ToInt32(data.Length));
                    }
                    Savefile.Title = GeneratePassword(7);


                    DataSql.process(library.File(2), library.INSERT(2), DataSql_Parameters(Savefile.Title + ".mp4", Savefile.ImageToBytes, Savefile.ThumbnailToBytes, Savefile.Extension));
                }
            }
            //foreach (string stringUrl in UrlVideoString)
            //{


            //    DataSql = new DataSql();

            //    byte[] myByteArray;
            //    using (NSData data = NSData.FromUrl(NSUrl.FromString(stringUrl)))
            //    {


            //        myByteArray = new byte[data.Length];

            //        System.Runtime.InteropServices.Marshal.Copy(data.Bytes, myByteArray, 0, Convert.ToInt32(data.Length));
            //    }
            //    string random = GeneratePassword(7);
            //    // this.Title = videoUrl.ToString(); ;

            //    DataSql.process(library.File(2), library.INSERT(2), DataSql_Parameters(random+".mp4", myByteArray, "Video"));
            //}


            //foreach (byte[] stringUrl in byetdata)
            //{

            //        string random = GeneratePassword(7);
            //        DataSql.process(library.File(2), library.INSERT(2), DataSql_Parameters(random + ".jpg", stringUrl, "Image"));

            //}

            //

            reload();
            saveFormGrally.Clear();
            //cal.addbutton(Imagebyeds, strimg);
            // Imagebyeds.Clear();
            // strimg.Clear();
            //UrlVideoString.Clear();
            //Imagedata.Clear();
            //byetdata.Clear();
        }