public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            switch (editingStyle) {
            case UITableViewCellEditingStyle.Delete:
                // remove the item from the underlying data source
                this.RaiseLagerObjectDeleted(indexPath.Row);
                tableItems.RemoveAt(indexPath.Row);
                // delete the row from the table
                tableView.DeleteRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);

                break;

            case UITableViewCellEditingStyle.Insert:
                //---- create a new item and add it to our underlying data

                LagerObject obj = new LagerObject();
                obj.Name = "Inserted";
                obj.imageFileName = "second.png";

                tableItems.Insert (indexPath.Row, obj);

                //---- insert a new row in the table
                tableView.InsertRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
                break;

            case UITableViewCellEditingStyle.None:
                Console.WriteLine ("CommitEditingStyle:None called");
                break;
            }
        }
        public string GenerateContainerManifest(LagerObject input)
        {
            string ic = translate.getTranslatedText ("Items in this container", "Items in this container");
            string name = translate.getTranslatedText ("Name", "Name");
            string desc = translate.getTranslatedText ("Description", "Description");
            string inn = translate.getTranslatedText ("In", "In");

            StringBuilder sb = new StringBuilder ();
            if (input != null) {
                Lager laggy = dao.GetLagerByID (input.LagerID);
                sb.AppendLine (name + ":" + input.Name + "--" + desc + ":" + input.Description);
                if (laggy != null) {
                    sb.AppendLine (inn + ":" + laggy.Name);
                }

                if (input.isContainer == "true") {
                    sb.AppendLine (ic + ";");
                    IList<Item> items = dao.GetAllItemsInBox (input);
                    foreach (Item itty in items) {
                        sb.AppendLine (itty.toString ());
                    }
                }

            }
            return sb.ToString ();
        }
 public string GenerateContainerSubject(LagerObject input)
 {
     string ContainerIndex = translate.getTranslatedText ("Manifest/index for Container");
     StringBuilder sb = new StringBuilder ();
     if (input != null)
         sb.AppendLine (ContainerIndex + ":" + input.Name);
     return sb.ToString ();
 }
Beispiel #4
0
 public virtual void ShowBigItemDetails(LagerObject item)
 {
     //			if(UserInterfaceIdiomIsPhone){
         BigItemDetailScreen neo = new BigItemDetailScreen (item);
         this.NavigationController.PushViewController (neo, true);
         //this.NavigationController.PushViewController(neo, true);
     //			}else{
     //				RaiseLagerObjectClicked(item);
     //			}
 }
Beispiel #5
0
 public void AddQRPictureAttachment(MFMailComposeViewController mailContr, LagerObject input)
 {
     if (this.IncludeQr()) {
         if (input != null) {
             UIImage image = AppDelegate.key.MakeQr (input);
             NSData imagedata = image.AsPNG ();
             mailContr.AddAttachmentData (imagedata, "image/png", "QR.png");
         }
     }
 }
Beispiel #6
0
 public void AddPictureAttachment(MFMailComposeViewController mailContr, LagerObject input)
 {
     var documentsDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
     if (!string.IsNullOrEmpty (input.imageFileName)) {
         string jpg = input.Name + ".jpg";
         string filename = System.IO.Path.Combine (documentsDirectory, input.imageFileName);
         UIImage image = UIImage.FromFile (filename);
         NSData imagedata = image.AsJPEG ();
         mailContr.AddAttachmentData (imagedata, "image/jpeg", jpg);
     }
 }
Beispiel #7
0
        public void ShowBoxItemDetails(LagerObject box)
        {
            //			if(UserInterfaceIdiomIsPhone){
                Console.WriteLine ("showBoxItemDetails()");
                boxdetail = new ContainerDetails (box);
                this.NavigationController.PushViewController (boxdetail, true);
            //			}else{
            //				RaiseContainerClicked(box);
            //			}

            if (boxdetail != null) {
                boxdetail.LagerObjectSaved += (object sender, LagerObjectSavedEventArgs e) => PopulateTable ();
            }
        }
        public void ShowDetails(LagerObject myObject)
        {
            this.myObject = myObject;
            bidc = new BigItemDetailContent (myObject, this);
            innerScroll = new UIScrollView (UIScreen.MainScreen.Bounds);
            innerScroll.ContentSize = bidc.GetContentsize ();
            innerScroll.AddSubview (bidc.View);
            innerScroll.UserInteractionEnabled = true;
            bidc.ShowDetails (myObject);
            View.AddSubview (innerScroll);

            bidc.BigItemSaved += (object sender, BigItemSavedEventArgs e) => {
                var handler = this.BigItemSaved;
                if(handler != null){
                    handler(sender, e);
                }
            };
        }
Beispiel #9
0
        public void ShowDetails(LagerObject boks)
        {
            this.boks = boks;
            cdc = new ContainerDetailsContent (boks, this);
            innerview = new UIScrollView (UIScreen.MainScreen.Bounds);
            innerview.ContentSize = cdc.GetContentsize ();
            innerview.AddSubview (cdc.View);
            innerview.UserInteractionEnabled = true;
            cdc.ShowDetails (boks);
            this.View.AddSubview (innerview);

            cdc.LagerObjectSaved += (object sender, LagerObjectSavedEventArgs e) => {
                var handler = this.LagerObjectSaved;
                if(handler != null){
                    handler(this,e);
                }
            };

            //this.CreateEmailBarButton ();
        }
Beispiel #10
0
 public void StoreActiveGallery(LagerObject lo)
 {
     var store = NSUbiquitousKeyValueStore.DefaultStore;
     store.SetLong ("activeLocation", (long)lo.ID);
     store.SetString ("activeGalleryType", "LagerObject");
     store.Synchronize ();
 }
Beispiel #11
0
 public UIImage MakeQr(LagerObject lo)
 {
     if (lo != null) {
         var writer = new BarcodeWriter ();
         writer.Format = BarcodeFormat.QR_CODE;
         var result = writer.Write (lo.ID.ToString ());
         return result;
     } else {
         return null;
     }
 }
 public BigItemDetailClickedEventArgs(LagerObject item)
     : base()
 {
     this.lagerobject = item;
 }
Beispiel #13
0
        void ExtractContainer()
        {
            LagerObject lo = new LagerObject ();
            String recomb = Recombine ();
            lo.Name = recomb;
            lo.Description = recomb;
            lo.type = recomb;

            lo.ImageTagId = tag.ID;
            string[] res = ExtractTagImages (tag);
            lo.thumbFileName = res [1];
            lo.imageFileName = res [0];
            lo.isContainer = "true";
            lo.isLargeObject = "false";
            ContainerDetails cd = new ContainerDetails (lo);
            this.NavigationController.PushViewController (cd, true);
        }
Beispiel #14
0
 public ContainerDetails(LagerObject boks)
 {
     this.boks = boks;
 }
Beispiel #15
0
        public IList<Item> GetAllItemsInBox(LagerObject boks)
        {
            IList<Item> myList = null;

                myList =   conn.Query<Item> ("select * from Item where boxID = ?", boks.ID);

            return myList;
        }
Beispiel #16
0
 public GalleryViewController(LagerObject Container)
 {
     ActiveContainer = Container;
     activeSet = true;
     ActiveType = "Container";
 }
 public void SetLagerButtonLabel(LagerObject itty)
 {
     StringBuilder sb = new StringBuilder ();
     sb.Append (MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("In", "In"));
     sb.Append (":");
     if (itty != null) {
         Lager lager = AppDelegate.dao.GetLagerById (itty.LagerID);
         //				boks.LagerID = lo.ID;
         //				SaveIt ();
         if (lager != null) {
             if (!string.IsNullOrEmpty (lager.Name)) {
                 sb.Append (lager.Name);
             }
         }
     }
     this.btnIn.SetTitle (sb.ToString (), UIControlState.Normal);
 }
Beispiel #18
0
 void raiseDismissal(LagerObject lo)
 {
     var handler = this.DismissEvent;
     if(handler != null){
         handler(this, new ContainerClickedEventArgs(lo));
     }
 }
 public LagerObjectClickedEventArgs(LagerObject lagerobject)
     : base()
 {
     this.LagerObject = lagerobject;
 }
Beispiel #20
0
 void SaveLagerObjectInner(LagerObject myObject)
 {
     LagerObject obj = this.GetLagerObjectByID (myObject.ID);
     if (obj == null) {
         conn.Insert (myObject);
     }
     else {
         conn.Update (myObject);
     }
 }
        public void ShowDetails(LagerObject myobj)
        {
            //TODO remember to deselect left table after showing details
            MyCurrentObject = myobj;

            Title = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Big Items Details", "Big Items Details");
            this.fieldBigName.Placeholder = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Name", "Name");
            this.fieldBigDescription.Placeholder = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Description", "Description");
            var count = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Count", "Count");
            count = count + ":";
            if (myobj != null) {

                this.fieldBigName.Text = myobj.Name;
                this.fieldBigName.Font = UIFont.FromName ("Cochin-BoldItalic", 22f);
                this.fieldBigDescription.Text = myobj.Description;
                this.fieldBigDescription.Font = UIFont.FromName ("AmericanTypewriter", 12f);

                antall.Text = count + MyCurrentObject.antall.ToString ();
            }
            AddTagList ();
            releaseKeyboard ();

            if (MyCurrentObject != null) {
                this.antallStepper.Value = MyCurrentObject.antall;
                this.antallStepper.ValueChanged += (object sender, EventArgs e) => {
                    double ant = this.antallStepper.Value;
                    antall.Text = count + ant;
                    MyCurrentObject.antall = ant;
                    AppDelegate.dao.SaveLagerObject (MyCurrentObject);
                };
                cashValue.Text = MyCurrentObject.cashValue.ToString ();
                cashValue.EditingDidEnd += (object sender, EventArgs e) => {
                    try {
                        double newvalue = double.Parse (cashValue.Text);
                        MyCurrentObject.cashValue = newvalue;
                        AppDelegate.dao.SaveLagerObject (MyCurrentObject);
                        Console.WriteLine("saved cashvalue:"+MyCurrentObject.cashValue);
                    } catch (Exception ex) {
                        Console.WriteLine ("coudlnt parse;" + cashValue.Text + "ex:" + ex.ToString ());
                        cashValue.Text = MyCurrentObject.cashValue.ToString ();
                    }
                };
                if (MyCurrentObject.imageFileName != null) {
                    imp.SetNewImageName (MyCurrentObject.imageFileName);
                }
            }

            currency.Text = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Currency", "Currency");

            showReceipts.SetTitle (MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Show Receipts", "Show Receipts"), UIControlState.Normal);
            showReceipts.TouchUpInside += (object sender, EventArgs e) => {
                InsurancePhotoController ipc = new InsurancePhotoController(myobj);
                ancestor.NavigationController.PushViewController(ipc,true);
                //PresentViewController(ipc,true, null);
                //nc.PushViewController(ipc,false);
            };
        }
 public InsurancePhotoController(LagerObject lagerobject)
 {
     this.currentID = lagerobject.ID;
     this.lagerobject = lagerobject;
     isLargeObject = true;
 }
Beispiel #23
0
        void InitActiveField()
        {
            RectangleF activeRect = new RectangleF (0, 66, View.Bounds.Width, 40);
            ActiveText = new UILabel (activeRect);
            ActiveText.Font = UIFont.FromName ("Helvetica", 24);
            ActiveText.ShadowColor = UIColor.Gray;
            ActiveText.ShadowOffset = new SizeF (1.0f, 0.2f);
            ActiveText.TextColor = UIColor.Black;
            ActiveText.TextAlignment = UITextAlignment.Center;

            if (!activeSet) {

                activeID = AppDelegate.key.GetActiveGalleryID ();

                if (ActiveType == null) {
                    ActiveType = AppDelegate.key.GetActiveGalleryType ();
                }

                if (ActiveType == null) {
                    ActiveType = "ALL";
                }

                if (ActiveType.Equals ("Lager")) {
                    ActiveContainer = null;
                    ActiveLocation = AppDelegate.dao.GetLagerById (activeID);
                    if (ActiveLocation != null && ActiveLocation.Name != null) {
                        ActiveText.Text = ActiveLocation.Name;
                    }
                }

                if (ActiveType.Equals ("Container")) {
                    ActiveLocation = null;
                    ActiveContainer = AppDelegate.dao.GetContainerById (activeID);
                    ActiveText.Text = ActiveContainer.Name;
                }

                if (ActiveType == "ALL") {
                    ActiveLocation = null;
                    ActiveContainer = null;
                    ActiveText.Text = "ALL";
                }

                View.AddSubview(ActiveText);

            }
        }
 protected override void Dispose(bool disposing)
 {
     MyCurrentObject = null;
     sl = null;
     Ic.Dispose ();
     ancestor = null;
     tlc.Dispose ();
     base.Dispose (disposing);
 }
Beispiel #25
0
 public void SaveLagerObject(LagerObject myObject)
 {
     if (limitedSave && getLagerOBjectsCount () > limitedSaves) {
         RaiseLimitExceeded ();
     } else {
         SaveLagerObjectInner (myObject);
     }
 }
 public BigItemDetailContent(LagerObject myObject,UIViewController ancestor)
 {
     this.ancestor = ancestor;
     this.MyCurrentObject = myObject;
 }
Beispiel #27
0
 public void DeleteBox(int id)
 {
     LagerObject deleteme = new LagerObject ();
         deleteme.ID = id;
         conn.Delete (deleteme);
 }
 public ContainerClickedEventArgs(LagerObject container)
     : base()
 {
     this.container = container;
 }
Beispiel #29
0
        void ExtractLarge()
        {
            LagerObject lo = new LagerObject ();

            String recomb = Recombine ();
            lo.Name = recomb;
            lo.Description = recomb;

            lo.ImageTagId = tag.ID;
            string[] res = ExtractTagImages (tag);
            lo.thumbFileName = res [1];
            lo.imageFileName = res [0];
            lo.isContainer = "false";
            lo.isLargeObject = "true";
            BigItemDetailScreen bids = new BigItemDetailScreen (lo);
            this.NavigationController.PushViewController (bids, true);
        }
 public void WillBeginTableEditing(UITableView tableView)
 {
     tableView.BeginUpdates ();
     // insert the 'ADD NEW' row at the end of table display
     tableView.InsertRows (new NSIndexPath[] {
         NSIndexPath.FromRowSection (tableView.NumberOfRowsInSection (0), 0)
     }, UITableViewRowAnimation.Fade);
     // create a new item and add it to our underlying data (it is not intended to be permanent)
     LagerObject o = new LagerObject ();
     o.Name = "(add new)";
     //			o.imageFileNames = new List<string> ();
     o.imageFileName = "first.png";
     tableItems.Add (o);
     tableView.EndUpdates (); // applies the changes
 }