예제 #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());
     }
 }
예제 #2
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());
     }
 }
예제 #3
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());
        }