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; }; }
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 (); }