예제 #1
0
 public TagDetailScreen(ImageTag tag, EditImageModeController ancestor)
     : base(UserInterfaceIdiomIsPhone ? "TagDetailScreen_iPhone" : "TagDetailScreen_iPad",null)
 {
     this.tag = tag;
     this.ancestor = ancestor;
     Console.WriteLine ("nib:"+this.NibName);
 }
예제 #2
0
 //float heightmod;
 public TagListController(ImageTag tag, RectangleF area)
 {
     //			this.heightmod = heightmod;
     this.tag = tag;
     this.area = area;
     if (tag.TagString != null) {
         taglist = tag.TagString.Split (sep);
     } else {
         Console.WriteLine ("taglist is null, making empty array");
         taglist = new string[]{ };
     }
 }
예제 #3
0
        void ShowDetails(ImageTag mytag)
        {
            this.tag = mytag;
            TagUtility tu = new TagUtility (tag);
            fetcher = tu.FetchAsRectangleF ();
            string tagText = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Tag", "Tag");
            this.tagIdLabel.Text = tagText + ":"+mytag.ID;

            this.xTextField.Text = fetcher.X.ToString();
            this.yTextField.Text = fetcher.Y.ToString ();
            this.WidthLabel.Text = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Width", "Width");
            this.Label_Height.Text = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Height", "Height");
            this.TextField_height.Text = fetcher.Height.ToString ();
            this.WidthTextField.Text = fetcher.Width.ToString ();

            this.TextField_height.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float height = float.Parse(this.TextField_height.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.Height = height;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.Label_Height.Text = fetcher.Height.ToString();
                }
            };

            this.WidthTextField.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float width = float.Parse(this.WidthTextField.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.Width = width;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.WidthTextField.Text = fetcher.Width.ToString();
                }
            };

            this.xTextField.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float x = float.Parse(this.xTextField.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.X = x;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.xTextField.Text = fetcher.X.ToString();
                }
            };

            this.yTextField.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float y = float.Parse(this.yTextField.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.Y = y;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.yTextField.Text = fetcher.Y.ToString();
                }
            };

            this.xTextField.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };
            this.yTextField.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };

            this.TextField_height.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };
            this.WidthTextField.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };
        }
예제 #4
0
        string[] ExtractTagImages(ImageTag tag)
        {
            GalleryObject go = AppDelegate.dao.GetGalleryObjectByID (tag.GalleryObjectID);

            var documentsDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
            var gallerydirectory = Path.Combine (documentsDirectory, "gallery");
            string imagefilename = go.imageFileName;
            string path = Path.Combine (gallerydirectory, imagefilename);
            UIImage MasterImage = UIImage.FromFile (path);

            CGImage cg = MasterImage.CGImage;
            TagUtility tu = new TagUtility (tag);
            CGImage neo = cg.WithImageInRect (tu.FetchAsRectangleF());

            UIImage cutout = UIImage.FromImage (neo);
            //UIImage thumbnail = cutout.Scale (new SizeF(50, 50));
            return SaveCutout (RandomGeneratedName (), cutout);
        }
예제 #5
0
 protected override void Dispose(bool disposing)
 {
     tag = null;
     tlc = null;
     //backpush = null;
     extractButton.Dispose ();
     ExtractPressed = null;
     ancestor = null;
     base.Dispose (disposing);
 }
예제 #6
0
파일: LagerDAO.cs 프로젝트: Skalar/Indexer
 int SaveTagInner(ImageTag tag)
 {
     if (tag != null) {
         ImageTag checktag = GetTagById (tag.ID);
         if (checktag == null) {
             conn.Insert (tag);
             return tag.ID;
         }
         else {
             conn.Update (tag);
             return tag.ID;
         }
     }
     else {
         return -1;
     }
 }
예제 #7
0
파일: LagerDAO.cs 프로젝트: Skalar/Indexer
 public int SaveTag(ImageTag tag)
 {
     if (limitedSave && GetNumberOfTags () > limitedSaves) {
         RaiseLimitExceeded ();
         return -1;
     } else {
         return SaveTagInner (tag);
     }
 }
예제 #8
0
 public TagUtility(ImageTag input)
 {
     this.input = input;
 }
예제 #9
0
파일: EditTags.cs 프로젝트: Skalar/Indexer
 void RaiseTagClicked(ImageTag tag)
 {
     var handler = this.ActivateDetail;
     Console.WriteLine("item:"+tag.TagString);
     if (handler != null && tag != null) {
         handler(this, new TagClickedEventArgs(tag));
     }
 }
예제 #10
0
 protected override void Dispose(bool disposing)
 {
     tag = null;
     taglist = null;
     sep = null;
     base.Dispose (disposing);
 }
예제 #11
0
        void AddTagList()
        {
            RectangleF frame;
            if (UserInterfaceIdiomIsPhone) {
                frame = new RectangleF (10, 170, View.Bounds.Width -20, 125);
            } else {
                frame = new RectangleF (10, 300, View.Bounds.Width -20, 125);
            }

            Console.WriteLine ("frame:" + frame);
            tag = AppDelegate.dao.GetImageTagById (this.currentItem.ImageTagId);
            if (tag == null) {
                Console.WriteLine ("Tag er null");
                tag = new ImageTag ();
                int key = AppDelegate.dao.SaveTag (tag);
                tag.ID = key;
                Console.WriteLine ("key:" + key);
                this.currentItem.ImageTagId = key;
                AppDelegate.dao.SaveItem (this.currentItem);
            }

            tlc = new TagListController (tag, frame);
            this.View.AddSubview (tlc.View);
        }
예제 #12
0
 protected override void Dispose(bool disposing)
 {
     //			OutputImage.Dispose ();
     //			Pc.Dispose ();
     ItemSaved = null;
     ItemDeleted = null;
     InContainerTouched = null;
     InLocationTouched = null;
     currentItem = null;
     ancestor = null;
     ipc = null;
     ass = null;
     tlc = null;
     tag = null;
     base.Dispose (disposing);
 }
예제 #13
0
        void AddTagList()
        {
            RectangleF frame;
            ImageTag tag = null;

            if (UserInterfaceIdiomIsPhone) {
                frame = new RectangleF (10, 180, View.Bounds.Width -20, 125);
            } else {
                frame = new RectangleF (10, 190, View.Bounds.Width -20, 125);
            }

            //			Console.WriteLine("frame:"+frame);
            if (MyCurrentObject != null) {
                tag = AppDelegate.dao.GetImageTagById (this.MyCurrentObject.ImageTagId);
            }
            if (tag == null) {
                Console.WriteLine ("Tag er null");
                tag = new ImageTag ();
                int key = AppDelegate.dao.SaveTag (tag);
                tag.ID = key;
                if (MyCurrentObject != null) {
                    this.MyCurrentObject.ImageTagId = key;
                    AppDelegate.dao.SaveLagerObject (MyCurrentObject);
                }
            }

            tlc = new TagListController (tag, frame);
            View.AddSubview (tlc.View);
            tlc.entertag.EditingDidBegin += (object sender, EventArgs e) => tlc.entertag.Placeholder = "";
        }
예제 #14
0
        void AddTagList()
        {
            RectangleF frame;

            if (UserInterfaceIdiomIsPhone) {
                frame = new RectangleF (10, 185, UIScreen.MainScreen.Bounds.Width -20, 125);
            } else {
                frame = new RectangleF (10, 200, UIScreen.MainScreen.Bounds.Width -20, 125);
            }

            Console.WriteLine("frame:"+frame);
            ImageTag tag = AppDelegate.dao.GetImageTagById (this.boks.ImageTagId);
            if (tag == null) {
                Console.WriteLine ("Tag er null");
                tag = new ImageTag ();
                int key = AppDelegate.dao.SaveTag (tag);
                tag.ID = key;
                Console.WriteLine ("key:" + key);
                this.boks.ImageTagId = key;
                AppDelegate.dao.SaveLagerObject (boks);
            }

            tlc = new TagListController (tag, frame);
            this.Add (tlc.View);
        }
예제 #15
0
 public TagClickedEventArgs(ImageTag tag)
     : base()
 {
     this.tag = tag;
 }
예제 #16
0
 public TagDetailScreen(ImageTag tag)
     : base(UserInterfaceIdiomIsPhone ? "TagDetailScreen_iPhone" : "TagDetailScreen_iPad",null)
 {
     this.tag = tag;
 }
예제 #17
0
파일: LagerDAO.cs 프로젝트: Skalar/Indexer
 public void DeleteTag(int id)
 {
     ImageTag deleteme = new ImageTag ();
         deleteme.ID = id;
         conn.Delete (deleteme);
 }
예제 #18
0
파일: EditTags.cs 프로젝트: Skalar/Indexer
 //        void Initialize ()
 //        {
 //            this.NavigationItem.SetRightBarButtonItem (new UIBarButtonItem (UIBarButtonSystemItem.Add), false);
 //            this.NavigationItem.RightBarButtonItem.Clicked += (sender, e) => ShowTagDetails (new ImageTag ());
 //        }
 //        Ic = new UIPopoverController (sl);
 //        Ic.PresentFromRect (this.btnIn.Bounds, this.View, UIPopoverArrowDirection.Up, true);
 //        UIPopoverController pc;
 void ShowTagDetails(ImageTag tag)
 {
     Console.WriteLine ("call tagdetailscreen()");
     TagDetailScreen tagdetails = new TagDetailScreen (tag);
     this.NavigationController.PushViewController (tagdetails, true);
 }
예제 #19
0
        void AddTagInner()
        {
            ImageTag tag = new ImageTag ();
            tag.GalleryObjectID = go.ID;
            var cr8 = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Create", "Create");
            var input = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("input tags, comma seperated", "input tags, comma seperated");
            var abort = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Cancel", "Cancel");
            UIAlertView av = new UIAlertView (input, "\n", null, abort, new string[] {
                cr8
            });
            av.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
            int Create = av.FirstOtherButtonIndex;
            av.Clicked += (object sender, UIButtonEventArgs e) =>  {
                if (e.ButtonIndex == Create) {
                    String tagText = av.GetTextField (0).Text;
                    tag.TagString = tagText;
                    var scale = scrollView.ZoomScale;
                    const float heightmod = 0.70f;
                    //float widthmod = 1f;
                    RectangleF contentFrame = new RectangleF (scrollView.ContentOffset.X / scale, scrollView.ContentOffset.Y / scale, scrollView.Frame.Size.Width / scale, scrollView.Frame.Size.Height / scale * heightmod);
                    //RectangleF MyContentFrame = new RectangleF(contentFrame.X, contentFrame.Y - navbar,contentFrame.Width, contentFrame.Height + navbar);
                    //contentFrame.Y = contentFrame.Y + this.NavigationController.View.Bounds.Y;
                    //contentFrame.X = contentFrame.X + this.NavigationController.View.Bounds.Bottom;
                    contentFrame.Y = contentFrame.Y + 90;
                    TagUtility tu = new TagUtility(tag);
                    tu.StoreRectangleF (contentFrame);
                    AppDelegate.dao.SaveTag (tag);
            //					Console.WriteLine ("tagtext:" + tag.TagString);
            //					Console.WriteLine ("spot:" + tag.FetchAsRectangleF ());
                    tgv.SetNeedsDisplay ();

                }
            };
            av.Show ();
        }