コード例 #1
0
        private void Rename(Item item, bool isFirst)
        {
            ChooseNameWindow chooseNameWindow = new ChooseNameWindow("Rename: ", Path.GetFileNameWithoutExtension(item.FullName));

            if (chooseNameWindow.ShowDialog() == true)
            {
                item.Rename(chooseNameWindow.NewName);
                FillTable(isFirst, isFirst ? FirstPanelPath.Text : SecondPanelPath.Text);
            }
        }
コード例 #2
0
        private void CreateNewFile()
        {
            DirectoryItem directoryItem =
                new DirectoryItem(_isFirstFocused ? FirstPanelPath.Text : SecondPanelPath.Text);
            ChooseNameWindow chooseNameWindow = new ChooseNameWindow("Create new file");

            if (chooseNameWindow.ShowDialog() == true)
            {
                directoryItem.Create(directoryItem.FullName, chooseNameWindow.NewName, Item.FILE);
            }
            FillTable(_isFirstFocused, _isFirstFocused ? FirstPanelPath.Text : SecondPanelPath.Text);
        }
コード例 #3
0
        private void RenameFastKeyOnClick(object sender, RoutedEventArgs e)
        {
            List <Item> items = (_isFirstFocused ? FirstPanel : SecondPanel).Items.Cast <Item>()
                                .Where(item => item.IsChecked).ToList();

            foreach (Item item in items)
            {
                ChooseNameWindow chooseNameWindow = new ChooseNameWindow("Rename file", Path.GetFileNameWithoutExtension(item.FullName));
                // ReSharper disable once PossibleInvalidOperationException
                if ((bool)chooseNameWindow.ShowDialog())
                {
                    item.Rename(chooseNameWindow.NewName);
                }
            }

            UpdatePanels();
        }
コード例 #4
0
        private void ArchiveOnClick(object sender, RoutedEventArgs e)
        {
            ChooseNameWindow chooseNameWindow = new ChooseNameWindow("Archive name");

            if ((bool)chooseNameWindow.ShowDialog())
            {
                string destination = Path.Combine(_isFirstFocused ? FirstPanelPath.Text : SecondPanelPath.Text,
                                                  chooseNameWindow.NewName) + ".zip";
                OperationWindow operationWindow = new OperationWindow("Archiving");
                operationWindow.OnFinish += (o, args) =>
                {
                    operationWindow.Close();
                    UpdatePanels();
                };
                List <Item> items = (_isFirstFocused ? FirstPanel : SecondPanel).Items.Cast <Item>()
                                    .Where(item => item.IsChecked).ToList();
                if (items.Count < 1)
                {
                    return;
                }
                operationWindow.Show();
                operationWindow.Archive(items[0], destination);
            }
        }