예제 #1
0
        void InspectorButton_Clicked(object sender, EventArgs e)
        {
            Inspector inspector = ((InspectorButton)sender).inspector;

            if (inspector == Inspector.Null)
            {
                return;
            }
            List <Inspector> selected  = page.selectedInspectors;
            List <Inspector> available = page.availableInspectors;

            if (available.Contains(inspector))
            {
                available.Remove(inspector);
                //selected.Add(inspector);
                selected.Insert(selected.Count - 1, inspector);
            }
            else if (page.selectedInspectors.Contains(inspector))
            {
                selected.Remove(inspector);
                //available.Add(inspector);
                available.Insert(available.Count - 1, inspector);
            }
            else
            {                   //ya dun goofed.
                throw new DataMisalignedException();
            }
            EditInspectionPage.UpdateInspectorListView(selected, page.selectedListView, page);
            EditInspectionPage.UpdateInspectorListView(available, page.availableListView, page);
            //page.selectedListView = EditInspectionPage.CreateInspectorsListView(page.selectedInspectors, page);
            //page.availableListView = EditInspectionPage.CreateInspectorsListView(page.availableInspectors, page);
        }
예제 #2
0
        public async void openEditPage(object sender, EventArgs e)
        {
            BoundMenuItem <Inspection> button = (BoundMenuItem <Inspection>)sender;
            Inspection         inspection     = button.BoundObject;
            EditInspectionPage page           = new EditInspectionPage(inspection);

            page.CallingPage = this;
            await App.Navigation.PushAsync(page);
        }
예제 #3
0
 public void ResetInspectors()
 {
     foreach (Inspector inspector in App.database.LoadAllInspectors())
     {
         if (!selectedInspectors.Any(i => i.Id == inspector.Id) && !availableInspectors.Any(i => i.Id == inspector.Id))
         {
             //There shouldn't be more than 1 new inspector at a time.
             availableInspectors.Insert(availableInspectors.Count - 1, inspector);
             EditInspectionPage.UpdateInspectorListView(availableInspectors, availableListView, this);
         }
     }
 }
예제 #4
0
 public InspectorButton(EditInspectionPage page)
 {
     this.page = page;
     Clicked  += InspectorButton_Clicked;
 }
예제 #5
0
 public static void UpdateInspectorListView(List <Inspector> inspectors, ListView view, EditInspectionPage page)
 {
     view.ItemsSource  = inspectors;
     view.ItemTemplate = new DataTemplate(() =>
     {
         InspectorButton button = new InspectorButton(page);
         button.SetBinding(InspectorButton.InspectorProperty, "SelfReference");
         button.SetBinding(InspectorButton.TextProperty, "Name");
         ViewCell cell = new ViewCell();
         cell.View     = button;
         return(cell);
     });
 }