Esempio n. 1
0
 public async void DelTree()
 {
     if (pickPlot.SelectedIndex > -1 && ToolDelete.Text != "")
     {
         MessagingCenter.Unsubscribe <DeleteConfirm>(this, "Delete");
         MessagingCenter.Subscribe <DeleteConfirm>(this, "Delete", async(sender) => {
             string trees;
             int selec = ((List <DetailsGraph2>)DetailsList.ItemsSource).IndexOf((DetailsGraph2)DetailsList.SelectedItem);
             ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().RemoveAt(selec);
             Plot ThisPlot        = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex);
             trees                = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Name") + ": " + ThisPlot.GetName() + " " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Area") + ": " + Math.Round(ThisPlot.GetArea(), 2) + "km2";
             List <Tree> TreeList = ThisPlot.getTrees();
             Tree ThisTree;
             for (int x = 0; x < TreeList.Count; x++)
             {
                 ThisTree = TreeList.ElementAt(x);
             }
             int storen             = pickPlot.SelectedIndex;
             pickPlot.SelectedIndex = -1;
             pickPlot.SelectedIndex = storen;
             Titlename.Text         = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saving";
             SaveAll.GetInstance().SaveTrees2();
             Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saved";
             await Task.Delay(5000);
             Titlename.Text  = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots");
             ToolDelete.Text = "";
         });
         await PopupNavigation.Instance.PushAsync(DeleteConfirm.GetInstance());
     }
 }
Esempio n. 2
0
        private async void DelC_Clicked(object sender, EventArgs e)
        {
            int delin = ((List <Currencys>)Currenlist.ItemsSource).IndexOf(doubletap) - 1;

            if (delin == -1)
            {
                return;
            }
            ((List <(string, double)>)Application.Current.Properties["Currenlist"]).RemoveAt(delin);
            nel.Clear();
            nel.Add(new Currencys("$", 1));
            foreach ((string, double)dol in (List <(string, double)>)Application.Current.Properties["Currenlist"])
            {
                nel.Add(new Currencys(dol.Item1, dol.Item2));
            }
            Currenlist.ItemsSource = null;
            Currenlist.ItemsSource = nel;
            title.Text             = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Currencies") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
            SaveAll.GetInstance().SaveTrees2();
            title.Text     = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Currencies") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
            DelC.IsVisible = false;
            if (((int)Application.Current.Properties["Currenselect"]) == delin)
            {
                Application.Current.Properties["Currenselect"] = -1;
                Selected.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CurrenciesS") + ((int)Application.Current.Properties["Currenselect"] == -1 ? "$" : nel.ElementAt((int)Application.Current.Properties["Currenselect"] + 1).Name);
            }
            await Task.Delay(5000);

            title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Currencies");
        }
Esempio n. 3
0
        //adds new measurement to selected tree
        public async void AddTreeMes()
        {
            if (pickPlot.SelectedIndex > -1)
            {
                Application.Current.Properties["Counter"] = pickPlot.SelectedIndex;
                MessagingCenter.Unsubscribe <AddMesPop>(this, "Append");

                MessagingCenter.Subscribe <AddMesPop>(this, "Append", async(sender) =>
                {
                    Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saving";
                    SaveAll.GetInstance().SaveTrees2();
                    Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saved";
                    await Task.Delay(5000);
                    Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots");
                });
                MessagingCenter.Subscribe <AddMesPop>(this, "Alter", async(sender) =>
                {
                    GraphNo = (int)Application.Current.Properties["HCounter"];
                    DetailsList.IsVisible = false;
                    Titlename.Text        = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saving";
                    SaveAll.GetInstance().SaveTrees2();
                    Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saved";
                    await Task.Delay(5000);
                    Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots");
                });
                await PopupNavigation.Instance.PushAsync(AddMesPop.GetInstance());
            }
        }
Esempio n. 4
0
        private async void Conf_Clicked(object sender, EventArgs e)
        {
            if (Name.Text != null && double.TryParse(Rate.Text, out double rates))
            {
                ((List <(string, double)>)Application.Current.Properties["Currenlist"]).Add((Name.Text, rates));
                nel.Add(new Currencys(Name.Text, rates));
                Currenlist.ItemsSource = null;
                Currenlist.ItemsSource = nel;
                title.Text             = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Currencies") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                SaveAll.GetInstance().SaveTrees2();

                title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Currencies") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                Name.Text  = null;
                Rate.Text  = null;
                bool res = await DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CurrenciesSet"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CurrenciesSet2"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("yes"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("no"));

                if (res)
                {
                    Application.Current.Properties["Currenselect"] = ((List <Currencys>)Currenlist.ItemsSource).Count - 2;
                    Selected.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CurrenciesS") + ((int)Application.Current.Properties["Currenselect"] == -1 ? "$" : nel.ElementAt((int)Application.Current.Properties["Currenselect"] + 1).Name);
                }
                await Task.Delay(5000);

                title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Currencies");
            }
        }
Esempio n. 5
0
 private void AddPrice_Clicked(object sender, EventArgs e)
 {
     if (selector > -1 && minDiam.Text != null && price.Text != null && double.TryParse(minDiam.Text, out double mina) && mina > 0 && double.TryParse(price.Text, out double pise) && pise > 0)
     {
         if (!((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(selector).addBrack(mina, pise))
         {
             Device.BeginInvokeOnMainThread(() =>
             {
                 DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SizeExists"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SizeExists"), "OK");
             });
         }
         else
         {
             PopList(selector);
             minDiam.Text = maxDiam.Text;
             maxDiam.Text = null;
             price.Text   = null;
             SaveAll.GetInstance().SavePricing();
         };
     }
     else if (minDiam.Text == null || double.TryParse(minDiam.Text, out double minx) && minx <= 0 || (maxDiam.Text != null && double.TryParse(minDiam.Text, out double minb) && double.TryParse(maxDiam.Text, out double maxa) && minb > maxa))
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DiaInvalid"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DiaInvalid"), "OK");
         });
     }
     else if (price.Text == null || double.TryParse(price.Text, out double prix) && prix <= 0)
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("PriceInvalid"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("PriceInvalid"), "OK");
         });
     }
 }
Esempio n. 6
0
        public async Task NewPlot()
        {
            //If setpoly not = -1 (pin selected) converts a set of placed pins into a polygon

            if (setpoly > -1)
            {
                List <double> lat = new List <double>();
                List <double> lon = new List <double>();
                for (int x = 0; x < newpolygon.Count; x++)
                {
                    lat.Add(newpolygon.ElementAt(x).Latitude);
                    lon.Add(newpolygon.ElementAt(x).Longitude);
                }
                Plot thisPLot = (((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(setpoly));
                if (thisPLot.GetTag()[0] > lat.Min() && thisPLot.GetTag()[1] > lon.Min() && thisPLot.GetTag()[0] < lat.Max() && thisPLot.GetTag()[1] < lon.Max())
                {
                    ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(setpoly).AddPolygon(newpolygon);
                    SaveAll.GetInstance().SavePlots();
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Apin"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Apin"), "OK");
                    });
                }

                setpoly = -1;
                StartMap(false);
                PolyMap();
                return;
            }
            // setpoly = -1 (no pin selected) adds placed pin into list of plots
            else if (!CanAdd)
            {
                double[] geo = new double[2];
                Application.Current.Properties["ThisLocation"] = new double[2];
                geo[0] = Pins.ElementAt(Pins.Count - 1).Position.Latitude;
                geo[1] = Pins.ElementAt(Pins.Count - 1).Position.Longitude;
                Application.Current.Properties["ThisLocation"] = geo;
                MessagingCenter.Send <CreatePlotPopup>(this, "Add");
                await PopupNavigation.Instance.PopAsync();
            }
            else
            {
                Application.Current.Properties["ThisLocation"] = null;
                //MessagingCenter.Subscribe<Popup>(this, "Add", (sender) =>
                //{
                //    CanAdd = true;
                //    StartMap(false);
                //    PolyMap();
                //    SaveAll.GetInstance().SavePlots();
                //});
                //await PopupNavigation.Instance.PushAsync(Popup.GetInstance());
            }
        }
Esempio n. 7
0
        public async void Done2()
        {
            if (PlotName.Text != null && int.TryParse(PlotYear.Text, out int yearout) && yearout <= DateTime.Now.Year)
            {
                double[] geo;
                if (double.TryParse(Latent.Text, out double latout) && double.TryParse(Longents.Text, out double lonout))
                {
                    geo = new double[] { latout, lonout };
                }
                else
                {
                    return;
                }
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).SetName(PlotName.Text);
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).SetTag(geo);
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).Describe    = Comments.Text;
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).NearestTown = Location.Text;
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).Owner       = Owner.Text;

                if (int.Parse(PlotYear.Text) != 0)
                {
                    ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).YearPlanted = yearout;
                }
                for (int i = 0; i < ((List <Plot>)Application.Current.Properties["Plots"]).Count; i++)
                {
                    if (((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(i).GetName() == PlotName.Text && i != (int)Application.Current.Properties["ThisPlot"])
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterName"), "OK");
                        });
                        return;
                    }
                }
                MessagingCenter.Send <PlotPopupEdit>(this, "Edit");
                SaveAll.GetInstance().SavePlots();
                await PopupNavigation.Instance.PopAsync();
            }
            else if (PlotName.Text == null)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterName"), "OK");
                });
            }
            else
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterVDate"), "OK");
                });
            }
        }
Esempio n. 8
0
 public void Save()
 {
     //if (saveplot)
     //{
     SaveAll.GetInstance().SavePlots();
     //}
     //if (savetree)
     //{
     SaveAll.GetInstance().SaveTrees2();
     //}
     SaveAll.GetInstance().Kamel();
 }
Esempio n. 9
0
 private void ToolDown_Clicked(object sender, EventArgs e)
 {
     if (ToolDown.Text == "")
     {
         return;
     }
     else
     {
         Xamarin.Forms.Application.Current.Properties["Boff"] = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DownloadPW");
         loader.FilesList();
         SaveAll.GetInstance().LoadAll();
     }
 }
Esempio n. 10
0
 public void AddPriceName()
 {
     if (Name.Text != null && Len.Text != null && double.TryParse(Len.Text, out double lent) && lent > 0)
     {
         for (int i = 0; i < ((List <PriceRange>)Application.Current.Properties["Prices"]).Count; i++)
         {
             if (((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(i).GetName() == Name.Text)
             {
                 Device.BeginInvokeOnMainThread(() =>
                 {
                     DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("NameInUse"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("NameInUse"), "OK");
                 });
                 return;
             }
         }
         ((List <PriceRange>)Application.Current.Properties["Prices"]).Add(new PriceRange(Name.Text, "Tree", new SortedList <double, double>(), double.Parse(Len.Text)));
         NameOfPrices.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Girth") + ": " + Name.Text + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("LogLength") + ": " + Len.Text + "m";
         ListOfPrices.Text = "";
         pickPrice.Items.Clear();
         for (int x = 0; x < ((List <PriceRange>)Application.Current.Properties["Prices"]).Count(); x++)
         {
             pickPrice.Items.Add(((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(x).GetName());
         }
         selector = ((List <PriceRange>)Application.Current.Properties["Prices"]).Count() - 1;
         pickPrice.SelectedIndex = selector;
         Name.IsVisible          = false;
         Len.IsVisible           = false;
         AddName.IsVisible       = false;
         //AddNew.IsVisible = true;
         maxDiam.IsVisible  = true;
         minDiam.IsVisible  = true;
         price.IsVisible    = true;
         AddPrice.IsVisible = true;
         SaveAll.GetInstance().SavePricing();
     }
     else if (Name.Text == null || Name.Text == "")
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Name") + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("IsInvalid"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Name") + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("IsInvalid"), "OK");
         });
     }
     else
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             DisplayAlert("Length" + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("IsInvalid"), "Length" + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("IsInvalid"), "OK");
         });
     }
 }
Esempio n. 11
0
 async void OpenMenu()
 {
     try
     {
         if (((List <PriceRange>)Application.Current.Properties["Prices"]).Count == 0)
         {
             SaveAll.GetInstance().LoadPriceFiles();
         }
         if (((List <Plot>)Application.Current.Properties["Plots"]).Count == 0)
         {
             SaveAll.GetInstance().LoadPlotFiles();
             SaveAll.GetInstance().LoadTreeFiles2();
         }
     }
     catch { }
     await Navigation.PushAsync(new MenuPage());
 }
Esempio n. 12
0
 private void Confirm_Clicked(object sender, EventArgs e)
 {
     if (select2 > -1)
     {
         if (selector > -1 && minDiam.Text != null && price.Text != null && double.TryParse(minDiam.Text, out double mina) && mina > 0 && double.TryParse(price.Text, out double prix) && prix > 0)
         {
             double key   = ((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(selector).GetBrack().ElementAt(select2).Key;
             double value = ((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(selector).GetBrack().ElementAt(select2).Value;
             ((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(selector).GetBrack().RemoveAt(select2);
             if (!((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(selector).addBrack(double.Parse(minDiam.Text), double.Parse(price.Text)))
             {
                 try
                 {
                     ((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(selector).addBrack(key, value);
                     SaveAll.GetInstance().SavePricing();
                 }
                 catch { }
                 Device.BeginInvokeOnMainThread(() =>
                 {
                     DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SizeExists"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SizeExists"), "OK");
                 });
             }
             else
             {
                 PopList(selector);
                 maxDiam.Text = null;
                 price.Text   = null;
             };
         }
         else if (minDiam.Text == null || double.TryParse(minDiam.Text, out double minx) && minx <= 0)
         {
             Device.BeginInvokeOnMainThread(() =>
             {
                 DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DiaInvalid"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DiaInvalid"), "OK");
             });
         }
         else if (price.Text == null || double.TryParse(price.Text, out double pric) && pric <= 0)
         {
             Device.BeginInvokeOnMainThread(() =>
             {
                 DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("PriceInvalid"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("PriceInvalid"), "OK");
             });
         }
     }
 }
Esempio n. 13
0
 public async void EditPlot()
 {
     if (pickPlot.SelectedIndex > -1)
     {
         Application.Current.Properties["ThisPlot"]     = pickPlot.SelectedIndex;
         Application.Current.Properties["ThisLocation"] = null;
         MessagingCenter.Subscribe <PlotPopupEdit>(this, "Edit", async(sender) =>
         {
             SelectPlot();
             Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saving";
             SaveAll.GetInstance().SavePlots();
             Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saved";
             await Task.Delay(5000);
             Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots");
         });
         await PopupNavigation.Instance.PushAsync(PlotPopupEdit.GetInstance());
     }
 }
Esempio n. 14
0
 public async void DelPlot()
 {
     if (pickPlot.SelectedIndex > -1)
     {
         MessagingCenter.Unsubscribe <DeleteConfirm>(this, "Delete");
         MessagingCenter.Subscribe <DeleteConfirm>(this, "Delete", async(sender) => {
             ((List <Plot>)Application.Current.Properties["Plots"]).RemoveAt(pickPlot.SelectedIndex);
             Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saving";
             SaveAll.GetInstance().SavePlots();
             SaveAll.GetInstance().SaveTrees2();
             Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saved";
             OnAppearing();
             PlotTitle.IsVisible = false;
             await Task.Delay(5000);
             Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots");
         });
         await PopupNavigation.Instance.PushAsync(DeleteConfirm.GetInstance());
     }
 }
Esempio n. 15
0
        private async Task Change_Clicked(EventArgs e)
        {
            string name = PriceList.SelectedItem.ToString();

            for (int x = 0; x < PriceArray.Length; x++)
            {
                if (PriceArray.Cast <string>().ToList().ElementAt(x) == name)
                {
                    select2 = x;
                }
            }
            MessagingCenter.Subscribe <ChangePrice>(this, "Change", async(sender) => {
                PopList(pickPrice.SelectedIndex);
                Pricetitle.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Pricings") + " :" + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                SaveAll.GetInstance().SavePricing();
                await Task.Delay(5000);
                Pricetitle.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Pricings");
            });
            Application.Current.Properties["Priceholder"] = (pickPrice.SelectedIndex, select2);
            await PopupNavigation.Instance.PushAsync(ChangePrice.GetInstance());
        }
Esempio n. 16
0
 private void boffo_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (boffo.Text == "Finished" && (bool)Application.Current.Properties["Load"])
     {
         SaveAll.GetInstance().LoadAll();
     }
     else if ((bool)Application.Current.Properties["Signed"])
     {
         ToolDrive.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Upload");
         ToolDown.Text  = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Download");
         Toolout.Text   = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SignOut");
         ToolIn.Text    = "";
     }
     else if (!(bool)Xamarin.Forms.Application.Current.Properties["Signed"])
     {
         ToolDrive.Text = "";
         ToolDown.Text  = "";
         Toolout.Text   = "";
         ToolIn.Text    = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SignIn");
     }
 }
Esempio n. 17
0
        public async void AddNewTree()
        {
            if (pickPlot.SelectedIndex > -1)
            {
                Application.Current.Properties["Counter"] = pickPlot.SelectedIndex;
                MessagingCenter.Unsubscribe <AddTreePop>(this, "Add");

                MessagingCenter.Subscribe <AddTreePop>(this, "Add", async(sender) =>
                {
                    int hold = pickPlot.SelectedIndex;
                    pickPlot.SelectedIndex = -1;
                    pickPlot.SelectedIndex = hold;
                    Titlename.Text         = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saving";
                    SaveAll.GetInstance().SaveTrees2();
                    Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots") + ": saved";
                    await Task.Delay(5000);
                    Titlename.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("ManagePlots");
                });
                await PopupNavigation.Instance.PushAsync(AddTreePop.GetInstance());
            }
        }
Esempio n. 18
0
        public async Task DelPrice()
        {
            if (pickPrice.SelectedIndex < 0)
            {
                return;
            }
            MessagingCenter.Unsubscribe <DeleteConfirm>(this, "Delete");
            MessagingCenter.Subscribe <DeleteConfirm>(this, "Delete", async(sender) => {
                // for (int x = 0; x < ((List<Plot>)Application.Current.Properties["Plots"]).Count(); x++)
                // {
                //  if (((List<Plot>)Application.Current.Properties["Plots"]).ElementAt(x).GetRange() == ((List<PriceRange>)Application.Current.Properties["Prices"]).ElementAt(selector))
                // {
                //     ((List<Plot>)Application.Current.Properties["Plots"]).ElementAt(x).SetRange(null);
                // }
                // }
                ((List <PriceRange>)Application.Current.Properties["Prices"]).RemoveAt(selector);
                pickPrice.Items.Clear();
                for (int x = 0; x < ((List <PriceRange>)Application.Current.Properties["Prices"]).Count(); x++)
                {
                    pickPrice.Items.Add(((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(x).GetName());
                }

                Name.IsVisible         = false;
                Len.IsVisible          = false;
                AddName.IsVisible      = false;
                maxDiam.IsVisible      = false;
                minDiam.IsVisible      = false;
                price.IsVisible        = true;
                AddPrice.IsVisible     = false;
                ListOfPrices.IsVisible = false;
                Pricetitle.Text        = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Pricings") + " :" + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                SaveAll.GetInstance().SavePricing();
                await Task.Delay(5000);
                Pricetitle.Text  = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Pricings");
                Delete.IsVisible = false;
            });
            await PopupNavigation.Instance.PushAsync(DeleteConfirm.GetInstance());
        }
Esempio n. 19
0
        public async void Done()
        {
            if (PlotName.Text != null && int.TryParse(PlotYear.Text, out int yearout) && yearout <= DateTime.Now.Year)
            {
                double[] geo;
                string[] splitter = Latent.Text.Split(',');
                if (splitter.Count() != 2)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), "Please add coodinates in Lat, Long form", "OK");
                    });
                    return;
                }
                if (Application.Current.Properties["ThisLocation"] == null && double.TryParse(splitter.ElementAt(0), out double latout) && double.TryParse(splitter.ElementAt(1), out double lonout))
                {
                    if (latout > 90 || latout < -90 || lonout > 180 || lonout <= -180)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), "Please enter valid co-ordinates", "OK");
                        });
                        return;
                    }
                    geo = new double[] { latout, lonout };
                }
                else if (Application.Current.Properties["ThisLocation"] != null)
                {
                    geo = (double[])Application.Current.Properties["ThisLocation"];
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), "Please enter valid co-ordinates", "OK");
                    });
                    return;
                }
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).SetName(PlotName.Text);
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).SetTag(geo);
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).Describe    = Comments.Text;
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).NearestTown = Location.Text;
                ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).Owner       = Owner.Text;

                if (int.Parse(PlotYear.Text) != 0)
                {
                    ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt((int)Application.Current.Properties["ThisPlot"]).YearPlanted = yearout;
                }
                for (int i = 0; i < ((List <Plot>)Application.Current.Properties["Plots"]).Count; i++)
                {
                    if (((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(i).GetName() == PlotName.Text && i != (int)Application.Current.Properties["ThisPlot"])
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterName"), "OK");
                        });
                        return;
                    }
                }
                SaveAll.GetInstance().SavePlots();
                Application.Current.Properties["ThisLocation"] = null;
                PlotName.Text = null;
                Comments.Text = null;
                Location.Text = null;
                Owner.Text    = null;
                Latent.Text   = null;
                SaveAll.GetInstance().SaveTrees2();
                await PopupNavigation.Instance.PopAsync();
            }
            else if (PlotName.Text == null)
            {
                NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterName");
            }
            else
            {
                NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterVDate");
            }
        }
Esempio n. 20
0
        public async void Done()
        {
            if (PlotName.Text != null && int.TryParse(PlotYear.Text, out int yearout) && yearout <= DateTime.Now.Year)
            {
                double[] geo;
                if (Latent.Text == null)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("WrongCoord"), "OK");
                    });
                    return;
                }
                string[] splitter = Latent.Text.Split(',');

                if (splitter.Count() != 2)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("WrongCoord"), "OK");
                    });
                    return;
                }
                if (double.TryParse(splitter.ElementAt(0), out double latout) && double.TryParse(splitter.ElementAt(1), out double lonout))
                {
                    if (latout > 90 || latout < -90 || lonout > 180 || lonout <= -180)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("OORCoord"), "OK");
                        });
                        return;
                    }
                    geo = new double[] { latout, lonout };
                }
                //   else if (Application.Current.Properties["ThisLocation"] != null)
                //   {
                //       geo = (double[])Application.Current.Properties["ThisLocation"];
                // }
                else
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("OORCoord"), "OK");
                    });
                    return;
                }
                NextPlot = new Plot(PlotName.Text);
                NextPlot.SetTag(geo);
                NextPlot.Describe    = Comments.Text;
                NextPlot.NearestTown = Location.Text;
                NextPlot.Owner       = Owner.Text;
                if (Application.Current.Properties["Bounds"] != null && ((List <TK.CustomMap.Position>)Application.Current.Properties["Bounds"]).Count > 1)
                {
                    NextPlot.AddPolygon(((List <TK.CustomMap.Position>)Application.Current.Properties["Bounds"]));
                    Application.Current.Properties["Bounds"] = new List <TK.CustomMap.Position>();
                }
                if (int.Parse(PlotYear.Text) != 0)
                {
                    NextPlot.YearPlanted = yearout;
                }
                for (int i = 0; i < ((List <Plot>)Application.Current.Properties["Plots"]).Count; i++)
                {
                    if (((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(i).GetName() == PlotName.Text)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("InputInv"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterName"), "OK");
                        });
                        return;
                    }
                }
                ((List <Plot>)Application.Current.Properties["Plots"]).Add(NextPlot);
                SaveAll.GetInstance().SavePlots();
                Application.Current.Properties["ThisLocation"] = null;
                PlotName.Text = null;
                Comments.Text = null;
                Location.Text = null;
                Owner.Text    = null;
                Latent.Text   = null;
                bool res = await DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("AddTree"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("AddTree2"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("yes"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("no"));

                if (res)
                {
                    Application.Current.Properties["Counter"] = ((List <Plot>)Application.Current.Properties["Plots"]).Count - 1;
                    MessagingCenter.Subscribe <AddTreePop>(this, "Save", async(sender) =>
                    {
                        SaveAll.GetInstance().SaveTrees2();
                        NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CreatePlot") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                        await Task.Delay(5000);
                        NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CreatePlot");
                    });
                    await PopupNavigation.Instance.PushAsync(AddTreePop.GetInstance());
                }
                else
                {
                    NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CreatePlot") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    await Task.Delay(5000);

                    NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CreatePlot");
                }
            }
            else if (PlotName.Text == null)
            {
                NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterName");
            }
            else
            {
                NameLabel.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterVDate");
            }
        }
Esempio n. 21
0
 public void SavePlots()
 {
     SaveAll.GetInstance().SavePlots();
 }
Esempio n. 22
0
        public async void RunAdd()
        {
            if (Double.TryParse(merchheight.Text, out double ans) && ans > 0 && girth.Text != null && height.Text != null && pickPlot.SelectedIndex != -1)
            {
                int ID;
                try { ID = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().Count - 1).Id + 1; }
                catch { ID = 1; }
                if (DateMes.Date > DateTime.Now)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DFute"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterVDate"), "OK");
                    });
                }
                else if (DateMes.Date == null)
                {
                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).AddTree(new Tree((double.Parse(girth.Text) * (GirthDBH.IsToggled ? Math.PI : 1)), (double.Parse(height.Text)), ID, DateTime.Now, ans));
                    Tree boing = (new Tree((double.Parse(girth.Text) * (GirthDBH.IsToggled ? Math.PI : 1)), (double.Parse(height.Text)), ID, DateTime.Now, ans));
                    SaveAll.GetInstance().SaveTrees2();
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree") + " " + ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).GetName(), "OK");
                    });
                    girth.Text       = null;
                    height.Text      = null;
                    merchheight.Text = null;
                    MerhH.IsToggled  = false;
                    try { ID = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().Count - 1).Id + 1; }
                    catch { ID = 1; }
                    labID.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("TreeID") + ": " + ID;
                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    await Task.Delay(5000);

                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree");
                }
                else
                {
                    ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).AddTree(new Tree((double.Parse(girth.Text) * (GirthDBH.IsToggled ? Math.PI : 1)), (double.Parse(height.Text)), ID, DateMes.Date, ans));
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree") + " " + ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).GetName(), "OK");
                    });
                    girth.Text       = null;
                    height.Text      = null;
                    merchheight.Text = null;
                    MerhH.IsToggled  = false;
                    title.Text       = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    SaveAll.GetInstance().SaveTrees2();
                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    try { ID = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().Count - 1).Id + 1; }
                    catch { ID = 1; }
                    labID.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("TreeID") + ": " + ID;
                    await Task.Delay(5000);

                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree");
                }
            }
            else if (girth.Text != null && height.Text != null && pickPlot.SelectedIndex != -1)
            {
                int ID;
                try { ID = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().Count - 1).Id + 1; }
                catch { ID = 1; }
                if (DateMes.Date > DateTime.Now)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DFute"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EnterVDate"), "OK");
                    });
                }
                else if (DateMes.Date == null)
                {
                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    SaveAll.GetInstance().SaveTrees2();
                    ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).AddTree(new Tree((double.Parse(girth.Text) * (GirthDBH.IsToggled ? Math.PI : 1)), (double.Parse(height.Text)), ID, DateTime.Now));
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree") + " " + ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).GetName(), "OK");
                    });
                    girth.Text       = null;
                    height.Text      = null;
                    merchheight.Text = null;
                    MerhH.IsToggled  = false;
                    try { ID = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().Count - 1).Id + 1; }
                    catch { ID = 1; }
                    labID.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("TreeID") + ": " + ID;
                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    await Task.Delay(5000);

                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree");
                }
                else
                {
                    ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).AddTree(new Tree((double.Parse(girth.Text) * (GirthDBH.IsToggled ? Math.PI : 1)), (double.Parse(height.Text)), ID, DateMes.Date));
                    SaveAll.GetInstance().SaveTrees2();
                    girth.Text       = null;
                    height.Text      = null;
                    merchheight.Text = null;
                    MerhH.IsToggled  = false;
                    title.Text       = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    SaveAll.GetInstance().SaveTrees2();
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SuccTree") + " " + ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).GetName(), "OK");
                    });
                    try { ID = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().Count - 1).Id + 1; }
                    catch { ID = 1; }
                    labID.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("TreeID") + ": " + ID;
                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree") + ": " + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved");
                    await Task.Delay(5000);

                    title.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("MeasureTree");
                }
            }
        }