Пример #1
0
        public MainWindowViewModel(ISettingsManager settingsManager,
                                   IFolderDialogManager folderDialogManager,
                                   IFilesManager filesManager,
                                   IEventManager eventManager)
        {
            _settingsManager = settingsManager;
            _filesManager    = filesManager;
            _eventManager    = eventManager;
            LocalizationManager.Instance.SetCulture(_settingsManager.SettingsModel.CultureInfo);


            _eventManager.CopyActionStarted   += FilesManagerOnCopyActionStarted;
            _eventManager.RemoveActionStarted += FilesManagerOnRemoveActionStarted;
            _eventManager.ActionCompleted     += FilesManagerOnActionCompleted;

            SourceViewModel = new FolderInfoViewModel(FolderType.SourceFolder, _settingsManager, folderDialogManager,
                                                      filesManager);
            TargetViewModel = new FolderInfoViewModel(FolderType.TargetFolder, _settingsManager, folderDialogManager,
                                                      filesManager);

            HistoryCommandNotificationRequest  = new InteractionRequest <INotification>();
            SettingsCommandNotificationRequest = new InteractionRequest <INotification>();
            CompletedNotificationRequest       = new InteractionRequest <INotification>();

            RefreshCommand = new DelegateCommand(RefreshAction);
            SettingCommand = new DelegateCommand(SettingsAction);
            HistoryCommand = new DelegateCommand(HistoryAction);

            StartCommand = new DelegateCommand(StartAction);
            CloseCommand = new DelegateCommand(CloseAction);

            FileAction = FileAction.Not;
        }
Пример #2
0
        public ViewResult Explorer(int id, int?page)
        {
            int pageIndex = page.HasValue ? page.Value : 1;

            FolderInfoViewModel model = new FolderInfoViewModel();

            if (CurrentLanguage.Id == WebContext.Current.DefaultLanguage.Id)
            {
                model.References = Service.GetReferences(id, pageIndex, SiteConfig.PageSize, null);
            }
            else
            {
                model.References = Service.GetReferences(id, pageIndex, SiteConfig.PageSize, CurrentLanguage.Id);
            }
            int totalCount          = 0;
            ReferenceBriefDto first = model.References.FirstOrDefault();

            if (first != null)
            {
                totalCount = first.TotalCount;
            }
            model.Pagination           = new PaginationViewModel(totalCount, pageIndex, SiteConfig.PageSize, 5);
            model.Pagination.ShowTotal = true;
            model.FolderTree           = GetCurrentFolderTree(id);
            model.Instance             = model.FolderTree.CurrentFolder;
            model.PageTitle            = string.Format("Folder: {0}", model.FolderTree.CurrentFolder.FullName);
            model.CurrentLanguage      = CurrentLanguage;
            return(View(model));
        }