public TankMix_History_Fill_Result(Fill fill)
            : base(UITableViewStyle.Grouped, null)
        {
            this.Pushing = true;
            Root = new RootElement ("TankMix_History_Fill_Result") {

            };
        }
 public void update(Fill f)
 {
     Remainder.Value = string.Format("{0:00.00}",f.Remainder) + " " + f.Remainder_Unit;
     AreaTreated.Value = string.Format("{0:00.00}",f.AreaTreated) + " " + f.AreaTreated_Unit;
     AreaRemaining_S.Value = string.Format("{0:00.00}",f.AreaRemaning) + " " + f.AreaRemaning_Unit;
     TankFill.Value = string.Format("{0:00.00}",f.TankFill) + " " + f.TankFill_Unit;
     Net.Value = string.Format("{0:00.00}",f.Net) + " " + f.Net_Unit;
     TankArea.Value = string.Format("{0:00.00}",f.ThisTankArea) + " " + f.ThisTankArea_Unit;
     Product.Value = string.Format("{0:00.00}",f.Product) + " " + f.Product_Unit;
     Adjuvant.Value = string.Format("{0:00.00}",f.Adjuvant) + " " + f.Adjuvant_Unit;
 }
        public TankMix_CalculationCreateFill_2(Fill fill, UINavigationController naiv)
            : base(UITableViewStyle.Grouped, null)
        {
            this.Pushing = true;
            Root = new RootElement ("TankMix_CalculationCreateFill_2");

            var section = new Section (){
                new StringElement("back ",()=>{
                    naiv.PopViewControllerAnimated(true);
                }),
            };
        }
        //Boolean _isLast;
        public TankMix_CalculationCreateNewFill(Fill fill, int index)
            : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement ("Fill " +index.ToString());
            //this.Title = ;
            localFill = new Fill ();
            localFill = fill;

            this.Title = "Fill " + fill.Name + " Result";
            var Section = new Section ();

            Remainder = new StringElement ("Remainder",string.Empty);
            AreaTreated = new StringElement ("Area  Treated so far", string.Empty);

            AreaRemaining_S = new StringElement ("Area Remaining",string.Empty);

            TankFill = new StringElement ("Tank Fill", string.Empty);

            Net = new StringElement ("Net",string.Empty);
            TankArea = new StringElement ("Tank Area",string.Empty);
            Product = new StringElement ("Product",string.Empty);
            Adjuvant = new StringElement ("Adjuvant",string.Empty);

            Section.Add (Remainder);
            Section.Add (AreaTreated);

            Section.Add (AreaRemaining_S);

            Section.Add (TankFill);
            Section.Add (Net);
            Section.Add (TankArea);
            Section.Add (Product);
            Section.Add (Adjuvant);

            Root.Add (Section);

            var backBtn = new UIBarButtonItem ();
            backBtn.Title = "Back";
            backBtn.Clicked += (object sender, EventArgs e) => {
                this.NavigationController.PopViewControllerAnimated(true);
            };
            this.NavigationItem.LeftBarButtonItem = backBtn;

            update (localFill);
        }
        public TankMix_CalculationCreateFill_1(int i, List<Fill> fills)
            : base(UITableViewStyle.Grouped, null)
        {
            this.Pushing = true;
            Root = new RootElement ("Add Fill Information");
            Remainder = new EntryElement ("Remainder","Value",string.Empty);
            TankFill = new EntryElement ("Tank Fill", "Value",string.Empty);
            var index = i - 1;
            var Result = new StringElement ("Result",()=>{

                if (index < fills.Count){
                    // look
                    Console.Out.WriteLine("Look");
                }else if (index == 0 && fills.Count == 0) {
                    // first time
                    var first = new Fill(double.Parse(Remainder.Value),double.Parse(TankFill.Value));
                    fills.Add(first);
                }else{
                    if (index - fills.Count > 1){
                        // no data
                        Console.Out.WriteLine("No data");
                    }else{
                        // create
                        var second = new Fill (fills[i-1],double.Parse(Remainder.Value),double.Parse(TankFill.Value));
                        fills.Add(second);
                    }
                }

            });

            var Section = new Section ();
            Section.Add (Remainder);
            Section.Add (TankFill);
            Section.Add (Result);
            Root.Add (Section);
        }
Пример #6
0
        // Construct for Last
        public Fill(Fill prev, double r,double tf, double ar)
        {
            //Remainder User input
            this.Remainder_Unit = prev.Remainder_Unit;
            this.Remainder = r;
            // Area Treated
            this.AreaTreated_Unit = prev.AreaTreated_Unit;
            this.AreaTreated = prev.AreaTreated + (prev.TankFill - this.Remainder) / HistoryManager.SharedInstance.GetCurrentTankData ().applicationvolume_value.Us_gpa;
            // Area Remaning
            this.AreaRemaning_Unit = prev.AreaRemaning_Unit;
            this.AreaRemaning = ar;
            // Tank Fill
            // area remaning * application volume + sump capacity
            this.TankFill = ar* HistoryManager.SharedInstance.GetCurrentTankData().applicationvolume_value.Us_gpa
                + HistoryManager.SharedInstance.GetCurrentTankData().sumpcapacity_value.Us_gal;
            this.TankFill_Unit = "US gal";
            //Net
            this.Net_Unit = "US gal";
            this.Net = this.TankFill - this.Remainder;
            //This Tank Area
            this.ThisTankArea = this.Net / HistoryManager.SharedInstance.GetCurrentTankData ().applicationvolume_value.Us_gpa;
            this.ThisTankArea_Unit = prev.ThisTankArea_Unit;

            //Product
            this.Product_Unit = prev.Product_Unit;
            this.Product = ThisTankArea * HistoryManager.SharedInstance.GetCurrentTankData ().productrate_value.L_acre;

            //Adjuvant
            this.Adjuvant_Unit = prev.Adjuvant_Unit;
            this.Adjuvant = ThisTankArea * HistoryManager.SharedInstance.GetCurrentTankData ().adjuvantrate_value.Quart_acre;
        }
        public TankMix_CalculationCreateFill(int Index, List<Fill> Fills, int Last)
            : base(UITableViewStyle.Grouped, null)
        {
            this.Pushing = true;

            Root = new RootElement ("Add Input to Fill");

            Remainder = new EntryElement ("Remainder","Us gal",string.Empty);
            Remainder.TextAlignment = UITextAlignment.Right;
            Remainder.KeyboardType = UIKeyboardType.NumbersAndPunctuation;

            var Section = new Section ();
            Section.Add (Remainder);

            if (Index == Last) {
                Console.Out.WriteLine ("Last");
                AreaRemain = new EntryElement ("Area Remainning","Arces",string.Empty);
                AreaRemain.TextAlignment = UITextAlignment.Right;
                AreaRemain.KeyboardType = UIKeyboardType.NumbersAndPunctuation;
                Section.Add (AreaRemain);

            } else {
                TankFill = new EntryElement ("Tank Fill","Us gal",string.Empty);
                TankFill.TextAlignment = UITextAlignment.Right;
                TankFill.KeyboardType = UIKeyboardType.NumbersAndPunctuation;
                Section.Add (TankFill);

            }
            var ResultBtn = new UIBarButtonItem ();
            ResultBtn.TintColor = UIColor.Red;
            ResultBtn.Title = "Result";
            ResultBtn.Clicked += (object sender, EventArgs e) => {

                if(Index == 1 && Fills.Count == 0){
                    // first time

                    if(!string.IsNullOrEmpty(Remainder.Value) && !string.IsNullOrEmpty(TankFill.Value))
                    {
                        Console.Out.WriteLine("Created,first");
                        var newFill = new Fill (double.Parse(Remainder.Value),double.Parse(TankFill.Value));
                        newFill.Name =(Index).ToString();
                        Fills.Add(newFill);
                        this.NavigationController.PushViewController( new TankMix_CalculationCreateNewFill(newFill,Index),true);
                    }else{
                        new UIAlertView ("Error", "No input data", null, "Continue").Show ();
                    }

                }else{
                    if (Index <= Fills.Count){
                        // contain

                        // first
                        if(Index == 1){

                            if(!string.IsNullOrEmpty(Remainder.Value) && !string.IsNullOrEmpty(TankFill.Value)){
                                var newFFills = new Fill (double.Parse(Remainder.Value),double.Parse(TankFill.Value));
                                newFFills.Name = "1";
                                Fills[0] = newFFills;
                                NavigationController.PushViewController(new TankMix_CalculationCreateNewFill(Fills[0],1),true);
                            }else{
                                new UIAlertView ("Error", "No input data", null, "Continue").Show ();
                            }

                        }else if (Index <Last){
                            if(!string.IsNullOrEmpty(Remainder.Value) && !string.IsNullOrEmpty(TankFill.Value)){
                                var newSFills = new Fill (Fills[Index-2],double.Parse(Remainder.Value),double.Parse(TankFill.Value));
                                Fills[Index-1] = newSFills;
                                NavigationController.PushViewController(new TankMix_CalculationCreateNewFill(Fills[Index-1],Index),true);
                            }else{
                                new UIAlertView ("Error", "No input data", null, "Continue").Show ();
                            }

                        }else{

                            // last
                            if(!string.IsNullOrEmpty(Remainder.Value) && !string.IsNullOrEmpty(AreaRemain.Value)){
                                var newLFills = new Fill (Fills[Fills.Count-2],double.Parse(Remainder.Value),0,double.Parse(AreaRemain.Value));
                                Fills[Fills.Count-1] = newLFills;
                                NavigationController.PushViewController(new TankMix_CalculationCreateNewFill(Fills[Fills.Count-1],Fills.Count-1),true);
                            }else{
                                new UIAlertView ("Error", "No input data", null, "Continue").Show ();
                            }

                        }
                        Console.Out.WriteLine("Contained");

                    }else {
                        if (Index - Fills.Count == 1){

                            Console.Out.WriteLine("Created,new");

                            if(Index == Last)
                            {
                                // last create
                                if(!string.IsNullOrEmpty(Remainder.Value) && !string.IsNullOrEmpty(AreaRemain.Value)){
                                    var lastFill = new Fill (Fills[Fills.Count-1],double.Parse(Remainder.Value),0.0,double.Parse(AreaRemain.Value));
                                    Fills.Add(lastFill);
                                    NavigationController.PushViewController( new TankMix_CalculationCreateNewFill(lastFill,Fills.Count),true);
                                }else{
                                    new UIAlertView ("Error", "No input data", null, "Continue").Show ();
                                }

                            }else{
                                // next , create
                                if(!string.IsNullOrEmpty(Remainder.Value) && !string.IsNullOrEmpty(TankFill.Value)){
                                    var nextFill = new Fill (Fills[Fills.Count-1],double.Parse(Remainder.Value),double.Parse(TankFill.Value));
                                    Fills.Add(nextFill);
                                    NavigationController.PushViewController( new TankMix_CalculationCreateNewFill(nextFill,Fills.Count),true);
                                }else{
                                    new UIAlertView ("Error", "No input data", null, "Continue").Show ();
                                }

                            }

                        }else{
                            // no data
                            Console.Out.WriteLine("No Data");
                            new UIAlertView ("Error", "Please, give the previous input", null, "OK").Show ();
                        }
                    }
                }
            };

            NavigationItem.RightBarButtonItem = ResultBtn;
            Root.Add (Section);
        }