Esempio n. 1
0
        public MainViewModel()
        {
            Messenger.Default.Register(this, (CommandMessage message) =>
            {
                if (!ActiveWindowService.IsActive)
                {
                    return;
                }

                var files = message.Parameters.OfType <FileModel>();
                switch (message.CommandType)
                {
                case CommandType.Open:
                    foreach (FileModel file in files)
                    {
                        BrowserTabViewModel viewModel = DocumentManagerService.ActiveDocument?.Content as BrowserTabViewModel;
                        if (viewModel != null)
                        {
                            viewModel.OpenItem(file);
                        }
                    }
                    break;

                case CommandType.OpenInNewTab:
                    foreach (FileModel file in files)
                    {
                        if (file.IsDirectory)
                        {
                            CreateNewTab(file);
                        }
                    }
                    break;

                case CommandType.OpenInNewWindow:
                    foreach (FileModel file in files)
                    {
                        if (file.IsDirectory)
                        {
                            App.CreateNewVindow(file);
                        }
                    }
                    break;
                }
            });
        }
Esempio n. 2
0
        public void CreateNewTab(FileModel selectedFolder = null)
        {
            BrowserTabViewModel viewModel = ViewModelSource.Create <BrowserTabViewModel>();

            viewModel.ParentViewModel = this;

            if (selectedFolder != null)
            {
                viewModel.CurrentFolder = selectedFolder;
            }
            else if (Settings.Default.FirstFolderToOpen == 0)
            {
                viewModel.CurrentFolder = FileSystemHelper.QuickAccess;
            }
            else
            {
                viewModel.CurrentFolder = FileSystemHelper.Computer;
            }

            IDocument document = DocumentManagerService.CreateDocument("BrowserTabView", viewModel);

            document.DestroyOnClose = true;
            document.Show();
        }