Ejemplo n.º 1
0
        private void PromptNewCategoryName(string category)
        {
            string newCategoryName = InputDialog.Prompt(
                string.Format(Translations["MainPage.EditCategory"], category),
                Translations["MainPage.EditCategoryHeader"],
                category);

            if (!String.IsNullOrWhiteSpace(newCategoryName))
            {
                LiftItems.RenameCategory(category, newCategoryName);

                UpdateLiftItems();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Triggered for instance if files or folders are dragged from Windows Explorer
        /// </summary>
        /// <returns>true it could handle the drop event</returns>
        private bool TryToHandleAsFileDrop(string category, DragEventArgs e)
        {
            if (!e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                return(false);
            }

            var files = e.Data.GetData(DataFormats.FileDrop) as string[];

            foreach (string path in files)
            {
                LiftItems.Add(new Data.LiftItem()
                {
                    Category = category, FilePath = path
                });
            }
            UpdateLiftItems();
            return(true);
        }
Ejemplo n.º 3
0
        private void DeleteSelectedItem()
        {
            var item = lbLiftItems.SelectedItem as Data.LiftItem;

            if (item == null)
            {
                return;
            }

            if (Options.PromptOnDelete)
            {
                var text   = string.Format(Translations["MainPage.ConfirmDelete"], item.Title);
                var result = MessageBox.Show(text, Translations["MainPage.ConfirmDeleteHeader"], MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
                if (result != MessageBoxResult.Yes)
                {
                    return;
                }
            }

            LiftItems.Remove(item);
            UpdateLiftItems();
        }
Ejemplo n.º 4
0
        private void EditItem(Data.LiftItem item)
        {
            var edit = new View.EditItem(item);

            edit.Return += (sender, e) =>
            {
                SetWindowTitle(); // update the window title after returning to this page
                Data.LiftItem changed = e.Result;
                if (changed == null)
                {
                    return;
                }
                if (selectedItem != null)
                {
                    LiftItems.Remove(selectedItem);
                }
                LiftItems.Add(changed);
                UpdateLiftItems();
            };

            this.NavigationService.Navigate(edit);
        }
Ejemplo n.º 5
0
 private void ListBoxItem_ContextMenu_Duplicate_Click(object sender, RoutedEventArgs e)
 {
     LiftItems.AddClone(lbLiftItems.SelectedItem as Data.LiftItem);
     UpdateLiftItems();
 }