// open category picker page async Task SwipedRightCategorize(object commandParameter) { // reset for (int i = 0; i < AllCategories.Count; i++) { AllCategories[i].IsChecked = false; } PhotoItemObject = (PhotoItem)commandParameter; for (int i = 0; i < AllCategories.Count; i++) { if (Array.IndexOf(PhotoItemObject.Categories.ToArray(), AllCategories[i].Name) != -1) { AllCategories[i].IsChecked = true; } } // show popup page var page = new PopupListView(); page.BindingContext = this; await PopupNavigation.Instance.PushAsync(page); if (NewCategory != null) { AllCategories.Add(new Category(NewCategory, true)); PickerSource.Add(NewCategory); MapCategorySource.Add(NewCategory); NewCategory = null; OnPropertyChanged("NewCategory"); SaveCategoriesToJson(); } }
async Task InitialCategorize() { // show popup page var page = new PopupListView(); page.BindingContext = this; await PopupNavigation.Instance.PushAsync(page); }
// [Popups] event. Click on button 'UpPopupBtn' private void UpPopupBtn_Click(object sender, EventArgs e) { if (PopupListView.SelectedIndices.Count > 0 && PopupListView.SelectedIndices[0] > 0) // > 0 => 1 - 1 = 0 (maximum up position) { ListViewItem itemToMove = PopupListView.SelectedItems[0]; int indexTo = PopupListView.SelectedIndices[0] - 1; PopupListView.Items.RemoveAt(PopupListView.SelectedIndices[0]); PopupListView.Items.Insert(indexTo, itemToMove); PopupListView.Items[indexTo].Selected = PopupListView.Items[indexTo].Focused = true; PopupListView.Select(); } }
// [Popups] event. Click on button 'DownPopupBtn' private void DownPopupBtn_Click(object sender, EventArgs e) { if (PopupListView.SelectedIndices.Count > 0 && PopupListView.SelectedIndices[0] < PopupListView.Items.Count - 1) { ListViewItem itemToMove = PopupListView.SelectedItems[0]; int indexTo = PopupListView.SelectedIndices[0] + 1; PopupListView.Items.RemoveAt(PopupListView.SelectedIndices[0]); PopupListView.Items.Insert(indexTo, itemToMove); PopupListView.Items[indexTo].Selected = PopupListView.Items[indexTo].Focused = true; PopupListView.Select(); } }
// [Popups] event. Click on button 'AddPopupBtn' private void AddPopupBtn_Click(object sender, EventArgs e) { if (PopupLabelTextBox.Text.Length > 0) { ListViewItem item = new ListViewItem(PopupLabelTextBox.Text); item.SubItems.Add(PopupXPosTextBox.Text + "x" + PopupYPosTextBox.Text); item.SubItems.Add(PopupColorImagePictureBox.BackColor.R + "," + PopupColorImagePictureBox.BackColor.G + "," + PopupColorImagePictureBox.BackColor.B); PopupListView.Items.Add(item); PopupListView.EnsureVisible(PopupListView.Items.Count - 1); //MessageBox.Show("Popup ajoutée !", App.Name, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Veuillez définir un libellé !", App.Name, MessageBoxButtons.OK, MessageBoxIcon.Error); } }