private void Later_Clicked(object sender, EventArgs e) { if (pickTree.SelectedIndex > -1 && pickPlot.SelectedIndex > -1) { Tree ThisTree = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(pickTree.SelectedIndex); if (GraphNo < ThisTree.GetHistory().Count - 1) { GraphNo++; LatEar(); } } else if (pickPlot.SelectedIndex > -1) { Plot ThisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex); SortedList <int, List <double> > dates = new SortedList <int, List <double> >(); for (int x = 0; x < ThisPlot.getTrees().Count; x++) { SortedList <DateTime, (double, double, double)> thisHistory = ThisPlot.getTrees().ElementAt(x).GetHistory(); try { dates.Add(thisHistory.First().Key.Year, new List <double>()); } catch { } try { dates.Add(thisHistory.Last().Key.Year, new List <double>()); } catch { } } year = Math.Min(year + 1, dates.Last().Key); ShowGraphpick(); if (year >= dates.Last().Key) { Later.IsVisible = false; } } }
protected override void OnAppearing() { base.OnAppearing(); plotty = new ObservableCollection <PlotContainer>(); List <string> pickplotlist = new List <string>(); if (Application.Current.Properties["Language"] != null) { Thread.CurrentThread.CurrentCulture = (CultureInfo)Application.Current.Properties["Language"]; } PlotList1.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Name"); PlotList2.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Trees"); PlotList3.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DateMade"); DunLLoadin(); GraphNo = -1; DetailsList.IsVisible = false; year = DateTime.Now.Year; //pickPlot.Items.Clear(); Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MTY4MzVAMzEzNjJlMzIyZTMwZmMzUTBVc2x2STVZNG4rTm1mdXlXQ1czR09UQ1p0QzB2SmNjWFFtZ2RmOD0="); ((List <Plot>)Application.Current.Properties["Plots"]).Count(); for (int x = 0; x < ((List <Plot>)Application.Current.Properties["Plots"]).Count(); x++) { Plot thisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(x); plotty.Add(new PlotContainer(thisPlot.GetName(), thisPlot.getTrees().Count, thisPlot.YearPlanted)); pickplotlist.Add(((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(x).GetName()); } pickPlot.ItemsSource = pickplotlist; PlotList.ItemsSource = plotty; pickPlot.SelectedIndex = -1; PlotList.IsVisible = true; Girtdswitch.IsVisible = false; Girtdlab.IsVisible = false; }
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()); } }
private async void All_Clicked() { Plot thispolt = null; thispolt = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlotOne.SelectedIndex); List <DetailsGraph2> Detail = new List <DetailsGraph2>(); ObservableCollection <DetailsGraph2> DetailSort = new ObservableCollection <DetailsGraph2>(); double totalv = 0; double totalp = 0; for (int x = 0; x < plotTog.Count; x++) { if (plotTog.ElementAt(x).Selected) { Calculator calc = new Calculator(); if (thispolt != null && PickPrice.SelectedIndex != -1) { calc.SetPrices(((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(PickPrice.SelectedIndex)); double[,] result; result = calc.Calcs(thispolt.getTrees().ElementAt(x).Diameter, thispolt.getTrees().ElementAt(x).Merch, thispolt.getTrees().ElementAt(x).ActualMerchHeight); string resText0 = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("LogClass") + "\n"; string resText1 = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Price") + "\n"; string resText2 = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Volume") + "\n"; SortedList <double, double> brack = calc.GetPrices().GetBrack(); string[] unitcm = { "cm" }; string[] unitm = { "m" }; string[] unitm3 = { "m3" }; for (int i = 0; i < result.GetLength(0); i++) { totalv += result[i, 2]; totalp += result[i, 1] * (((int)Application.Current.Properties["Currenselect"] == -1 ? 1 : ((List <(string, double)>)Application.Current.Properties["Currenlist"]).ElementAt((int)Application.Current.Properties["Currenselect"]).Item2)); DetailsGraph2 answer = new DetailsGraph2 { volume = Math.Round(result[i, 2], 4), price = Math.Round(result[i, 1] * (((int)Application.Current.Properties["Currenselect"] == -1 ? 1 : ((List <(string, double)>)Application.Current.Properties["Currenlist"]).ElementAt((int)Application.Current.Properties["Currenselect"]).Item2)), 2), result = result, brack = brack, resultrow = i }; if (result[i, 0] == -1) { answer.label = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("TooSmall"); } else if (result[i, 0] == brack.Count - 1) { answer.label = (Math.Round(brack.ElementAt((int)result[i, 0]).Key *(GirthDBH2.IsToggled ? 1 / Math.PI : 1), 2) + unitcm[0] + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("OrLarger")); } else { answer.label = Math.Round(brack.ElementAt((int)result[i, 0]).Key *(GirthDBH2.IsToggled ? 1 / Math.PI : 1), 2) + "-" + Math.Round(brack.ElementAt((int)result[i, 0] + 1).Key *(GirthDBH2.IsToggled ? 1 / Math.PI : 1), 2) + unitcm[0]; } Detail.Add(answer); } } } } DetailsGraph2 answer2 = new DetailsGraph2 { volume = Math.Round(totalv, 4), price = Math.Round(totalp, 2), label = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Totals") }; Detail.Add(answer2); await PopupNavigation.Instance.PushAsync(MeasureResult.GetInstance(Detail)); }
private void pickPlotOne_SelectedIndexChanged(object sender, EventArgs e) { ObservableCollection <Tree> TreeTails = new ObservableCollection <Tree>(); plotTog.Clear(); if (pickPlotOne.SelectedIndex > -1) { labbott.IsVisible = true; GirthDBH2.IsVisible = true; Plot ThisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlotOne.SelectedIndex); List <Tree> TreeList = ThisPlot.getTrees(); Tree ThisTree; for (int x = 0; x < TreeList.Count; x++) { plotTog.Add(new SelectableData(TreeList.ElementAt(x), false, GirthDBH2.IsToggled)); ThisTree = TreeList.ElementAt(x); TreeTails.Add(ThisTree); } DetailsList.IsVisible = true; LogList.IsVisible = false; DetailsList.ItemsSource = plotTog; Show(false); DetailsList.IsVisible = true; DetailsList.HeightRequest = (40 * Math.Min(TreeTails.Count, 5)) + (10 * Math.Min(TreeTails.Count, 5)) + 60; } }
//activates when index is changed in the plot picker public void SelectPlot() { string trees = ""; PlotList.IsVisible = false; ObservableCollection <Tree> TreeTails = new ObservableCollection <Tree>(); string girths = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Girth") + "\n"; string heights = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Height") + "\n"; if (pickPlot.SelectedIndex > -1) { ToolEdit.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("EditPlot"); Plot ThisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex); trees = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Name") + ": " + ThisPlot.GetName(); if (ThisPlot.Owner != null && ThisPlot.Owner != "") { trees += AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Owner") + ": " + ThisPlot.Owner + "\n"; } if (ThisPlot.NearestTown != null && ThisPlot.NearestTown != "") { trees += AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Location") + ": " + ThisPlot.NearestTown + "\n"; } if (ThisPlot.Describe != null && ThisPlot.Describe != "") { trees += AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Comments") + ": " + ThisPlot.Describe + "\n"; } List <Tree> TreeList = ThisPlot.getTrees(); List <DetailsGraph2> Detailstree = new List <DetailsGraph2>(); Tree ThisTree; for (int x = 0; x < TreeList.Count; x++) { ThisTree = TreeList.ElementAt(x); Detailstree.Add(new DetailsGraph2() { girth = Math.Round(ThisTree.Diameter * (Girtdswitch.IsToggled?1 / Math.PI : 1), 2), ID = ThisTree.Id, price = ThisTree.Merch, tree = ThisTree, label2 = (ThisTree.ActualMerchHeight > 0)? ThisTree.ActualMerchHeight.ToString():"?" }); TreeTails.Add(ThisTree); } DetailsList.IsVisible = true; ToolPricing.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("CPrice"); DetailsList.ItemsSource = Detailstree; DetailsList.HeightRequest = (40 * Math.Min(TreeTails.Count, 5)) + (10 * Math.Min(TreeTails.Count, 5)) + 60; PlotTitle.Text = trees; ToolDelete.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("DeletePlot"); ToolDeleteTree.Text = ""; Girtdswitch.IsVisible = true; Girtdlab.IsVisible = true; } else { OnAppearing(); } }
public void Kamel() { string output = "<?xml version =\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n<Document>"; for (int x = 0; x < ((List <Plot>)Application.Current.Properties["Plots"]).Count; x++) { Plot ThisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(x); output += "\n<Placemark>\n<name>" + ThisPlot.GetName() + "</name>\n"; double[] tag = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(x).GetTag(); output += "<description>\n"; if (ThisPlot.YearPlanted > 0) { output += AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("YPlant") + ": " + ThisPlot.YearPlanted.ToString() + "\n"; } List <Tree> TreeList = ThisPlot.getTrees(); int year = DateTime.Now.Year; output += "</description>"; output += "<Point>\n<coordinates>" + tag[1].ToString() + "," + tag[0].ToString() + "</coordinates>\n </Point>\n"; if (ThisPlot.GetPolygon().Count > 0) { output += "<Polygon><outerBoundaryIs><LinearRing><coordinates>\n"; for (int y = 0; y < ThisPlot.GetPolygon().Count; y++) { output += ThisPlot.GetPolygon().ElementAt(y).Longitude.ToString() + ", " + ThisPlot.GetPolygon().ElementAt(y).Latitude + ", 0.\n"; } output += " </coordinates></LinearRing></outerBoundaryIs></Polygon>\n<Style><PolyStyle><color>#a00000ff</color><outline>0</outline></PolyStyle></Style>\n</Placemark>"; } else { output += "</Placemark>"; } } output += "\n</Document>\n</kml>"; byte[] byteArray = Encoding.UTF8.GetBytes(output); MemoryStream stream = new MemoryStream(byteArray); Xamarin.Forms.DependencyService.Get <ISave>().Save("map.kml", "text/plain", stream); }
//activates when index for tree picker is changed public void SelectTree() { SummList.IsVisible = false; if (((bool)Application.Current.Properties["Tutorial"]) && (bool)Application.Current.Properties["Tutmanage2"] && (bool)Application.Current.Properties["Tutdt"]) { Device.BeginInvokeOnMainThread(async() => { bool res = await DisplayAlert("Tree information", "This page shows you information about the selected tree.", AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Continue"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Skip")); if (res) { await DisplayAlert("Tree information", "The \"Earlier\" and \"Later\" buttons change the data to the previous/next measurement that was made for that tree. The add measurement button allows you to add new measurement data for the tree.", AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Next")); await DisplayAlert("Tree information", "The first page show for a tree is always the most recent measurement.", AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Next")); Application.Current.Properties["Tutdt"] = false; } else { Application.Current.Properties["Tutdt"] = false; } }); } //ShowGraph.SelectedIndex=-1; Plot ThisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex); List <Tree> TreeList = ThisPlot.getTrees(); string girths = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Girth") + "\n"; string heights = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Height") + "\n"; if (pickTree.SelectedIndex > -1 && pickPlot.SelectedIndex > -1 && pickTree.SelectedIndex < pickTree.Items.Count - 1) { Tree ThisTree = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex).getTrees().ElementAt(pickTree.SelectedIndex); GraphNo = ThisTree.GetHistory().Count - 1; PickPrice.Focus(); } else if (pickTree.SelectedIndex == -1) { SelectPlot(); return; } }
public void SaveTrees2() { int count = 0; using (ExcelEngine excelEngine = new ExcelEngine()) { excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2013; IWorkbook workbook = excelEngine.Excel.Workbooks.Create(1); workbook.Version = ExcelVersion.Excel97to2003; IWorksheet worksheet = workbook.Worksheets[0]; worksheet.SetValue(1, 1, "Tree ID"); worksheet.SetValue(1, 2, "Plot"); worksheet.SetValue(1, 3, "Date"); worksheet.SetValue(1, 4, "Girth"); worksheet.SetValue(1, 5, "Height"); worksheet.SetValue(1, 6, "Merchantable Height"); worksheet.SetValue(1, 14, "Currency"); worksheet.SetValue(1, 15, "Rate vs USD"); for (int x = 0; x < ((List <(string, double)>)Application.Current.Properties["Currenlist"]).Count(); x++) { try { worksheet.SetValue(2 + x, 14, ((List <(string, double)>)Application.Current.Properties["Currenlist"]).ElementAt(x).Item1); worksheet.SetValue(2 + x, 15, ((List <(string, double)>)Application.Current.Properties["Currenlist"]).ElementAt(x).Item2.ToString()); } catch { worksheet.SetValue(2 + x, 15, "ErrorEventArgs"); } } for (int x = 0; x < ((List <Plot>)Application.Current.Properties["Plots"]).Count(); x++) { int minyear = 0; int maxyear = 0; Plot thisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(x); List <Tree> TreeList = thisPlot.getTrees(); for (int y = 0; y < TreeList.Count; y++) { Tree thisTree = TreeList.ElementAt(y); for (int z = 0; z < thisTree.GetHistory().Count; z++) { if (minyear == 0) { minyear = thisTree.GetHistory().ElementAt(z).Key.Year; } else { minyear = Math.Min(minyear, thisTree.GetHistory().ElementAt(z).Key.Year); } maxyear = Math.Max(maxyear, thisTree.GetHistory().ElementAt(z).Key.Year); worksheet.SetValue(2 + count, 1, thisTree.ID.ToString()); worksheet.SetValue(2 + count, 2, thisPlot.GetName().ToString()); worksheet.SetValue(2 + count, 3, thisTree.GetHistory().ElementAt(z).Key.ToString()); worksheet.SetValue(2 + count, 4, thisTree.GetHistory().ElementAt(z).Value.Item1.ToString()); worksheet.SetValue(2 + count, 5, thisTree.GetHistory().ElementAt(z).Value.Item2.ToString()); worksheet.SetValue(2 + count, 6, thisTree.GetHistory().ElementAt(z).Value.Item3.ToString()); count++; } } } worksheet.SetValue(1, 11, count.ToString()); MemoryStream stream = new MemoryStream(); workbook.SaveAs(stream); workbook.Close(); Xamarin.Forms.DependencyService.Get <ISave>().Save("trees.xls", "application/msexcel", stream); } }
//activates when index is changed in the plot picker public async void SelectPlot() { string trees = ""; if (pickTree.SelectedIndex != -1) { pickTree.SelectedIndex = -1; return; } SummList.IsVisible = false; Girtdlab.IsVisible = true; Girtdswitch.IsVisible = true; PlotList.IsVisible = false; Listhadler = 0; ShowGraph.IsVisible = true; ObservableCollection <Tree> TreeTails = new ObservableCollection <Tree>(); string girths = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Girth") + "\n"; string heights = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Height") + "\n"; if (pickPlot.SelectedIndex == pickPlot.Items.Count - 1 && pickPlot.SelectedIndex > -1) { await Navigation.PushAsync(new NotPopup()); return; } if (pickPlot.SelectedIndex > -1) { ShowGraph.IsVisible = true; Plot ThisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex); trees = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Name") + ": " + ThisPlot.GetName() + " "; if (ThisPlot.Owner != null && ThisPlot.Owner != "") { trees += AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Owner") + ": " + ThisPlot.Owner + "\n"; } if (ThisPlot.NearestTown != null && ThisPlot.NearestTown != "") { trees += AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Location") + ": " + ThisPlot.NearestTown + "\n"; } if (ThisPlot.Describe != null && ThisPlot.Describe != "") { trees += AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Comments") + ": " + ThisPlot.Describe + "\n"; } List <string> IDlis = new List <string>(); List <Tree> TreeList = ThisPlot.getTrees(); List <DetailsGraph2> Detailstree = new List <DetailsGraph2>(); Tree ThisTree; // pickTree.Items.Clear(); for (int x = 0; x < TreeList.Count; x++) { ThisTree = TreeList.ElementAt(x); Detailstree.Add(new DetailsGraph2() { girth = Math.Round(ThisTree.Diameter * (Girtdswitch.IsToggled?1 / Math.PI : 1), 2), ID = ThisTree.Id, price = ThisTree.Merch, tree = ThisTree, label2 = (ThisTree.ActualMerchHeight > 0)? ThisTree.ActualMerchHeight.ToString():"?" }); TreeTails.Add(ThisTree); IDlis.Add(ThisTree.ID.ToString()); } pickTree.ItemsSource = IDlis; DetailsList.IsVisible = true; LogClassList.IsVisible = false; LogList.IsVisible = false; ListOfTree.Text = ""; GirthOT.Text = ""; HeightOT.Text = ""; DetailsList.ItemsSource = Detailstree; DetailsList.HeightRequest = (40 * Math.Min(TreeTails.Count, 5)) + (10 * Math.Min(TreeTails.Count, 5)) + 60; PlotTitle.Text = trees; pickTree.IsVisible = false; } else { base.OnAppearing(); } }
private void ShowGraphpick2() { SummList.IsVisible = false; ListOfTree.IsVisible = false; GirthOT.IsVisible = false; Girtdlab.IsVisible = true; Girtdswitch.IsVisible = true; if (ShowGraph.SelectedIndex > -1) { } else { brac = -1; } //show regular data for each tree if (ShowGraph.SelectedIndex == 0) { SelectPlot(); Earlier.IsVisible = false; Later.IsVisible = false; ShowGraph.SelectedIndex -= 1; } // averages and data by log class else if (ShowGraph.SelectedIndex == 1 || ShowGraph.SelectedIndex == 2) { ObservableCollection <DetailsGraph> Detail = new ObservableCollection <DetailsGraph>(); Plot ThisPlot = ((List <Plot>)Application.Current.Properties["Plots"]).ElementAt(pickPlot.SelectedIndex); if (ThisPlot.getTrees().Count <= 0) { Device.BeginInvokeOnMainThread(async() => { await DisplayAlert(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("NoTrees"), "This plot contains no trees.", "OK"); return; }); } PriceRange thisRange = ((List <PriceRange>)Application.Current.Properties["Prices"]).ElementAt(PickPrice.SelectedIndex); Calculator Calc = new Calculator(); Calc.SetPrices(thisRange); double total = 0; List <string> Lablels = new List <string>(); List <string> ListLablels = new List <string>(); for (int x = -1; x < thisRange.GetBrack().Count; x++) { if (x == -1) { Lablels.Add("<" + Math.Round((thisRange.GetBrack().ElementAt(0).Key *(Girtdswitch.IsToggled ? 1 : Math.PI)), 2).ToString() + "cm"); } else if (x == thisRange.GetBrack().Count - 1) { Lablels.Add(">" + Math.Round(thisRange.GetBrack().ElementAt(x).Key *(Girtdswitch.IsToggled ? 1 : Math.PI), 2) + "cm"); } else { Lablels.Add(Math.Round(thisRange.GetBrack().ElementAt(x + 1).Key *(Girtdswitch.IsToggled ? 1 : Math.PI), 2) + "cm"); } } Lablels.Add(AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Totals")); int[] logs = new int[thisRange.GetBrack().Count + 1]; int[] logsmerch = new int[thisRange.GetBrack().Count + 1]; double[] vols = new double[thisRange.GetBrack().Count + 1]; double[] volsmerch = new double[thisRange.GetBrack().Count + 1]; double[] vals = new double[thisRange.GetBrack().Count + 1]; double totalvol = 0; double totalvolM = 0; double totalDia = 0; double absVol = 0; double totalTree = 0; int count = 0; int tcount = 0; for (int y = 0; y < ThisPlot.getTrees().Count; y++) { Tree ThisTree = ThisPlot.getTrees().ElementAt(y); SortedList <DateTime, (double, double, double)> Thistory = ThisTree.GetHistory(); try { double[,] result = Calc.Calcs(ThisTree.GetDia(), ThisTree.Merch, ThisTree.ActualMerchHeight); absVol += (0.423 * Math.PI * Math.Pow((ThisTree.GetDia()), 2) * ThisTree.Merch) / 40000; for (int x = 0; x < result.GetLength(0); x++) { logs[(int)result[x, 0] + 1]++; logsmerch[(int)result[x, 0] + 1] += ((result[x, 1] <= 0) ? 0 : 1); vols[(int)result[x, 0] + 1] += result[x, 2]; volsmerch[(int)result[x, 0] + 1] += result[x, 2] * ((result[x, 1] <= 0) ? 0 : 1); vals[(int)result[x, 0] + 1] += result[x, 1]; totalvol += result[x, 2]; totalvolM += ((result[x, 1] <= 0) ? 0 : 1) * result[x, 2]; total += result[x, 1]; totalDia += Math.Max(result[x, 3], 0) * ((result[x, 1] <= 0) ? 0 : 1); count += ((result[x, 1] <= 0) ? 0 : 1); } } catch { } totalTree += ThisTree.GetDia() / Math.PI; tcount++; } // data by log class if (ShowGraph.SelectedIndex == 1) { GirthOT.Text = ""; if (((bool)Application.Current.Properties["Tutorial"]) && (bool)Application.Current.Properties["TLogs"]) { Device.BeginInvokeOnMainThread(async() => { await DisplayAlert("Logs", AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("SummaryTute"), AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Continue")); }); Application.Current.Properties["TLogs"] = false; } Listhadler = 1; for (int x = 1; x < thisRange.GetBrack().Count + 1; x++) { Detail.Add(new DetailsGraph { label = Lablels.ElementAt(x), volume = Math.Round(vols[x], 4), price = Math.Round(vals[x] * (((int)Application.Current.Properties["Currenselect"] == -1 ? 1 : ((List <(string, double)>)Application.Current.Properties["Currenlist"]).ElementAt((int)Application.Current.Properties["Currenselect"]).Item2)), 2), logs = logsmerch[x] });