Example #1
0
        /// <summary>
        /// 指定したアイテムを削除する
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void deleteItemButton_Click(object sender, RoutedEventArgs e)
        {
            FolderListItem item = (sender as MenuFlyoutItem).DataContext as FolderListItem;

            if (item == null)
            {
                return;
            }

            MessageDialog dialog = new MessageDialog(item.Name + "を本棚から削除しますか?", "確認");

            dialog.Commands.Add(new UICommand("OK", (command) => {
                //TODO:ここに削除処理
                BookCategory category = m_db.QueryBookCategory(item.Name);
                foreach (BookItem bookItem in m_db.QueryBookItemList(category))
                {
                    StorageHistoryManager.RemoveStorage(bookItem.Token, StorageHistoryManager.DataType.Bookshelf);
                }
                m_db.DeleteBookCategory(category);

                this.ViewModel.Init(m_naviParam);
            }));
            dialog.Commands.Add(new UICommand("キャンセル"));
            dialog.DefaultCommandIndex = 1;
            await dialog.ShowAsync();
        }
Example #2
0
    private FolderListItem AddFolderListItem(string path, string label, bool isHighlighted)
    {
        //try getting an item from the pool first
        FolderListItem folderListItem = _folderListItemsPool.Get();

        if (folderListItem == null)
        {
            folderListItem = Instantiate(_folderListItemPrefab, _scrollViewContent);
        }
        else
        {
            //move to the end of the parent's hierarchy to make sure the order of files is followed
            folderListItem.transform.SetAsLastSibling();
        }
        folderListItem.Initialize(path, label, isHighlighted);
        if (isHighlighted)
        {
            _selectedItem = folderListItem;
        }

        folderListItem.Clicked       += OnFolderItemClicked;
        folderListItem.DoubleClicked += OnFolderItemDoubleClicked;

        _currentFolderListItems.Add(folderListItem);
        return(folderListItem);
    }
Example #3
0
        /// <summary>
        /// フォルダー用遷移処理
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="item"></param>
        private static async void navigateFolder(Frame frame, FolderListItem item)
        {
            if (item.Type != FolderListItem.FileType.Folder)
            {
                return;
            }

            LocalDatabase db = new LocalDatabase();

            if (db.QueryBookmark(item.Path) == null)
            {
                frame.Navigate(typeof(FolderSelectPage), new FolderPathNavigateParameter(item.Path));
                return;
            }

            MessageDialog dialog = new MessageDialog("しおりが見つかりました。続きから表示しますか?", "確認");

            dialog.Commands.Add(new UICommand("続きから画像を表示", (command) => {
                frame.Navigate(typeof(ImageFlipPage),
                               new ImageNavigateParameter(ImageNavigateParameter.DataType.Folder, item.Path));
            }));
            dialog.Commands.Add(new UICommand("ファイル一覧", (command) => {
                frame.Navigate(typeof(FolderSelectPage), new FolderPathNavigateParameter(item.Path));
            }));
            dialog.DefaultCommandIndex = 0;
            await dialog.ShowAsync();
        }
Example #4
0
        /// <summary>
        /// フォルダ・ファイルアイテムをクリックした時の遷移処理
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        public static bool OnGridViewItemClick(Frame frame, FolderListItem item)
        {
            if (item == null)
            {
                return(false);
            }

            bool result = false;

            switch (item.Type)
            {
            case FolderListItem.FileType.Folder:
                navigateFolder(frame, item);
                result = true;
                break;

            case FolderListItem.FileType.Archive:
                result = frame.Navigate(typeof(ImageFlipPage),
                                        new ImageNavigateParameter(ImageNavigateParameter.DataType.Archive, item.Path));
                break;

            case FolderListItem.FileType.ImageFile:
                result = frame.Navigate(typeof(ImageFlipPage),
                                        new ImageNavigateParameter(ImageNavigateParameter.DataType.ImageFile, item.Path));
                break;

            default:
                //何もしない
                break;
            }

            return(result);
        }
Example #5
0
    private void OnFolderItemClicked(object sender, EventArgs e)
    {
        FolderListItem clickedItem = sender as FolderListItem;

        if (clickedItem != _selectedItem)
        {
            _selectedItem?.Deselect();
            _selectedItem = clickedItem;

            //save the setting so that it persists between sessions
            PlayerPrefs.SetString(c_SelectedDirectoryKey, clickedItem.Path);
            PlayerPrefs.Save();
        }
        clickedItem.Select();
    }
Example #6
0
 /// <summary>
 /// グリッド更新処理
 /// </summary>
 /// <param name="listItem"></param>
 /// <param name="inRecycleQueue"></param>
 public static void OnGridContentChanging(FolderListItem listItem, bool inRecycleQueue)
 {
     if (listItem != null)
     {
         //画像を遅延読み込みする
         if (inRecycleQueue)
         {
             listItem.ReleaseThumImage();
         }
         else
         {
             listItem.UpdateThumImage();
         }
     }
 }
Example #7
0
 protected override void SetButtonTextFromItem(ToolStripItem item)
 {
     IXenObject o = item.Tag as IXenObject;
     if (o is Folder)  // for folders we want to show the full pathname using a FolderListItem
     {
         Text = String.Empty;
         folderListItem = new FolderListItem(o.opaque_ref, FolderListItem.AllowSearch.None, false);
         folderListItem.Parent = this;
     }
     else
     {
         Text = Helpers.GetName(o);
         folderListItem = null;
     }
     this.Invalidate();
 }
Example #8
0
    private void OnFolderItemDoubleClicked(object sender, EventArgs e)
    {
        FolderListItem clickedItem = sender as FolderListItem;

        try
        {
            if (!string.IsNullOrEmpty(clickedItem.Path))
            {
                Directory.GetDirectories(clickedItem.Path);
            }
        }
        catch (UnauthorizedAccessException)
        {
            Warning.Show("Unauthorized access");
            return;
        }

        UpdateMenuForPath(clickedItem.Path);
    }
Example #9
0
        /// <summary>
        /// アイテムを選択したとき
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            FolderListItem item = e.ClickedItem as FolderListItem;

            if (item == null)
            {
                return;
            }

            if (item.Type != FolderListItem.FileType.Bookshelf)
            {
                return;
            }

            BookCategory           category     = m_db.QueryBookCategory(item.Name);
            IEnumerable <BookItem> bookItemList = m_db.QueryBookItemList(category);

            if (bookItemList.Count() == 0)
            {
                return;
            }

            this.Frame.Navigate(typeof(FolderSelectPage), new BookItemNavigateParameter(m_db, category.Label));
        }
Example #10
0
 public FolderCell(FolderListItem folderListItem)
 {
     this.folderListItem = folderListItem;
     this.Value = String.IsNullOrEmpty(folderListItem.Path) ? Messages.NONE : folderListItem.Path;
 }